GNU Assembly Issues on OSX - Referencing Strings
I've run into an issue after following this tutorial -
https://www.youtube.com/watch?v=RvvRO_gWYIg
A few noticeable issues is it looks like the processor architecture and
operating system may differ quite heavily from the one I'm working on. In
the video it seems to be an i386 linux box, and I'm working on an x64 OSX
machine.
Posted below is my broken code, and it seems to work when I remove the
string reference, so I'm guessing it has something to do with that.
Any help would be greatly appreciated!
Thanks~
# Hello World Program:
.data
HelloWorldStr:
.ascii "Hello World"
.text
.globl start
start:
# Load all the arguments for write():
# write(output, string, string_size)
movl $4, %eax # Load write()
movl $1, %ebx # Arg Output of write() :: STDOUT
movl $HelloWorldStr, %ecx # Referencing the Memory Loc. of the String
movl $11, %edx # Byte length of the String "Hello World"
int $0x80
# Call Exit:
movl $1, %eax
movl $0, %ebx
int $0x80
No comments:
Post a Comment