➕ Moves from 32 to 64 bit syscalls
This commit is contained in:
parent
53c4896829
commit
5acba466b4
21
main.s
21
main.s
@ -2,16 +2,17 @@
|
|||||||
|
|
||||||
.text
|
.text
|
||||||
_start:
|
_start:
|
||||||
movl $4, %eax # 4 (code for "write" syscall) -> EAX register
|
mov $1, %rax
|
||||||
movl $1, %ebx # 1 (file descriptor for stdout) -> EBX (1st argument to syscall)
|
mov $1, %rdi
|
||||||
movl $msg, %ecx # 32-bit address of msg string -> ECX (2nd argument)
|
mov $msg, %rsi
|
||||||
movl $len, %edx # length of msg string -> EDX (3rd arg)
|
mov $len, %rdx
|
||||||
int $0x80 # interrupt with location 0x80 (128), which invokes the kernel's system call procedure
|
syscall
|
||||||
|
|
||||||
|
mov $60, %rax
|
||||||
|
mov $0, %rdi
|
||||||
|
syscall
|
||||||
|
|
||||||
movl $1, %eax # 1 ("exit") -> EAX
|
|
||||||
movl $0, %ebx # 0 (with success) -> EBX
|
|
||||||
int $0x80 # see previous
|
|
||||||
.data
|
.data
|
||||||
msg:
|
msg:
|
||||||
.ascii "Hello, world!\n" # inline ascii string
|
.ascii "Hello, world!\n"
|
||||||
len = . - msg # assign (current address - address of msg start) to symbol "len"
|
len = . - msg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user