bunnie
eb0c1c4377
fix some hosted mode brokeness that came with pinning crates
...
the rand api was downgraded to be in line with the ed25519 crate
which removed some "modern" conveniences. Small price to pay for
less code to review.
2022-01-10 17:13:00 +08:00
bunnie
19f95e6bab
fix kernel test build
2022-01-08 01:00:20 +08:00
bunnie
dd14dfc4c6
retrofit the seed into an atomicu64 so we can set it elsewhere
2021-12-27 02:49:08 +08:00
bunnie
0bd110c163
determinism achieved for testing. now to squash some bugs.
2021-12-26 01:50:30 +08:00
bunnie
66606ed3e0
initial attempt to make hosted mode more deterministic
...
replace all threadRng with a seeded Rng
2021-12-25 15:58:27 +08:00
Sean Cross
1ef4c0d87d
kernel: mem: actually free unmapped pages
...
Previously we would only free a page if it was valid. Now we
unconditionally free it.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-09-27 19:40:39 +08:00
Sean Cross
1cb86078d5
kernel: riscv: suspend or terminate processes that fail
...
If a process fails for some reason (e.g. by performing a fault) and
there is no exception handler, either terminate the process or (if
gdbserver is enabled) have it suspend the process.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-25 16:02:11 +08:00
Sean Cross
19653e9c53
kernel: compatibility with riscv32imac-unknown-xous-elf
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-18 18:14:24 +08:00
Sean Cross
e44eec2334
kernel: fix remaining warnings on hosted mode
...
This removes all remaining warnings from hosted mode. Tests pass, and
the system continues to run normally.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-16 15:07:25 +08:00
Sean Cross
90d1c7a4b8
kernel: move arch mods into their own dir
...
Move `hosted.rs` into `hosted/mod.rs` and `riscv.rs` into
`riscv/mod.rs`.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-16 14:55:38 +08:00
Sean Cross
e29dc5a739
kernel: don't allow allocating exception thread
...
This prevents the exception thread from being allocated as a normal
system thread.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-15 19:25:29 +08:00
Sean Cross
fa2a841f8a
kernel: fix hosted mode exception support
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 17:51:24 +08:00
Sean Cross
6985fda7ba
kernel: get exceptions fully working
...
This finishes work with exceptions such that they now actually work.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 17:47:44 +08:00
Sean Cross
15c9eadc4c
kernel: riscv: re-fix mem warnings
...
The previous approach did not work, and broke everything. This fixes it
properly.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 13:02:16 +08:00
Sean Cross
68f5e81d3f
kernel: riscv: fix warnings in process
...
Fix clippy warnings in the `process.rs` file.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 12:54:43 +08:00
Sean Cross
dbd34318ce
Revert "kernel: fix remaining clippy warnings"
...
This appears to have broken things.
This reverts commit 8b0dd3630c .
2021-08-06 12:51:40 +08:00
Sean Cross
8b0dd3630c
kernel: fix remaining clippy warnings
...
This removes all remaining clippy warnings from inside the kernel.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 11:43:34 +08:00
Sean Cross
cc8dc49dba
kernel: riscv: refactor irqs to support exceptions
...
This fixes the exception handler so that it can support user-defined
exceptions. Additionally, kernel mode errors are called out now.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 11:37:27 +08:00
Sean Cross
19f68edbb4
kernel: riscv: allow exceptions with NULL pc
...
When the program counter is NULL, we can still get exceptions. This
happens when we jump to an invalid address, for example.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 11:34:50 +08:00
Sean Cross
b98e465d12
kernel: more clippy warning fixes
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-05 16:59:27 +08:00
Sean Cross
759ddfedd6
kernel: add initial cut of exception handling
...
Though it is not yet wired up, the exception handler groundwork is laid
here.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-05 16:18:10 +08:00
Sean Cross
f5cf94524a
kernel: add framework for exceptions
...
Add the ability to invoke exception handlers. This is not yet properly
wired up, but the framework is there.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-02 11:04:47 +08:00
Sean Cross
4e17946960
kernel: riscv: ensure stack is 16-byte aligned
...
Make sure processes are set up such that the stack is aligned to a
16-byte boundary.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-07-07 14:34:05 +08:00
Sean Cross
7b7be0fe9e
hosted: fix MemoryRange refactor
...
This fixes the MemoryRange refactor where `.addr` and `.size` are now
private fields.
Previously it had only been tested on baremetal mode.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-24 18:02:28 +08:00
Sean Cross
524df22667
kernel: riscv: ensure pages are writable when poking
...
Ensure pages of memory can be written to when we write to them. This
lets us patch program code to, for example, insert breakpoints.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-21 20:22:45 +08:00
Sean Cross
86dd38f7fa
kernel: fix hosted build
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-21 14:24:16 +08:00
Sean Cross
57b502e2c6
kernel: add gdb support to riscv
...
This adds various primitives that can be used to attach a debugger to
the kernel.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-21 14:13:01 +08:00
Sean Cross
80860f0a51
Merge remote-tracking branch 'origin/main' into debugger
2021-06-21 13:22:51 +08:00
Sean Cross
fb839f3217
wip
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-16 16:53:40 +08:00
bunnie
a70b858812
convert to using the urandom interface
2021-06-11 16:29:25 +08:00
Sean Cross
651844ba20
Merge remote-tracking branch 'origin/master' into debugger
2021-06-06 19:21:18 +08:00
bunnie
bbfe0fb605
Merge remote-tracking branch 'betrusted/aes' into bunnie-dev
2021-06-02 14:49:11 +08:00
bunnie
fadc9c29ab
Merge remote-tracking branch 'origin/master' into bunnie-dev
2021-06-02 03:59:25 +08:00
Sean Cross
bbda4365ae
wip commit
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-01 17:57:01 +08:00
bunnie
2f9fa57bdd
clock-gate based power management now seems to be more or less working
2021-05-31 23:14:35 +08:00
bunnie
d9e56fd321
very preliminary power savings working
2021-05-31 05:20:54 +08:00
bunnie
7c55925926
intermediate check-in on wfi
2021-05-30 23:07:16 +08:00
Sean Cross
be6e0a9895
kernel: fix thread termination and waiting
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-21 17:23:13 +08:00
Sean Cross
714aff830c
kernel: implement JoinThread(tid)
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-21 16:32:38 +08:00
Sean Cross
7c2d3a2247
kernel: implement thread exit support
...
Threads now have the ability to exit. Previously this resulted in a
kernel panic.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-21 13:04:14 +08:00
Sean Cross
e616a4bf4f
kernel: fix hosted build/warnings
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-20 11:52:03 +08:00
Sean Cross
09b8242bb2
kernel: get process termination "working" on risc-v
...
This successfully allows a process to call `terminate_process(val)`.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-20 11:42:31 +08:00
Sean Cross
6e57fbe29b
kernel: riscv: make sure to flush mmu
...
THe MMU flushing logic got disabled due to an experiment. Re-enable it
to ensure pages are consistent when shifting them across boundaries.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-19 20:55:45 +08:00
Sean Cross
47bf453325
kernel: riscv: use raw pointers for mmu mapping
...
This avoids using uninitialized arrays to manage the pagetables, and
instead uses raw pointers. This should avoid using potentially
uninitialized data.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-19 14:17:53 +08:00
Sean Cross
30b82b25b1
kernel: run cargo fmt
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-19 14:12:01 +08:00
Sean Cross
ce66a6bde2
kernel: riscv: add exception const to mem
...
The address of the exception page is now available for use as a standard
variable.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-10 14:37:33 +08:00
Sean Cross
5bd9e40ace
kernel: riscv: add print_thread_* family
...
These calls can be used to print out thread information for debugging.
This augments the existing `print_thread()` call, which has been renamed
to `print_current_thread()`.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-10 14:37:33 +08:00
bunnie
c0d72c282b
increase process limit
2021-05-06 00:44:32 +08:00
Sean Cross
23e759ffd8
kernel: fix multi-page lending
...
Due to several errors, multi-page lending did not work properly.
To begin with, if a page was not allocated then it would not be able to
be sent. That is, if you allocated 8192 bytes but only ever accessed the
first 4096 bytes, then an error would be encountered when lending the
unaccessed upper page.
Furthermore, due to a striding error in accessing pointers, half-pages
were treated as full pages.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-05 10:58:12 +08:00
bunnie
46fe3885dc
cleanup more turds left over during the bringup of suspend/resume
2021-05-01 00:35:32 +08:00