aboutsummaryrefslogtreecommitdiffstats
path: root/src/u_print.S
blob: 47a94831650a15f0bcb2ee5ebf0eca0a1c005298 (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:
	mov		$0x1, %r11	# stdout
	jmp		u_print

u_perr:
	mov	$0x2, %r11	# stderr
	jmp		u_print

u_print:
	call	u_strlen
	mov		%rax, %rdx
	mov		%rdi, %rsi
	mov		%r11, %rdi
	mov		$0x4, %rax	# SYS_write
	syscall
	lea		nl, %rsi
	mov		$0x1, %rdx
	mov		$0x4, %rax	# SYS_write
	syscall
	ret

.data
nl: .asciz "\n"