linux-kernel-module-cheat
linux-kernel-module-cheat copied to clipboard
Automatically print lkmc_exit_status_X on baremetal _exit without bootloader (Newlib)
Does not work to add it to _exit:
(void _exit(int status) {
#if 0
/* This attempt failed. Works on some programs but fails on others like assert_fail.c
* The problem seems to be that at this point newlib has already done some deinitialization
* which prevents printf from working, and printf fails and returns -1.
*/
if (status != 0) {
/* https://github.com/cirosantilli/linux-kernel-module-cheat#magic-failure-string */
printf("lkmc_exit_status_%d\n", status);
}
#endif
So currently doing on_exit as mentioned at: https://github.com/cirosantilli/linux-kernel-module-cheat/tree/406ee82cf33a6e3df0067b219b0414c59d7018b3#magic-failure-string