mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 11:41:35 +01:00
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 ;-)
33 lines
545 B
ArmAsm
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
|