Commit graph

41 commits

Author SHA1 Message Date
bunnie
f9fc3d0d4b ok, format the kernel now that all in-line assembly has been checked 2024-01-14 19:27:14 +08:00
bunnie
710c45969f Revert "format the kernel"
This reverts commit 1f69e6aa39.

this has in-line assembly, let's fix that before we format
2024-01-14 19:24:33 +08:00
bunnie
1f69e6aa39 format the kernel 2024-01-14 19:11:19 +08:00
Sean Cross
b95d442e20 kernel: debug: add "check memory" command
This command ensures memory is all owned by the correct process and is
unique in its ownership.

It takes a long time to run, so ensure the watchdog timer is disabled.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:42:16 +08:00
Sean Cross
0673ad912c kernel: gdb: don't panic when accessing kernel memory
Instead, just return 0x00000000.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-22 23:24:39 +08:00
Sean Cross
b0ecc26002 kernel: gdb: batch 2- and 4-byte accesses
Instead of always doing bytewise accesses, support 2- and 4-byte access.
Additionally, recognize when multiple 4-byte reads are required.

Note that an additional optimization may be made here in the future to
prevent having to check every address, but this is left for a future
optimization.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-05-11 15:13:03 +08:00
Sean Cross
97da54437e kernel: allow debug of crashed processes
When a process crashes, report this in the kernel console and offer to
attach a debugger.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-04-20 13:06:02 +08:00
bunnie
cb875cf54e various fixes to gdb-stub
these are from @xobs via issue #361
2023-04-09 22:15:57 +08:00
Sean Cross
6016f951ef kernel: gdb: unpause process on disconnect
Resume the debugged process when the debugger disconnects.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-04-06 14:34:13 +08:00
Sean Cross
916a0bde42 kernel: fixup gdb guardrails
The riscv target requires stepi to be implemented, which we now do.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-04-06 11:23:35 +08:00
Sean Cross
7c2ffbb34e kernel: implement gdb server
The gdb server runs on an additional serial port and provides
process-level debugging to the kernel.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-04-06 10:48:45 +08:00
Sean Cross
eb33af53e0 kernel: gdb: break features into individual files
Since gdbstub is able to do this, break individual features into their
own files.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-04-06 10:48:45 +08:00
Sean Cross
fd71993b68 kernel: gdb: begin ext implementation
Implement the basics required to get "extended mode" working. This is
waiting on upstream to fix issues, but should allow us to attach to
processes once it works.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-04-06 10:48:45 +08:00
Sean Cross
a34733e5e9 kernel: basic version of gdb serevr
This adds a basic gdb server. Currently, it is possible to list
processes and inspect memory and threads. It is not yet possible to
actually interact with code (e.g. no breakpoints and no single
stepping).

Signed-off-by: Sean Cross <sean@xobs.io>
2023-04-06 10:48:45 +08:00
Sean Cross
13029a76a2 kernel: initial gdb-stub reimplementation
Add an initial reimplementation of the gdb-stub using the gdbstub
backing crate.

This supports process enumeration and basic thread investigation.
Processes will pause when the debugger is inspecting them. Memory and
registers can be investigated. Threads can be listed and selected.

It does not yet support breakpoints.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-04-06 10:45:42 +08:00
eupn
3451d106f9
kernel: update debug and shell modules 2023-03-14 18:32:52 +04:00
Sean Cross
911ddb60fc kernel: debug: fix klog on baremetal
klog() refers to an outdated `.uart` struct, which has since been
renamed to `.serial`.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-12-29 21:01:27 +08:00
Jean-Pierre De Jesus DIAZ
b334e5bc31
kernel: Split debug shell and uart driver.
I've added a `platform` module to store all platform specific code, (not
architecture specific) as some platforms will require custom drivers, e.g.
for debug output and for the random number generation code.  The platform
code is in charge of mapping any peripherals needed to work, also to
initialize any other parts of the kernel that require drivers, for example
the debug shell.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2022-11-02 14:30:31 +01:00
bunnie
ab940e18db fixup warnings 2022-09-27 17:27:21 +08:00
bunnie
755556611c prep kernel for packaging
- strip out gdb-stub. Per xobs, the feature never worked, and it
depends upon a branch of a git repo which is not allowed by crates.io
Since the feature hasn't been developed, and crates.io will not
allow even an optional feature that points to a git repo, the feature
was stripped out.

- rename "kernel" to "xous-kernel", so that we can live in a crates.io
package namespace that is specific to Xous.

still have to figure out the riscv package issue.
2022-09-27 17:02:20 +08:00
Sean Cross
6d294c97c5 kernel: print connection count on per-process output
Signed-off-by: Sean Cross <sean@xobs.io>
2022-04-05 15:11:47 +08:00
Sean Cross
6f4b58c47d kernel: add process name to server output
Signed-off-by: Sean Cross <sean@xobs.io>
2022-04-05 10:41:22 +08:00
Sean Cross
ce4e40b28a kernel: add s command to print servers
This will print all allocated servers on the system.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-04-05 10:36:00 +08:00
Sean Cross
75116d36cd kernel: add debug command to print interrupts
This can be used to ensure the interrupt handlers are where we think
they are.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-10-29 16:21:07 +08:00
Sean Cross
7d3d710554 kernel: gdb_server: don't inline functions
This was a holdover from size benchmarks.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-25 16:05:27 +08:00
Sean Cross
30eb24af61 kernel: debug: fix wrap-print on xous target
When targeting the `xous` target, we were missing some variables due to
them relying on `target_os="none"`.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-25 16:04:42 +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
bunnie
5113df5eec Merge branch 'bunnie-dev' into main
Use a RefCell to solve the interior mutability issue introduced
by the &mut check introduced on MemoryRanges.
2021-08-10 18:13:33 +08:00
Sean Cross
b6f706411b kernel: gdb_server: fix clippy warnings
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 12:55:22 +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
08b787a03e kernel: debug: fix remaining clippy lints
Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-06 11:34:30 +08:00
bunnie
d68b6639cf remove now-unused stub 2021-08-04 23:29:00 +08:00
bunnie
d42658a65d fix kernel debug input
for whatever reason, by default, uarts in litex are configured
not to drain a fifo when you read them -- they only drain
after you write EV_PENDING.
2021-08-04 22:40:12 +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
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
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
86dd38f7fa kernel: fix hosted build
Signed-off-by: Sean Cross <sean@xobs.io>
2021-06-21 14:24:16 +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