Linux-SWAT
Forum Addict!
- Joined
- Feb 13, 2010
- Messages
- 9,188
Here's the little loop with Levi's suggestion :
About the register reset, only r0 has to be reset because after the swi/svc 0, its value is 13.
Code:
.text
.align 2
.global _start
_start:
ldr r1, =text @ buffer to write
mov r2, #13 @ buffer length
mov r7, #4 @ system call number, 4 is 'write'
mov r5, #5 @ set the counter to 5
_loop:
mov r0, #1 @ file descriptor 1 - stdout
svc 0 @ call the Linux kernel and print the text
subs r5, #1 @ decrement the counter
bne _loop @ if not zero, come back to _loop
mov r7, #1 @ exit
svc 0
.data
text: .asciz "hello world!\n"