compiler/
kernel/
lib/
scripts/
seed/
sublime/
test/
acceptance/
boot/
bootstrap/
cycles/
dispatch/
kernel/
machine.ras
1.5 KiB
run
2.2 KiB
spin.rad
7.3 KiB
loader/
mmio/
modules/
native/
packages/
pages/
runtime/
scheduling/
shared/
slots/
smp/
sync/
termination/
tests/
trap/
run
2.7 KiB
runner.rad
10.3 KiB
vim/
.gitignore
336 B
.gitsigners
112 B
CONTRIBUTING
2.1 KiB
LICENSE
1.1 KiB
Makefile
10.2 KiB
README
2.5 KiB
STYLE
2.5 KiB
std.lib
1.5 KiB
std.lib.test
551 B
test/dispatch/run
raw
| 1 | #!/bin/sh |
| 2 | # Preempt and resume U-mode and M-mode work through production dispatch. |
| 3 | set -eu |
| 4 | emulator=${RAD_EMULATOR:-emulator} |
| 5 | fixture=${1:-dispatch} |
| 6 | harts=${2:-1} |
| 7 | irq=${3:-0} |
| 8 | work=$(mktemp -d) |
| 9 | trap 'rm -rf "$work"' EXIT HUP INT TERM |
| 10 | mkdir "$work/spin" |
| 11 | cp "test/$fixture/spin.rad" "$work/spin.rad" |
| 12 | cp kernel/kernel/abi.rad kernel/kernel/sys.rad "$work/spin/" |
| 13 | set -- -pkg spin -mod "$work/spin.rad" -mod "$work/spin/abi.rad" -mod "$work/spin/sys.rad" |
| 14 | if [ "$fixture" = mmio ]; then |
| 15 | cp kernel/mmio.rad "$work/spin/" |
| 16 | set -- "$@" -mod "$work/spin/mmio.rad" |
| 17 | fi |
| 18 | "$emulator" -memory-size=385024 -data-size=348160 -stack-size=1024 -run bin/radiance.rv64.dev \ |
| 19 | "$@" -entry spin -ril "$work" |
| 20 | cp kernel/kernel.rad "$work/kernel.rad" |
| 21 | printf '\nexport mod dispatchinput;\nexport mod dispatchcheck;\n' >> "$work/kernel.rad" |
| 22 | mkdir "$work/kernel" |
| 23 | cp kernel/kernel/*.rad "$work/kernel/" |
| 24 | for source in "test/$fixture"/kernel/*.rad; do |
| 25 | cp "$source" "$work/kernel/" |
| 26 | module=${source##*/} |
| 27 | module=${module%.rad} |
| 28 | if [ "$module" != dispatchcheck ]; then |
| 29 | printf '\nexport mod %s;\n' "$module" >> "$work/kernel.rad" |
| 30 | fi |
| 31 | done |
| 32 | length=$(wc -c < "$work/spin.ril") |
| 33 | printf '//! Binary user loop.\n/// Complete trusted input package.\nexport static INPUT: [u8; %s] = [\n' "$length" > "$work/kernel/dispatchinput.rad" |
| 34 | od -An -v -tu1 "$work/spin.ril" | awk '{ for (i = 1; i <= NF; i++) printf "%s,", $i; print "" }' >> "$work/kernel/dispatchinput.rad" |
| 35 | printf '];\n' >> "$work/kernel/dispatchinput.rad" |
| 36 | sh test/acceptance/compile "$emulator" "$work" |
| 37 | cat "test/$fixture/machine.ras" kernel/kernel/*.ras > "$work/dispatch.ras" |
| 38 | "$emulator" -memory-size=385024 -data-size=348160 -stack-size=1024 -run bin/kernel.build.rv64 \ |
| 39 | -- "$work/std.ril" "$work/kernel.ril" "$work/dispatch.ras" "$work/dispatch.rv64" |
| 40 | set -- |
| 41 | if [ "$irq" -ne 0 ]; then set -- "-irq=$irq" "-irq-at=1"; fi |
| 42 | for count in $harts; do |
| 43 | if [ "${KERNEL_REPLAY:-0}" = 1 ]; then |
| 44 | sh test/acceptance/replay "$fixture" "$emulator" "$work/dispatch.rv64" "$count" "$@" |
| 45 | else |
| 46 | "$emulator" -machine -harts="$count" -memory-size=262144 -max-steps=2000000000 "$@" -run "$work/dispatch.rv64" |
| 47 | fi |
| 48 | printf '%s: %s-hart execution passed\n' "$fixture" "$count" |
| 49 | done |