# Linux Kernel Module Cheat

#### 11.7.2. gem5 syscall emulation exit status

As of gem5 7fa4c946386e7207ad5859e8ade0bbfc14000d91, the crappy `se.py` script does not forward the exit status of syscall emulation mode, you can test it with:

    ./run --dry-run --emulator gem5 --userland userland/c/false.c

Source: userland/c/false.c.

Then manually run the generated gem5 CLI, and do:

    echo $?

and the output is always `0`.

Instead, it just outputs a message to stdout just like for m5 fail:

    Simulated exit code not 0! Exit code is 1

which we parse in run and then exit with the correct result ourselves…​

Related thread: https://stackoverflow.com/questions/56032347/is-there-a-way-to-identify-if-gem5-run-got-over-successfully