mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-28 12:34:26 +01:00
baremetal: ah, actually nope, it didn't work :-(
Workaround for now. Works on asserts, but not on exit 1. Some other day, maybe. https://github.com/cirosantilli/linux-kernel-module-cheat/issues/59
This commit is contained in:
@@ -1,5 +1,21 @@
|
||||
#include <lkmc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void atexit_cb(void) {
|
||||
puts("atexit");
|
||||
}
|
||||
|
||||
void onexit_cb(int status, void *arg) {
|
||||
printf("status %d\n", status);
|
||||
}
|
||||
|
||||
void __attribute__ ((constructor)) premain() {
|
||||
printf("premain2()\n");
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
atexit(atexit_cb);
|
||||
on_exit(onexit_cb, NULL);
|
||||
lkmc_assert_fail();
|
||||
}
|
||||
|
||||
9
lkmc/hello.c
Normal file
9
lkmc/hello.c
Normal file
@@ -0,0 +1,9 @@
|
||||
/* Print hello to stdout ;-) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
puts("hello");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user