Repository navigation
host-native: Initial support for host-native tasks - #2736
Open
jamesmunns wants to merge 9 commits into
Open
jamesmunns wants to merge 9 commits into
jamesmunns wants to merge 9 commits into
Conversation
This crate contains the protocol between a host-native `kern` impl and a host-native `userlib` impl.
Also updates ping and pong tasks, and adds stub task.
jamesmunns
force-pushed
the
james/native-pt1
branch
from
October 14, 2026 17:57
4b18bec to
2dba0fa
Compare
Contributor
Author
|
(sorry for the one force-push to bring this up to date with the |
Contributor
Author
Hmm, I will need to probably:
|
This was causing measurable code/stack bloat on some targets.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR builds on #2704 and #2705 by implementing the respective
Archtraits on the native host architecture.Closes #2706.
From a high level, this compiles the kernel and each task as binaries for the host architecture, and then launching the kernel process. The kernel process then spawns each task as a child OS process, and communicates with it using stdio. The child tasks emit system calls to stdout, and block for a response on stdin. The kernel then processes system calls, and performs scheduling using
kern's actual scheduling logic, resuming one task at a time.The kernel can be configured to operate at "wall clock" time (so delays/scheduling is real, and should appear roughly at the same speed hardware would), or non-realtime, meaning that the system will execute as fast as possible, fast-forwarding the clock whenever the system would sit in the idle task.
Host apps are configured the same way firmware apps are: we define a folder in
app, and can add manifests in the TOML format. I've addedhostdefinitions for all of the necessary bits to make this work. You can now run the following command, and see the following output tracing raw syscalls that occur:$ cargo xtask host-run --trace --stop-at 1000 app/host/demo.toml Finished `dev` profile [optimized + debuginfo] target(s) in 0.16s Running `target/debug/xtask host-run --trace --stop-at 1000 app/host/demo.toml` building task-pong for the host Finished `dev` profile [optimized + debuginfo] target(s) in 0.10s building task-ping for the host Finished `dev` profile [optimized + debuginfo] target(s) in 0.10s building task-stub for the host Finished `dev` profile [optimized + debuginfo] target(s) in 0.09s building host-demo for the host Finished `dev` profile [optimized + debuginfo] target(s) in 0.09s wrote target/host/host-demo/host-config.ron running target/host/debug/host-demo [kernel t=0000000] task pong started: /Users/james/oxide/hubris/target/host/debug/task-pong (pid 21736) [kernel t=0000000] task ping started: /Users/james/oxide/hubris/target/host/debug/task-ping (pid 21737) [kernel t=0000000] task user_leds started: /Users/james/oxide/hubris/target/host/debug/task-stub (pid 21738) [kernel t=0000000] task user_leds: RECV mask 0x0 from None [kernel t=0000000] task pong: REFRESH_TASK_ID [kernel t=0000000] task pong: resumed from REFRESH_TASK_ID with [02, 00, 00, 00, 00, 00] [kernel t=0000000] task pong: SET_TIMER Some(500) bits 0x1 [kernel t=0000000] task pong: resumed from SET_TIMER with [00, 00, 00, 00, 00, 00] [kernel t=0000000] task pong: RECV mask 0x1 from None [kernel t=0000000] task ping: REFRESH_TASK_ID [kernel t=0000000] task ping: resumed from REFRESH_TASK_ID with [00, 00, 00, 00, 00, 00] [kernel t=0000000] task ping: SEND to pong: op 1 (5 bytes) [kernel t=0000000] task pong: resumed from RECV with [00, 01, 01, 05, 10, 00] [kernel t=0000000] task pong: REPLY to ping: code 0 (0 bytes) [kernel t=0000000] task pong: resumed from REPLY with [00, 00, 00, 00, 00, 00] [kernel t=0000000] task pong: RECV mask 0x1 from None [kernel t=0000000] task ping: resumed from SEND with [00, 00, 00, 00, 00, 00] [kernel t=0000000] task ping: process ended, MemoryAccess { address: None, source: User } [kernel t=0000000] task pong: resumed from RECV with [00, FFFF, 01, 00, 00, 00] [kernel t=0000000] task pong: SET_TIMER Some(1000) bits 0x1 [kernel t=0000000] task pong: resumed from SET_TIMER with [00, 00, 00, 00, 00, 00] [kernel t=0000000] task pong: SEND to user_leds: op 3 (8 bytes) [kernel t=0000000] task user_leds: resumed from RECV with [00, 00, 03, 08, 00, 00] [kernel t=0000000] task user_leds: REPLY to pong: code 0 (0 bytes) [kernel t=0000000] task user_leds: resumed from REPLY with [00, 00, 00, 00, 00, 00] [kernel t=0000000] task user_leds: RECV mask 0x0 from None [kernel t=0000000] task pong: resumed from SEND with [00, 00, 00, 00, 00, 00] [kernel t=0000000] task pong: RECV mask 0x1 from None [kernel t=0001000] task idle: waited for the next deadline [kernel t=0001000] task pong: resumed from RECV with [00, FFFF, 01, 00, 00, 00] [kernel t=0001000] task pong: SET_TIMER Some(1500) bits 0x1 [kernel t=0001000] task pong: resumed from SET_TIMER with [00, 00, 00, 00, 00, 00] [kernel t=0001000] task pong: SEND to user_leds: op 3 (8 bytes) [kernel t=0001000] task user_leds: resumed from RECV with [00, 00, 03, 08, 00, 00] [kernel t=0001000] task user_leds: REPLY to pong: code 0 (0 bytes) [kernel t=0001000] task user_leds: resumed from REPLY with [00, 00, 00, 00, 00, 00] [kernel t=0001000] task user_leds: RECV mask 0x0 from None [kernel t=0001000] task pong: resumed from SEND with [00, 00, 00, 00, 00, 00] [kernel t=0001000] task pong: RECV mask 0x1 from None kernel: stopping: time reached the configured stop at 1000 ticksThis is staged as separate commits adding each major "chunk" of changes, though I opened this as a single PR as we sort of need all the pieces existing to get the "tada" experience of it all working.
For the oxide folks, see https://rfd.shared.oxide.computer/rfd/0753 for more contextual details.