Files
Ciro Santilli 六四事件 法轮功 26cab92bfc baremetal: allow arbitrary exit status with the magic string
test-baremetal: fix missing setting x0 return value

Examples were just returning on ret without setting x0, which led to
failures... those were not noticed because of how broken the testing system
was ;-)
2019-05-06 00:00:01 +00:00

33 lines
545 B
ArmAsm

/* https://github.com/cirosantilli/linux-kernel-module-cheat#svc */
#include <lkmc.h>
.global main
main:
/* Do the svc. */
svc 0
/* Confirm that svc was called and modified myvar. */
ldr x0, myvar
ldr x1, mynewvar
cmp x0, x1
beq 1f
bl lkmc_assert_fail
1:
/* Go home. */
mov x0, 0
ret
LKMC_GLOBAL(lkmc_vector_trap_handler)
/* Modify myvar as a visible side effect. */
ldr x0, mynewvar
ldr x1, =myvar
str x0, [x1]
ret
myvar:
.quad 0x0
mynewvar:
.quad 0x12346789ABCDEF0