mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-13 20:12:26 +00:00
What was missing previously was implementing abort in baremetal. I had done that previously and forgotten to do this conversion!
29 lines
802 B
C
29 lines
802 B
C
/* https://github.com/cirosantilli/linux-kernel-module-cheat#lkmc-c */
|
|
|
|
#include <math.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include <lkmc.h>
|
|
|
|
void lkmc_baremetal_on_exit_callback(int status, void *arg) {
|
|
(void)arg;
|
|
if (status != 0) {
|
|
printf("lkmc_exit_status_%d\n", status);
|
|
}
|
|
}
|
|
|
|
#if defined(__aarch64__)
|
|
#define LKMC_SYSREG_READ_WRITE(type, name) \
|
|
type LKMC_CONCAT(LKMC_CONCAT(LKMC_SYSREG_SYMBOL_PREFIX, name), _read(void)) { \
|
|
type name; \
|
|
__asm__ __volatile__("mrs %0, " #name : "=r" (name) : : ); \
|
|
return name; \
|
|
} \
|
|
void LKMC_CONCAT(LKMC_CONCAT(LKMC_SYSREG_SYMBOL_PREFIX, name), _write(type name)) { \
|
|
__asm__ __volatile__("msr " #name ", %0" : : "r" (name) : ); \
|
|
}
|
|
LKMC_SYSREG_OPS
|
|
#undef LKMC_SYSREG_READ_WRITE
|
|
#endif
|