.githooks/
compiler/
kernel/
lib/
scripts/
seed/
sublime/
test/
boot/
bootstrap/
compiler/
cycles/
dispatch/
format/
host/
integration/
kernel/
loader/
manifests/
mmio/
native/
packages/
runtime/
scheduling/
shared/
slots/
smp/
std/
sync/
termination/
kernel/
cases.rad
959 B
machine.ras
886 B
spin.rad
1.2 KiB
tests/
trap/
verify/
Makefile
9.2 KiB
kernel.rad
776 B
runner.rad
11.6 KiB
vim/
.gitignore
333 B
.gitsigners
224 B
AGENTS.md
8.3 KiB
CONTRIBUTING
2.1 KiB
LICENSE
1.1 KiB
Makefile
2.5 KiB
README
3.4 KiB
STYLE
3.2 KiB
std.lib
2.1 KiB
std.lib.test
1.1 KiB
test/termination/spin.rad
raw
| 1 | //! User termination and CPU-fault entry paths. |
| 2 | export mod cases; |
| 3 | export mod abi; |
| 4 | export mod sys; |
| 5 | |
| 6 | /// Issue a raw call to test the kernel error boundary. |
| 7 | @intrinsic fn ecall(operation: u32, a0: i64, a1: i64, a2: i64, a3: i64) -> i64; |
| 8 | |
| 9 | /// Exercise an explicit exit, explicit abort, or a user breakpoint fault. The |
| 10 | /// parent selects the case with the first word of the arguments Page, and no |
| 11 | /// Page selects exit. The second word holds the device handle of the last case. |
| 12 | @default fn main(env: *abi::Env) { |
| 13 | if env.argsSize == 0 { |
| 14 | sys::exit(cases::EXIT_STATUS); |
| 15 | } |
| 16 | let words = try! sys::pageWords(abi::Handle(env.args)); |
| 17 | let mode = words[0]; |
| 18 | if mode == cases::Scenario::Abort as u64 { |
| 19 | sys::abort(); |
| 20 | } |
| 21 | if mode == cases::Scenario::DestroySelf as u64 { |
| 22 | try! sys::domainDestroy(abi::Handle(0), 0); |
| 23 | } |
| 24 | if mode == cases::Scenario::InvalidSelfQuery as u64 { |
| 25 | let result = ecall(abi::Operation::QueryDomain as u32, 0, 0, 0, 0); |
| 26 | sys::exit(99); |
| 27 | } |
| 28 | if mode == cases::Scenario::DeviceQuery as u64 { |
| 29 | let device = sys::queryDevice(abi::Handle(words[1])); |
| 30 | assert device.base == cases::FINISH_ADDRESS and device.size >= 4; |
| 31 | sys::exit(cases::DEVICE_STATUS); |
| 32 | } |
| 33 | assert false; |
| 34 | } |