aboutsummaryrefslogtreecommitdiffstats
path: root/src/u_print.S
blob: 3866868c51e71dbc3b877a02d7cc91fa2c0b6658 (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
.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"