From d058ad9d31b94e5c8aee416cd3e3062bf2819469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20A=2E=20Ortega?= Date: Sun, 18 Sep 2016 21:06:35 +0200 Subject: [PATCH] Optimized the code a bit. --- src/helloworld.asm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/helloworld.asm b/src/helloworld.asm index 7c3e3d3..7c3727b 100644 --- a/src/helloworld.asm +++ b/src/helloworld.asm @@ -1,6 +1,8 @@ .section .data - hello: - .ascii "Hello, World.\n" # the string +hello: + .ascii "Hello, World!\n" # the string +hello_end: +.equ hello_len, hello_end - hello .section .text .global _start @@ -9,9 +11,9 @@ _start: mov $1, %rax # Define write syscall mov $1, %rdi # Define stdout 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 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