Commit graph

442 commits

Author SHA1 Message Date
Sean Cross
d4675ef9cf kernel: services: allow unsetting exception handler
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 10:05:29 +08:00
Sean Cross
5b2ac0df68 kernel: implement SetExceptionHandler routine
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 10:03:29 +08:00
Sean Cross
76953985fe kernel: fix clippy warnings in mem/server
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 10:03:12 +08:00
Sean Cross
059fc18850 services: add exception handler routines
Add a function to set and one to clear the current exception handler.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 10:02:32 +08:00
Sean Cross
a096509a04 kernel: irq: use iter for IRQ_HANDLERS
Don't use direct indexing. Instead, use an iterator to go through the
IRQ_HANDLERS array.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 10:00:42 +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
fdf3c12b85 Merge branch 'main' into exception-handler 2021-08-05 10:03:55 +08:00
Sean Cross
afcef0d05b kernel: use vendered version of utralib
By vendoring this package, we can avoid causing a rebuild unnecessarily.

This will be removed when Rust 1.55 is released and we can bring the
`kernel` package back into the main workspace.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-04 12:19:16 +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
2cd42edc22 kernel: use target_os = "none" instead of baremetal
This is more portable, and plays nicer with `rust-analyzer`.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-07-26 15:32:59 +08:00
Sean Cross
df30fd580d kernel: add Exception(usize) as process state
When a process encounters an exception of some sort, it will enter this
state if a handler is available.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-07-26 15:32:03 +08:00
bunnie
53f35f9928 intermediate work toward getting the password box going
lots of changes, maybe finally getting out of the UX rathole now
that basic localization is in place
2021-07-26 00:51:22 +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
4e54bfdc7a kernel: use gdbstub dev/0.6
The previous brach will shortly be deleted.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-27 19:23:53 +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
a99839ecd6 xous: mark MemoryRange fields as private
Mark the private fields in a `MemoryRange` struct as being private. This
allows us to perform operations on the memory range armed with the
knowledge that the entire range is valid and unaliased.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-24 17:41:16 +08:00
Sean Cross
1fb7d4ebd5 kernel: use unsafe {} on Hosted mode
Since `MemoryRange::new()` is now unsafe, add an `unsafe {}` note when
calling this function on Hosted mode.

This fixes the build.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-24 17:07:41 +08:00
Sean Cross
977a175bb5 xous: mark MemoryRange::new() as unsafe
This function allows for creating arbitrary memory ranges. Mark this
function as `unsafe` in order to warn users that this can be used to
create invalid memory regions.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-24 17:02:02 +08:00
Sean Cross
e4d02301ee kernel: support pluggable debug printing
This allows us to support different printers in the kernel. For example,
this can be used to swap out the println!() function to print to GDB
when a debugger is attached.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-23 17:51:59 +08:00
Sean Cross
931b992063 kernel: gdb_server: return 0xff on read error
This seems to be rather universal.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-21 20:23:22 +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
973e4601e4 kernel: don't use debug_here in CI
When running in CI, cause processes to panic rather than waiting for a
debugger to attach. This will ensure test failures are caught sooner
rather than later.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-21 20:05:24 +08:00
Sean Cross
4901453e3d syscall: retor_mem: switch to client in hosted mode
Switch to the message client when returning memory in Hosted mode. This
properly marks a process as ready-to-run, which was otherwise not
correctly done.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-21 20:04:22 +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
0332959068 kernel: debug: add gdb_server support
Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-21 14:12:42 +08:00
Sean Cross
f1041f6f6e kernel: add gdbserver to Cargo.toml
Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-21 14:11:26 +08:00
Sean Cross
80860f0a51 Merge remote-tracking branch 'origin/main' into debugger 2021-06-21 13:22:51 +08:00
Sean Cross
2a1aa24040 kernel: debug: add command to print processes
This changes the `p` command to only print processes, and renames the
existing behavior to `P` which prints processes and threads.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-18 12:56:27 +08:00
Sean Cross
9ced90190e kernel: fix process suspension
This enables processes to be "suspended" by going into a Debug state.
Messages will back up and processes will continue to be scheduled around
the suspended process, while the system will continue to operate.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-18 12:55:21 +08:00
Sean Cross
13204d1714 Merge branch 'master' into debugger
Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-18 10:56:30 +08:00
bunnie
96ca0eb8a1 Merge remote-tracking branch 'origin/master' into ux-refactor 2021-06-16 17:56:44 +08:00
Sean Cross
180c99aa8d kernel: services: free servers on process termination
When a process is terminated, we disconnect it from all other processes.
We also need to free the slot in the server table.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-16 17:55:23 +08:00
Sean Cross
76b16579b0 kernel: syscall: remove warning in hosted mode
This was a function whose only purpose is useful in baremetal mode.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-16 17:54:55 +08:00
Sean Cross
62623f995c Merge branch 'master' of github.com:betrusted-io/xous-core 2021-06-16 16:54:06 +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
Sean Cross
664bd5b26a kernel: use git for feature/state-machine-recv-packet
Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-06 11:49:37 +08:00
Sean Cross
3becfc03c5 kernel: debug: store only a single object in GDB_STATE
This keeps a single object in the global singleton.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-06 11:46:00 +08:00
Sean Cross
29c36c3b0f debug: get kernel building
Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-06 11:39:41 +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
8d41777dc1 release 0.8.3
This implements the `JoinThread(tid)` syscall.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-21 16:41:13 +08:00