Optimized the code a bit.
This commit is contained in:
parent
e5369eca59
commit
d058ad9d31
@ -1,6 +1,8 @@
|
|||||||
.section .data
|
.section .data
|
||||||
hello:
|
hello:
|
||||||
.ascii "Hello, World.\n" # the string
|
.ascii "Hello, World!\n" # the string
|
||||||
|
hello_end:
|
||||||
|
.equ hello_len, hello_end - hello
|
||||||
|
|
||||||
.section .text
|
.section .text
|
||||||
.global _start
|
.global _start
|
||||||
@ -9,9 +11,9 @@ _start:
|
|||||||
mov $1, %rax # Define write syscall
|
mov $1, %rax # Define write syscall
|
||||||
mov $1, %rdi # Define stdout
|
mov $1, %rdi # Define stdout
|
||||||
mov $hello, %rsi # Give string
|
mov $hello, %rsi # Give string
|
||||||
mov $14, %rdx # Give size of the string
|
mov $hello_len, %rdx # Give size of the string
|
||||||
syscall # Call the kernel to do work for us
|
syscall # Call the kernel to do work for us
|
||||||
|
|
||||||
mov $60, %rax # Define exit syscall
|
mov $60, %rax # Define exit syscall
|
||||||
xor %rdi, %rdi # Give return value
|
mov $0, %rdi # Give return value
|
||||||
syscall # Call the kernel to do work for us
|
syscall # Call the kernel to do work for us
|
||||||
|
Loading…
Reference in New Issue
Block a user