twizzler-operating-system / twizzler

The Twizzler Operating System
BSD 3-Clause "New" or "Revised" License
62 stars 13 forks source link

Flesh out reference runtime implementation, reach parity with minimal runtime #155

Closed dbittman closed 7 months ago

dbittman commented 8 months ago

This PR continues to implement the reference runtime, continuing on from the last PR in this series, #147 .

Highlights:

  1. Implements the Debug runtime, enabling the use of backtraces across multiple dynamic modules.
  2. Implements and updates the object runtime, which now has Arc-like semantics on object handles to allow for automatic refcounting so that the runtime can be notified once the object handle is fully dropped.
  3. Implements the thread runtime, up to feature parity with the minimal runtime.
  4. Fixes a bug in the kernel that fails to re-enqueue waiters-on-thread-state properly when threads are exited.
  5. Implements the sys_object_read_map syscall (needed by bootstrap to learn the state of the address space)

Next steps will be

  1. Completing the threading runtime, according to the thread model RFC.
  2. Implementing support for compartments and secure calls (without a lot of the actual enforcement, yet...)
  3. Moving over existing programs, like init, devmgr, etc, to run on the new runtime.

Each of these will be its own PR.

TODO Before Ready for Review

dbittman commented 8 months ago

This PR makes a choice to extend the number of "magic function definitions" (e.g. twz_get_runtime, tls_get_addr) to include dl_iterate_phdr, a function commonly defined by unix-like dynamic linkers to allow libunwind to get a list of loaded objects and their segment info.

Alternatives considered, and rejected:

The documentation of these "magic functions" will be placed into the runtime docs (separate PR)

dbittman commented 7 months ago

That's kinda what I'm trying to do, get us to a point where these big changes aren't necessary. This PR gets us up to feature parity with the minimal runtime, after which individual, contained changes will (hopefully) be easier.