It is less confusing if the exit handler printed out an error message before cap faulting, or provided an alternative default implementation that suspends the current thread if an initial_thread_tcb is saved in the current runtime environment before triggering a fault.
The current implementation:
/* If the exit is never set this will try and call a NULL function
* pointer which should result in a fault. This is as good a way as
* any to exit the process if we don't know anything better about
* the environment. */
env.exit_cb(code);
Will raise this fault:
Caught cap fault in send phase at address 0
while trying to handle:
vm fault on data at address 0 with status 0x4
in thread 0xffffff801fe08400 "rootserver" at address 0
With stack:
0x41ce98: 0x401740
0x41cea0: 0x0
0x41cea8: 0x401100
0x41ceb0: 0x41cef0
0x41ceb8: 0x40121b
0x41cec0: 0x0
0x41cec8: 0x41cf30
0x41ced0: 0x41cf20
0x41ced8: 0x41cf10
0x41cee0: 0x1
0x41cee8: 0x4010f2
0x41cef0: 0x41cff0
0x41cef8: 0x401394
0x41cf00: 0x0
0x41cf08: 0x525000
0x41cf10: 0x41201c
It is less confusing if the exit handler printed out an error message before cap faulting, or provided an alternative default implementation that suspends the current thread if an
initial_thread_tcb
is saved in the current runtime environment before triggering a fault. The current implementation:Will raise this fault: