aboutsummaryrefslogtreecommitdiffstats
path: root/src/c_bsdsetsid.S
blob: 810fe8ceccc1b27e9fc7bbb6d1bdff51d4a6ebf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
.text
.extern	u_strlen
.extern	u_pout
.extern	u_perr
.globl	main

main:
	xorq	%rcx, %rcx
	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
	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"
asd: .asciz "hey\n"