aboutsummaryrefslogtreecommitdiffstats
path: root/src/c_bsdsetsid.S
diff options
context:
space:
mode:
Diffstat (limited to 'src/c_bsdsetsid.S')
-rw-r--r--src/c_bsdsetsid.S49
1 files changed, 29 insertions, 20 deletions
diff --git a/src/c_bsdsetsid.S b/src/c_bsdsetsid.S
index 73ab582..810fe8c 100644
--- a/src/c_bsdsetsid.S
+++ b/src/c_bsdsetsid.S
@@ -1,28 +1,37 @@
.text
-.extern u_strlen
-.globl main
+.extern u_strlen
+.extern u_pout
+.extern u_perr
+.globl main
main:
xorq %rcx, %rcx
- movq (%rsi, %rcx, 8), %rsi
- movq %rsi, %rdi
- callq u_strlen
- movq $0x1, %rdi
- movq %rax, %rdx
- xorq %rax, %rax
- movb $0x4, %al
- syscall
- movq $0x1, %rdi
- leaq nl, %rsi
- movq $0x1, %rdx
- xorq %rax, %rax
- movq $0x4, %rax
- syscall
- xorq %rax, %rax
- xorq %rax, %rax
+ callq c_push
+ movq (%rsi, %rcx, 8), %rdi
+ callq u_pout
+ callq c_pop
+ inc %rcx
+ callq c_push
+ movq (%rsi, %rcx, 8), %rdi
+ callq u_pout
+ callq c_pop
xorq %rdi, %rdi
- movb $0x1, %al
+ 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
+
.data
- nl: .asciz "\n"
+nl: .asciz "\n"
+asd: .asciz "hey\n"