benbrittain opened PR #1474 from master
to master
:
This is an MVP port for Fuchsia.
There are at least two things that need to be cleaned up in the future:
- Currently we spawn one exception handling thread per runtime thread. In the future we'll want to
zx_object_wait_async
/ports and register with a global exception handling thread- The convention for registering a fault handler
I know that these syscalls are super unfamiliar so I'm happy to provide context. I've also unfortunately chosen to use the lowest level bindings since they are our most stable interface for out-of-tree Rust code.
cc/ @leecam
alexcrichton submitted PR Review.
alexcrichton submitted PR Review.
alexcrichton created PR Review Comment:
To avoid the extra
not(...)
could this list fuchsia first with// no extensions at this time
alexcrichton created PR Review Comment:
FWIW this is fine to leave out, this is intended for the API extensions in the
wasmtime
crate but those were left out, so this could be a noop on fuchsia.
alexcrichton created PR Review Comment:
Mind listing fuchsia first to avoid the extra
not(..)
?
alexcrichton created PR Review Comment:
FWIW I think this isn't quite right, this is actually only one exception handling thread for the first thread, but no other threads get exception handlers set.
alexcrichton created PR Review Comment:
Some extra tabs sneaking in here?
alexcrichton created PR Review Comment:
Mind throwing this into the general
cfg_if
block above?
alexcrichton created PR Review Comment:
You may want to leave a TODO here because this won't work in stack overflow situations, only for normal faults. (this is why we use sigaltstack on unix)
alexcrichton created PR Review Comment:
This can also be done with
fuchsia::fault_handler as usize as *const ()
(notransmute
necessary)
alexcrichton created PR Review Comment:
I think there may need to be some special tidbits when resuming the original thread here? I think you probably want to resume the instruction itself rather than one byte past, and additionally I think something here needs to clean up the stack allocation for the context info, but I'm not sure that anything currently does?
alexcrichton created PR Review Comment:
Should this perhaps have a TODO to do something with
handled
? If it'sfalse
this may infinitely try to handle the fault here?
alexcrichton created PR Review Comment:
Thinking some more about this, is there a syscall or a standard method for "resume this thread given this thread context?" Because you basically want to always resume the exact same instruction in the exact same context (all registers preserved which currently aren't I think), but sometimes you'll unregister the trap handling logic.
benbrittain submitted PR Review.
benbrittain created PR Review Comment:
I really wish Fuchsia wasn't marked as a unix
benbrittain closed without merge PR #1474.
Last updated: Dec 23 2024 at 12:05 UTC