Files
linux-kernel-module-cheat/baremetal/arch/aarch64/semihost_exit.S
Ciro Santilli 六四事件 法轮功 f28191a735 baremetal aarch64: create C version of multicore.S as well
Attempted to do the same for arm, but it failed.
2019-08-21 00:00:00 +00:00

24 lines
514 B
ArmAsm

/* https://cirosantilli.com/linux-kernel-module-cheat#semihosting */
.global main
main:
/* 0x20026 == ADP_Stopped_ApplicationExit */
mov x1, 0x26
movk x1, 2, lsl 16
str x1, [sp, 0]
/* Exit status code. Host QEMU process exits with that status. */
mov x0, 0
str x0, [sp, 8]
/* x1 contains the address of parameter block.
* Any memory address could be used.
*/
mov x1, sp
/* SYS_EXIT */
mov w0, 0x18
/* Do the semihosting call on A64. */
hlt 0xf000