2016-11-10 13:34:00 +03:00
|
|
|
#include "common/asm/linkage.h"
|
2013-01-22 22:53:24 +04:00
|
|
|
|
2013-09-26 15:56:35 +04:00
|
|
|
@ We use the register R8 unlike libc that uses R12.
|
|
|
|
@ This avoids corruption of the register by the stub
|
|
|
|
@ for the syscall sys_munmap() when syscalls are hooked
|
|
|
|
@ by ptrace(). However we have to make sure that
|
|
|
|
@ the compiler doesn't use the register on the route
|
|
|
|
@ between parasite_service() and sys_munmap().
|
|
|
|
|
2013-07-10 10:15:56 +04:00
|
|
|
syscall_common:
|
2016-11-03 16:39:41 -07:00
|
|
|
ldr r7, [r7]
|
|
|
|
add r8, sp, #24
|
|
|
|
ldm r8, {r4, r5, r6}
|
2013-07-10 10:15:56 +04:00
|
|
|
svc 0x00000000
|
2016-11-03 16:39:41 -07:00
|
|
|
pop {r4, r5, r6, r7, r8, pc}
|
2013-01-22 22:53:24 +04:00
|
|
|
|
|
|
|
|
2013-07-10 10:15:56 +04:00
|
|
|
.macro syscall name, nr
|
|
|
|
.nr_\name :
|
|
|
|
.long \nr
|
2013-01-22 22:53:24 +04:00
|
|
|
|
2013-07-10 10:15:56 +04:00
|
|
|
ENTRY(\name)
|
2016-11-03 16:39:41 -07:00
|
|
|
push {r4, r5, r6, r7, r8, lr}
|
|
|
|
adr r7, .nr_\name
|
2013-07-10 10:15:56 +04:00
|
|
|
b syscall_common
|
|
|
|
END(\name)
|
|
|
|
.endm
|
2013-01-22 22:53:24 +04:00
|
|
|
|
|
|
|
|
2013-03-25 23:39:56 +04:00
|
|
|
ENTRY(__cr_restore_rt)
|
2016-11-03 16:39:41 -07:00
|
|
|
adr r7, .nr_sys_rt_sigreturn
|
|
|
|
ldr r7, [r7]
|
2013-07-12 18:18:40 +04:00
|
|
|
svc #0
|
2013-03-25 23:39:56 +04:00
|
|
|
END(__cr_restore_rt)
|