Commit graph

10340 commits

Author SHA1 Message Date
Sean Cross
5260ef9f5a loader: add pid to map_page() call
Add the pid as the page owner to `map_page()` calls. This ensures pages
are owned by their respective processes, and removes a lot of
`change_owner()` calls that immediately follow page mapping.

It also allows for superpages to be owned by their respective processes.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:35:27 +08:00
Sean Cross
2941066c3d loader: don't reserve the "susres" page
The "susres" page should be owned by the "susres" server and not the
kernel. Avoid mapping this page to the kernel to prevent it from getting
double-mapped.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:33:40 +08:00
Sean Cross
2e88fb0620 kernel: services: don't crash when a process quits
When enumerating processes, the `find_process()` process didn't consult
whether a process was actually free. This resulted in a crash,
particularly when attaching a debugger to a crashed process.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:32:17 +08:00
Sean Cross
6749f24b31 fixup kernel/mem.rs
Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:31:51 +08:00
Sean Cross
13d54b7928 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:30:37 +08:00
Sean Cross
8592352552 kernel: mem: add function for verifying mappings
Add a function to ensure mappings are unique across the whole system.
This takes a very long time and can crash if the watchdog timer isn't
paused.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:26:23 +08:00
Sean Cross
d5816b667a kernel: riscv: remove unsafe code from process
Remove transmutes from process.rs and replace them with ordinary casts.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:24:31 +08:00
Sean Cross
d4893c1c83 kernel: riscv: add phys_to_virt function
The phys_to_virt function can be used to determine what physical address
page is mapped to a virtual address page.

This throws an error when a page is mapped twice, which shouldn't
happen.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:23:19 +08:00
Sean Cross
124040bbb3 kernel: asm: align kernel stack to 16 bytes
The kernel stack offset should be aligned to 16 bytes. Previously it was
aligned to 8 bytes. It's unclear if this was the cause of any issues,
but it is best practice to keep things aligned to 16 bytes.

As part of this, key the atomic instructions off of the CPP macro
presence of atomic instructions.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:15:48 +08:00
nworbnhoj
457d211c1a
Merge branch 'betrusted-io:main' into sigchat 2023-12-29 17:03:40 +11:00
nworbnhoj
130f4f13f5 sigchat Account doco 2023-12-29 16:50:47 +11:00
nworbnhoj
147e60a805 add sigchat Account.link() relink validity checks 2023-12-29 16:23:36 +11:00
nworbnhoj
7eb1c07269 implement sigchat Manager Config
Tie the Staging Environment specifics to the Account Manager

Note sigchat is hard coded for the Staging Environment for now
2023-12-29 11:44:14 +11:00
nworbnhoj
8f2f464e17 store host in sigchat Account 2023-12-29 10:00:03 +11:00
nworbnhoj
fa66cdfc01 implement sigchat host_modal() with validation 2023-12-29 07:41:53 +11:00
Gianguido Sora
81772377e5 services/usb-device-xous: abstract AppHID state in a struct
Simpler API, easier to understand and audit.

The UsbDevice and UsbHidClass are stored in AppHID directly, so that callers have less things to worry about: just provide an UsbBusAllocator.

This way we streamline the control flow within main_hw.rs, which is already pretty intricated.

I still have to manage errors from usb-device-xous server to lib.rs, but that will come later.
2023-12-28 18:40:23 +01:00
nworbnhoj
7346f03c1a close sigchat websocket properly 2023-12-28 15:27:58 +11:00
nworbnhoj
89cdbc899e ensure that an incomplete pddb dict sigchat.account is deleted 2023-12-28 15:26:53 +11:00
nworbnhoj
3d5030f142 relocate sigchat service environment argument to lib.rs
temporarily default to Staging
2023-12-28 09:49:23 +11:00
nworbnhoj
59895ac525 add sigchat.status.initializing 2023-12-28 07:33:21 +11:00
nworbnhoj
146666cb0e implement sigchat SignalWS read(timeout) 2023-12-27 19:41:17 +11:00
nworbnhoj
535ee5de11 wrap SignalWS in Arc<Mutex<ws>> 2023-12-27 19:03:29 +11:00
Sean Cross
8e3b3bc1e8 Merge branch 'main' of github.com:betrusted-io/xous-core 2023-12-27 15:06:16 +08:00
bunnie
488d976f23 move original copy to new location, trying to preserve commit history 2023-12-27 15:04:27 +08:00
bunnie
336da86915 remove duplicate asm.S 2023-12-27 15:03:58 +08:00
Sean Cross
c3f6d7412a kernel: remove unused asm.S file
This file hasn't been used in a long time, and is merely a copy of the
file that is actually used.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-27 14:14:18 +08:00
Sean Cross
409b50b85e blitstr2: regenerate files after template changes
Regenerate the font files after adjusting the template to generate files
that will not get changed by rustfmt.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-27 14:13:16 +08:00
Sean Cross
aee07683b7 loader: run cargo fmt
There are no changes to this project.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-27 14:12:26 +08:00
Sean Cross
22546710df blitstr2: codegen: generate rustfmt-compatible code
Generate code that can be put through rustfmt without being altered.
This removes an issue where the font tables can be rearraged by simply
running `rustfmt` on the repository.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-27 14:12:26 +08:00
Gianguido Sora
26740a44f6 services/usb-device-xous: implement HIDv2 device
Allows apps to expose HID devices from userspace.

Documentation coming soon.
2023-12-26 18:37:41 +01:00
Gianguido Sora
b62912914b apps: add hidv2 demo app 2023-12-26 18:35:30 +01:00
nworbnhoj
05c991e3a2 Merge branch 'main' into sigchat 2023-12-26 08:14:42 +11:00
nworbnhoj
84d5ff4c0c partial implementation of sigchat Account link() 2023-12-26 07:17:20 +11:00
nworbnhoj
68b2c55460 refine sigchat Account.set() to ensure consistency between pddb & struct 2023-12-26 07:10:09 +11:00
nworbnhoj
4a824c903e add sigchat Account fields 2023-12-26 07:08:50 +11:00
bunnie
9ebf8eb2fc bump version pins in lockfile for xous libs 2023-12-26 00:22:21 +08:00
bunnie
c2c56f9d3f fix typo in kernel feature specifier 2023-12-26 00:20:56 +08:00
bunnie
fda782663a bump version pins for xous change 2023-12-26 00:13:10 +08:00
bunnie
0d6f98665a
Merge pull request #470 from betrusted-io/kernel-memory-fixes
Kernel memory fixes
2023-12-26 00:08:07 +08:00
Sean Cross
3658940260 kernel: add big-heap flag for running tests
When running Rust tests, a larger heap is needed. Add a kernel flag to
support this by default.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-25 23:35:37 +08:00
Sean Cross
006a50d206 kernel: mem: fix memory zeroing
Fix memory zeroing when requesting a physical pointer. Previously, only
the first 25% of a page was zeroed due to a bug when casting between
*mut u8 and *mut usize.

This now uses `write_volatile` to ensure the memory clear isn't
optimized out, and uses `usize` pointers everywhere.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-25 23:30:26 +08:00
Sean Cross
f2e9d2b76c kernel: riscv: threads: ensure registers are zeroed
The register set should be cleared already, however it is possible
(though remote) that register values are not cleared when a thread is
created.

Ordinarily threads are zeroed when destroyed, but this makes sure
they're zeroed upon creation as well.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-25 23:29:20 +08:00
Sean Cross
d798962151 kernel: format some files
Format some files prior to patching them.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-25 23:28:52 +08:00
bunnie
22cd08dc57 bump version in restore script 2023-12-25 23:06:07 +08:00
bunnie
2b521a75f8 Merge branch 'main' of github.com:betrusted-io/xous-core into main 2023-12-24 23:55:51 +08:00
bunnie
65310d42bd update release notes with patches made during release regression testing 2023-12-24 23:55:21 +08:00
bunnie
b6306ac8f4 add debug statements around i2c locking 2023-12-24 23:51:24 +08:00
bunnie
5a0461cb01 make menu building a bit more efficient by not locking when not necessary 2023-12-24 23:51:04 +08:00
bunnie
7e04357aba modernize codec debug 2023-12-24 23:50:50 +08:00
bunnie
8931f10383 work around boot instability issue with a delay setting up codec in TTS
The `codec` seems to hang sometimes during `Setup8kStereo` at boot.
Did not get to the bottom of it, but suspect that the RTC I2C init
sequence is interfering with the codec init sequence. This might
be resolved while also fixing #467, but for now, a short delay
on boot works around the problem.
2023-12-24 23:35:47 +08:00