diff options
author | JozanLeClerc <JozanLeClerc@noemail.net> | 2020-11-19 20:57:22 +0000 |
---|---|---|
committer | JozanLeClerc <JozanLeClerc@noemail.net> | 2020-11-19 20:57:22 +0000 |
commit | b5266802fb585596234faff4ee92bc4d04294ea2 (patch) | |
tree | a20aefbfc4dfcac5c694136187f0aaf65b4d5570 /src | |
parent | In progress (diff) | |
download | bsdsetsid-b5266802fb585596234faff4ee92bc4d04294ea2.tar.gz bsdsetsid-b5266802fb585596234faff4ee92bc4d04294ea2.tar.bz2 bsdsetsid-b5266802fb585596234faff4ee92bc4d04294ea2.tar.xz bsdsetsid-b5266802fb585596234faff4ee92bc4d04294ea2.tar.zst bsdsetsid-b5266802fb585596234faff4ee92bc4d04294ea2.zip |
In good progress
FossilOrigin-Name: 40f3efb8963f27cbb111250ced45c7623211eec7
Diffstat (limited to 'src')
-rw-r--r-- | src/c_bsdsetsid.S | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/src/c_bsdsetsid.S b/src/c_bsdsetsid.S index 810fe8c..17cf57b 100644 --- a/src/c_bsdsetsid.S +++ b/src/c_bsdsetsid.S @@ -5,33 +5,43 @@ .globl main main: + cmpb $0x1, %dil + jle c_noarg + pushq %rdi + pushq %rsi + pushq %rdx xorq %rcx, %rcx - callq c_push movq (%rsi, %rcx, 8), %rdi + movq %rcx, %r8 callq u_pout - callq c_pop + movq %r8, %rcx + popq %rdx + popq %rsi + popq %rdi + pushq %rdi + pushq %rsi + pushq %rdx inc %rcx - callq c_push movq (%rsi, %rcx, 8), %rdi callq u_pout - callq c_pop - xorq %rdi, %rdi + popq %rdx + popq %rsi + popq %rdi + jmp c_exit + +c_noarg: + leaq noarg_str, %rdi + callq u_perr + movq $0x1, %rdi xorq %rax, %rax movb $0x1, %al # SYS_exit syscall -c_push: - movq %rdx, %r8 - movq %rsi, %r9 - movq %rdi, %r10 - retq - -c_pop: - movq %r8, %rdi - movq %r9, %rsi - movq %r10, %rdx - retq +c_exit: + xorq %rdi, %rdi + xorq %rax, %rax + movb $0x1, %al # SYS_exit + syscall .data -nl: .asciz "\n" -asd: .asciz "hey\n" +noarg_str: .asciz "bsdsetsid: no command specified" |