mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
Factor common userland and baremetal C functions
This allows add.c to run unmodified on both! For that to work, use int main on baremetal, and pass the return value to the final exit.
This commit is contained in:
@@ -8,5 +8,4 @@ mystart:
|
||||
ldr x0, =stack_top
|
||||
mov sp, x0
|
||||
bl main
|
||||
mov x0, #0
|
||||
bl exit
|
||||
|
||||
@@ -2,5 +2,4 @@
|
||||
mystart:
|
||||
ldr sp, =stack_top
|
||||
bl main
|
||||
mov r0, #0
|
||||
bl exit
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
void assert_fail();
|
||||
#endif
|
||||
@@ -86,8 +86,3 @@ void _exit(int status) {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void assert_fail() {
|
||||
puts("lkmc_test_fail");
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user