diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-27 16:58:31 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-27 16:58:31 +0200 |
| commit | 300c0acbd7ab3fae8596ff839c39d9a17c70c68d (patch) | |
| tree | 5a600b24c037dc798766e3ce3fc004956e517abb /bins/hello/src/main.rs | |
| parent | exec: PE32+ loader, versioned ABI, first external binaries (v0.6.0) (diff) | |
| download | rs-dos-300c0acbd7ab3fae8596ff839c39d9a17c70c68d.tar.gz rs-dos-300c0acbd7ab3fae8596ff839c39d9a17c70c68d.zip | |
streams: per-invocation channel, pumping mode, filter pipeline wiring
exec: LineChannel bounded ring (cap=16) with abort/eof/marker fields.
Shell 'pumping mode' assembles canonical lines from its queue into the
channel while the command runs; ^C marks the channel aborted.
Shell-side grammar: USE/TIL pre-drain into the channel before spawn;
<cmd> <path> TIL <marker> sugar drains paths until the marker line.
Interactive TIL: pump_key checks each submitted line against the marker
and closes the channel when it matches.
Exports callbacks run in the command task but touch shell-owned state:
this is safe by construction — the shell blocks in exec_external until
the command completes. put_line feeds Pipeline::line directly;
get_line pops from the channel (yield-poll when empty).
load: drop NX from image mapping (single-privilege kernel, NX bit 63
reserved when EFER.NXE is set by OVMF); compute image span from section
RVAs not file size.
bins/count: gate binary — reads lines via get_line, reports count via
put_line. Verified: count USE file → 6; count <path> TIL END → 2;
interactive count TIL DONE → 3; -h filter across task boundary;
^C abort.
v1 stream exports: put_line → Pipeline, get_line ← channel, log_line
→ klog append, exit → abort_current.
Accounting: print_one_line → pipe.line() returns false (head kill /
pager ^C) → the binary should wrap up promptly; accepted: binary does
not check the return value in v1 (phase 3 simplification).
Diffstat (limited to '')
| -rw-r--r-- | bins/hello/src/main.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/bins/hello/src/main.rs b/bins/hello/src/main.rs index d1d58df..2904351 100644 --- a/bins/hello/src/main.rs +++ b/bins/hello/src/main.rs | |||
| @@ -19,15 +19,15 @@ fn panic(_info: &core::panic::PanicInfo) -> ! { | |||
| 19 | /// (exports table, argc, argv). The conventional UEFI name is kept so | 19 | /// (exports table, argc, argv). The conventional UEFI name is kept so |
| 20 | /// the PE looks normal; the signature is the rs-dos ABI. | 20 | /// the PE looks normal; the signature is the rs-dos ABI. |
| 21 | #[unsafe(no_mangle)] | 21 | #[unsafe(no_mangle)] |
| 22 | pub extern "C" fn efi_main(exports: &'static Exports, _argc: usize, _argv: *const rsapi::Arg) -> i32 { | 22 | pub extern "C" fn efi_main( |
| 23 | exports: &'static Exports, | ||
| 24 | _argc: usize, | ||
| 25 | _argv: *const rsapi::Arg, | ||
| 26 | ) -> i32 { | ||
| 23 | let msg = b"hello, world - from an external binary"; | 27 | let msg = b"hello, world - from an external binary"; |
| 24 | let line = rsapi::Line { | 28 | let line = rsapi::Line { |
| 25 | ptr: msg.as_ptr(), | 29 | ptr: msg.as_ptr(), |
| 26 | len: msg.len(), | 30 | len: msg.len(), |
| 27 | }; | 31 | }; |
| 28 | if (exports.put_line)(line) { | 32 | if (exports.put_line)(line) { 0 } else { 1 } |
| 29 | 0 | ||
| 30 | } else { | ||
| 31 | 1 | ||
| 32 | } | ||
| 33 | } | 33 | } |
