Skip to content

Automatically print lkmc_exit_status_X on baremetal _exit without bootloader (Newlib) #59

@cirosantilli

Description

@cirosantilli

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions