baremetal aarch64: create C version of multicore.S as well

Attempted to do the same for arm, but it failed.
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-08-21 00:00:00 +00:00
parent 6f88fa17bc
commit f28191a735
21 changed files with 336 additions and 89 deletions

View File

@@ -0,0 +1,35 @@
#include <lkmc.h>
/* This is implemented in assembly so that it does not use the stack,
* and thus can be called safely from programs without the bootloader.
* C signature:
*
* void _exit(int status)
*
* If only there was a GCC attribute to create such a function!
*/
.text
.global _exit
_exit:
#if LKMC_GEM5
LKMC_M5OPS_EXIT_ASM
#else
/* Use semihosting:
* https://github.com/cirosantilli/linux-kernel-module-cheat#semihosting */
#if defined(__arm__)
mov r0, #0x18
ldr r1, =#0x20026
svc 0x00123456
#elif defined(__aarch64__)
mov x1, 0x26
movk x1, 2, lsl 16
ldr x2, =.Lsemihost_args
str x1, [x2, 0]
str x0, [x2, 8]
mov x1, x2
mov w0, 0x18
hlt 0xf000
.Lsemihost_args:
.skip 16
#endif
#endif