diff options
author | JozanLeClerc <JozanLeClerc@noemail.net> | 2020-11-18 17:40:47 +0000 |
---|---|---|
committer | JozanLeClerc <JozanLeClerc@noemail.net> | 2020-11-18 17:40:47 +0000 |
commit | bf34309f946621e4369606e4ceba3ccb28050de6 (patch) | |
tree | ac9ea6d12fd41aa9fa53298e53d875cc28c7472e | |
parent | I can read argv and envp now (diff) | |
download | bsdsetsid-bf34309f946621e4369606e4ceba3ccb28050de6.tar.gz bsdsetsid-bf34309f946621e4369606e4ceba3ccb28050de6.tar.bz2 bsdsetsid-bf34309f946621e4369606e4ceba3ccb28050de6.tar.xz bsdsetsid-bf34309f946621e4369606e4ceba3ccb28050de6.tar.zst bsdsetsid-bf34309f946621e4369606e4ceba3ccb28050de6.zip |
Pretty cool
FossilOrigin-Name: 78a3fce27b2e7b39da0eeb58d3d28e5997e438d4
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | src/c_bsdsetsid.S | 25 |
2 files changed, 16 insertions, 10 deletions
@@ -23,6 +23,7 @@ PREFIX := /usr/local/ DESTDIR := SRCS := ${SRCS_DIR}c_bsdsetsid.S +SRCS += ${SRCS_DIR}u_strlen.S OBJS = ${SRCS:.S=.o} diff --git a/src/c_bsdsetsid.S b/src/c_bsdsetsid.S index 29eacdc..73ab582 100644 --- a/src/c_bsdsetsid.S +++ b/src/c_bsdsetsid.S @@ -1,23 +1,28 @@ .text +.extern u_strlen .globl main -c_main: - movq $0x1, %rdi +main: xorq %rcx, %rcx - inc %rcx - movq (%rdx, %rcx, 8), %rsi - movq $0xa, %rdx + movq (%rsi, %rcx, 8), %rsi + movq %rsi, %rdi + callq u_strlen + movq $0x1, %rdi + movq %rax, %rdx + xorq %rax, %rax movb $0x4, %al syscall - retq - -main: + movq $0x1, %rdi + leaq nl, %rsi + movq $0x1, %rdx + xorq %rax, %rax + movq $0x4, %rax + syscall xorq %rax, %rax - callq c_main xorq %rax, %rax xorq %rdi, %rdi movb $0x1, %al syscall .data - str: .asciz "a string\n" + nl: .asciz "\n" |