aboutsummaryrefslogtreecommitdiffstats
path: root/src/c_bsdsetsid.S
diff options
context:
space:
mode:
authorJozanLeClerc <JozanLeClerc@noemail.net>2020-11-19 19:40:03 +0000
committerJozanLeClerc <JozanLeClerc@noemail.net>2020-11-19 19:40:03 +0000
commit6126cb3f4173ae8e440b35e02e166a5c86378db0 (patch)
tree61d2c6def8a4e7e34236fe18e804e728e2cdea3a /src/c_bsdsetsid.S
parentPretty cool (diff)
downloadbsdsetsid-6126cb3f4173ae8e440b35e02e166a5c86378db0.tar.gz
bsdsetsid-6126cb3f4173ae8e440b35e02e166a5c86378db0.tar.bz2
bsdsetsid-6126cb3f4173ae8e440b35e02e166a5c86378db0.tar.xz
bsdsetsid-6126cb3f4173ae8e440b35e02e166a5c86378db0.tar.zst
bsdsetsid-6126cb3f4173ae8e440b35e02e166a5c86378db0.zip
In progress
FossilOrigin-Name: 0e3af2b7fdaa117d45dd21f15813cadbb0a59c81
Diffstat (limited to '')
-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"