From 74ea3ddf1053c35f205b0a2b3d15678c357c4964 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 18 Nov 2020 14:47:40 +0000 Subject: This is the beginning FossilOrigin-Name: 6db238a60f5173c98996ae2a135f762a21fdce4f --- src/c_bsdsetsid.S | 16 ++++++++++++++++ src/u_write.S | 14 ++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/c_bsdsetsid.S create mode 100644 src/u_write.S (limited to 'src') diff --git a/src/c_bsdsetsid.S b/src/c_bsdsetsid.S new file mode 100644 index 0000000..abf5afb --- /dev/null +++ b/src/c_bsdsetsid.S @@ -0,0 +1,16 @@ +.data +str: + .asciz "a string\n" + +.text +.extern u_write +.globl _start + +_start: + movq $0x1, %rdi + leaq str, %rsi + movq $0x9, %rdx + callq u_write + movq $0x1, %rax + xorq %rdi, %rdi + syscall diff --git a/src/u_write.S b/src/u_write.S new file mode 100644 index 0000000..efd7b9c --- /dev/null +++ b/src/u_write.S @@ -0,0 +1,14 @@ +.text +.globl u_write + +u_write: + movq $0x4, %rax + syscall + movq %rax, %rcx + jc u_err + movq %rcx, %rax + retq + +u_err: + movq $0xffffffffffffffff, %rax + retq -- cgit v1.2.3