asm.s
authoryu.dongliang <18588496441@163.com>
Sat, 13 Dec 2025 13:52:25 +0000 (21:52 +0800)
committeryu.dongliang <18588496441@163.com>
Sat, 13 Dec 2025 13:52:25 +0000 (21:52 +0800)
asm.s

diff --git a/asm.s b/asm.s
index e92ef741698b27bbd323479d713ad18c8b75d3d3..ecebc7184f505fb12c0fbe8326a10a4511274186 100644 (file)
--- a/asm.s
+++ b/asm.s
@@ -7,7 +7,7 @@ asm_main:
 #rsi = argv
 #rdx = envp
        cmp $2, %rdi
-       jl  5f
+       jl  _print_usage
 
        mov 8(%rsi), %rdi
 0:
@@ -55,3 +55,12 @@ asm_main:
        jmp 0b
 6:
        ret
+_print_usage:
+       push %rdi
+       leaq usage, %rdi
+       mov  $0, %eax
+       call printf
+       pop  %rdi
+       ret
+.data
+usage: .asciz "./a.out asm_code\n"