Commit graph

84 commits

Author SHA1 Message Date
bunnie
fdbbe8d63d move MinSet to utils so that we can test it
thought it would be a good idea to have a unit test for
the MinSet routine (which is used to renormalize the swap
epoch when it overflows). Turns out that was...complicated...
because of the usual problems of test running on host and
the inability to pull through hardware dependencies.
2024-05-18 00:22:50 +08:00
bunnie
3112f41d96 fix bug in debug 2024-05-16 03:54:35 +08:00
bunnie
2b05626b69 add context switching debug option 2024-05-15 02:42:29 +08:00
bunnie
84d42460eb correspending kernel changes for run time page tracker split
memory alloc table split into RAM region and everything else ("extra")
2024-05-12 20:23:29 +08:00
bunnie
61128cb25f remove swap init call, as it is no longer needed 2024-05-02 22:08:08 +08:00
bunnie
b3f695dbc2 fix missing config flag 2024-04-01 15:57:50 +08:00
bunnie
4f15af3fee add swap module to the kernel, and initialize it from args 2024-03-23 11:59:31 +08:00
Sean Cross
ed4ec01017 kernel: support riscv32imac-unknown-none-elf
With Rust 1.76.0, we no longer support building with `#![no_std]` or
`panic = "abort"`, both of which are required within the kernel. As a
workaround, go back to building the kernel under
`riscv32imac-unknown-none-elf`.

Signed-off-by: Sean Cross <sean@xobs.io>
2024-02-06 10:28:33 +08:00
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
eupn
1634243f63
kernel: fix compile errors 2023-03-14 18:48:15 +04:00
eupn
7f5656445a
kernel: change some println!s to klog!s
Even when the print-debug feature isn't turned on, println! macro is still able to output some critical non-debug info to the console such as panics, process crashes and violations, etc. Debugging messages are printed with klog! macro that's disabled when debug-print feature is not set.
2023-03-14 18:47:57 +04:00
bunnie
08ae66a264 fix: #320
this commit adds the facilities to extract eh_frame[_header]
sections and pass it to each process.

A bump is required to `std` to extract the passed parameters.
2023-02-15 19:55:08 +08:00
bunnie
4a2234f539 XIP works with some processes, but not others
it works with e.g. shellchat, but not vault.

still scratching my head on what's gone wrong -- it's
crashing in the pre-boot, which means something is not
mapped right for some case that wasn't caught in the
earlier testing.
2023-02-11 01:42:04 +08:00
Sean Cross
a75d030d77 kernel: main: simplify process search
The process search now uses iterators properly. It's still not ideal
because it needs to investigate every process, but it's better than it
was.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 22:15:01 +08:00
Jean-Pierre De Jesus DIAZ
d8807e6cea
kernel: Move rand driver to platform module.
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2022-11-02 14:36:41 +01: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
09a968ef09 remove debug-here dependency
this contains a dependency to `failure` two levels down that has a critical
vulnerability. Unfortunately no new versions of debug-here have been
published in a while. It's no longer used, so just stripping it out
altogether.
2022-06-07 14:00:25 +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
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
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
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
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
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
25f976dbb6 kernel: claim uart irq before we enable irqs
In order to prevent a race at the start, claim the IRQ before we enable
the IRQ.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-19 14:17:07 +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
bunnie
48074b626b clean up more debug messages 2021-04-30 23:33:35 +08:00
bunnie
260b154741 clean up some boot process holdovers 2021-04-30 23:28:31 +08:00
bunnie
640ddb48e8 suspend/resume now works to hardware 2021-04-30 19:29:36 +08:00
bunnie
0e2d57c9fb retrofit the kernel and loader to handle resume
and now the even harder debuggening begins...zomg o_O
2021-04-30 01:55:38 +08:00
Sean Cross
ccc7264b79 kernel: main: use iterator when printing processes
This avoids a C-style for() loop.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:42:33 +08:00
Sean Cross
eb4ab4ca35 kernel: main: ignore interrupts in main loop
When the kernel is running its main loop, interrupts are disabled as it
is running in supervisor mode.

As a result, we can ignore any interrupt enabling/disabling that may
need to occur.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:34:53 +08:00
Sean Cross
506bd381b2 kernel: debug: don't print out if not initialized
This allows us to use println early on even before it's initialized,
which will allow us to ignore prints to an uninitialized port.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-03 21:13:03 +08:00
bunnie
0889e83401 Merge remote-tracking branch 'betrusted/hardware' 2021-03-02 21:51:41 +08:00
bunnie
96a19baa8d state before refactor of status to own process 2021-03-02 19:25:41 +08:00
Lina Ceballos
d18500f4d6 adding license and copyright headers 2021-01-25 14:54:00 +01:00
Sean Cross
e87eb112ae kernel: debug: fix const warnings
This makes debug a const, which prevents it from getting copied all over
the place.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-01-13 21:09:05 +08:00
bunnie
c9a18125df add hardware TRNG support to kernel (issue #16) 2020-12-14 17:57:29 +08:00
Sean Cross
65c8c6eef5 kernel: implement and use klog!() macro
This replaces the majority of println!() and print!() calls, and works
on baremetal and hosted modes.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 17:24:28 +08:00
Sean Cross
aee42bf264 kernel: print message when idling
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 16:03:29 +08:00
Sean Cross
2244a78f16 kernel: allow syscall processing when printing is disabled
Due to a missing comment, syscalls wouldn't work at all when printing
was disabled. Fix this.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 20:43:22 +08:00
Sean Cross
fa9a3e0954 kernel: rework hosted network protocol
This fixes issues regarding passing memory between processes.

We now properly catch `ReturnMemory` and give the memory back.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-29 19:46:17 +08:00
bunnie
5cf8e9e3bc Merge remote-tracking branch 'origin/master' into ticktimer 2020-10-14 15:30:47 +08:00
Sean Cross
53f1b3c416 kernel: main: make utralib incusion conditional
Only include utralib when running on baremetal.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-13 22:54:12 +08:00
bunnie
cab4c7d4a9 fix more UTRA issues; migrate to dual-UART for kernel/console messages 2020-10-13 05:22:19 +08:00
bunnie
9a50de8b4e refactor: utra -> utralib naming
this cleans up some namespace issues when including
the utra crate which also refers to utra::generated::utra,
and there are CONST at the crate-level, and also functions
at the module-level which need disambiguation. By naming
the crate utra-lib this saves a bit of syntatic wrangling
at the top of every file.
2020-10-12 03:56:10 +08:00
Sean Cross
d0d687a239 utra: fix build on non-hardware release
This adds svd2utra, which enables building for non-embedded harware.

It also fixes some build issues, and paves the way for generating UTRA
at compile-time.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-05 10:13:51 +08:00