prevent cyclic Expects warning#2366
Conversation
5310776 to
ae97935
Compare
|
rebased to sync with main |
|
This looks good - but can you help me figure out how to test it? I will, but might not be today. Also, I agree that we should have an early and late panic, where only the late one expects libc to be initialized- although we could just check if it is. I think there's a boolean for that somewhere. |
|
We do have I tested this by manually lying in |
it's not guaranteed that all implementations of `reboot()` are
terminating calls.
`reboot_os()`, externally defined at
`src/arch/{x86_64,i686}/apic_asm.asm` both terminate, but this seems to
be an implementation detail of the x86 architecture.
ae97935 to
856c69c
Compare
|
re-based and re-tested. |
This builds on top of #2363 due to tests.
As requested in #2361 (comment), it's better to handle cyclic faults at the exception handler. This PR fixes this, with some practical compromises.
Ideally, I would have liked to call
os::panic(), but this has some issues: currently,os::paniconly supports being called withconst char *why, with no concept of source location or expressions.Furthermore, it (used to) assume libc was initialized (i.e. calling
printfand friends). I've added a check to prevent this being an issue, irrespective of the problem this PR solves. I thinkos::panicshould have two interfaces: a dumb one that can be used irrespective of initialization state (that is, a simple fallback mechanism that is similar to my implementation of__expect_fail), and a complete one that acceptsstd::format_stringand cooperates correctly with the rest of the system.Unrelated to this, calling
__arch_poweroff()does not feel good. I wanted to callos::shutdown(), but this doesn't actually trigger a shutdown unless the proper message has been sent to vmrunner. I've opened #2364 with more details about this.