Skip to content

host-native: Initial support for host-native tasks - #2736

Open
jamesmunns wants to merge 9 commits into
masterfrom
james/native-pt1
Open

jamesmunns wants to merge 9 commits into
masterfrom
james/native-pt1

Conversation

@jamesmunns

@jamesmunns jamesmunns commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

This PR builds on #2704 and #2705 by implementing the respective Arch traits 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 added host definitions 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 ticks

This 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.

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

Copy link
Copy Markdown
Contributor Author

(sorry for the one force-push to bring this up to date with the master branch, no more after this)

@jamesmunns

jamesmunns commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author
    Finished `dev` profile [optimized + debuginfo] target(s) in 1m 03s
     Running `target/debug/xtask dist app/host/demo.toml`
Error: Supervisor task (pong) is not at priority 0

Hmm, I will need to probably:

  • Make the dist command notice the target is host, and refuse to build and instead point you toward host-build/host-run.
  • Do something with the CI script to skip/do something different for host manifests.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking Issue: Running Tasks on Host/Native

1 participant