aboutsummaryrefslogtreecommitdiffstats
path: root/src/u_print.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/u_print.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/u_print.S28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/u_print.S b/src/u_print.S
new file mode 100644
index 0000000..3866868
--- /dev/null
+++ b/src/u_print.S
@@ -0,0 +1,28 @@
+.text
+.extern u_strlen
+.globl u_pout
+.globl u_perr
+
+u_pout:
+ movq $0x1, %r11 # stdout
+ jmp u_print
+
+u_perr:
+ movq $0x2, %r11 # stderr
+ jmp u_print
+
+u_print:
+ callq u_strlen
+ movq %rax, %rdx
+ movq %rdi, %rsi
+ movq %r11, %rdi
+ movq $0x4, %rax # SYS_write
+ syscall
+ leaq nl, %rsi
+ movq $0x1, %rdx
+ movq $0x4, %rax # SYS_write
+ syscall
+ retq
+
+.data
+nl: .asciz "\n"