35 lines
342 B
ArmAsm
35 lines
342 B
ArmAsm
|
bits 64
|
||
|
default rel
|
||
|
|
||
|
global cat
|
||
|
|
||
|
section .data
|
||
|
buf: db 0
|
||
|
|
||
|
section .text
|
||
|
|
||
|
cat:
|
||
|
push r12
|
||
|
push rbx
|
||
|
mov r12, rdi ; fd to read
|
||
|
mov rbx, rsi ; bytes to read
|
||
|
|
||
|
.l: mov eax, 3 ; read
|
||
|
mov rdi, r12
|
||
|
lea rsi, [buf]
|
||
|
mov rdx, 1
|
||
|
syscall
|
||
|
|
||
|
mov eax, 4 ; write
|
||
|
mov rdi, 1
|
||
|
lea rsi, [buf]
|
||
|
mov rdx, 1
|
||
|
syscall
|
||
|
|
||
|
dec rbx
|
||
|
jnz .l
|
||
|
|
||
|
pop rbx
|
||
|
pop r12
|
||
|
ret
|