Commit graph

10340 commits

Author SHA1 Message Date
bunnie
82a7d0c40f fix some more edge cases in PDDB key deletion 2023-01-30 22:14:58 +08:00
bunnie
8350095d36 fix initialization order so that CI can run 2023-01-30 22:14:58 +08:00
bunnie
2ef7dfd488 add test case for pddb delete keys 2023-01-30 22:14:58 +08:00
bunnie
b9f0f80d26 fix cached state to match disk state in UX for edit/delete in passwords 2023-01-30 22:14:58 +08:00
bunnie
0546f7a38c fix deletion UX in vault 2023-01-30 22:14:58 +08:00
bunnie
408cc69ad9 note that lock device also has a reboot aspect to it in the menu 2023-01-30 22:14:58 +08:00
bunnie
f2dcea0834 add a missing sync after key deletion 2023-01-30 22:14:58 +08:00
bunnie
dafec3c2eb chore: fix another typo 2023-01-30 22:14:58 +08:00
bunnie
6fd080097e chore: fix typo :P 2023-01-30 22:14:58 +08:00
Tom Marble
ba2e91fea0 Updates for #287
Allows a variable to be set to the EMPTY string
- by not setting a value `/set myvar`

During initialization now verifies that PDDB is mounted.

Added warnings for PDDB not mounted and WiFi not connected.
- the WiFi check is not yet implemented

Signed-off-by: Tom Marble <tmarble@info9.net>
2023-01-30 22:14:58 +08:00
Tom Marble
e48507a597 Completes fix for #287
Adds migrations framework
Delays mtxcli initialization until first user input, because we know:
- PDDB is mounted
- Timer is stable
- User actually using mtxcli
Adds send_async_msg scalar_async_msg
- basis for automatically updating chatroom

Signed-off-by: Tom Marble <tmarble@info9.net>
2023-01-30 22:14:58 +08:00
Tom Marble
feffc2e5be WIP: Fix mtxcli excessive memory usage #287
Adds migrations framework
- Migration for v0.9.11-0120: update the filter

Filter
- narrow filter to only the fields and events for the current room

Introduces "read only" variables (e.g. __version).

Signed-off-by: Tom Marble <tmarble@info9.net>
2023-01-30 22:14:58 +08:00
Tom Marble
b4566bc22e WIP #287: Adds /heap command to mtxcli
Signed-off-by: Tom Marble <tmarble@info9.net>
2023-01-30 22:14:57 +08:00
Patryk Laurent
afd1570bbc type chars rather than bytes 2023-01-30 22:14:57 +08:00
Patryk Laurent
9ad45b6f2c add pddb edit (types pddb write <k> <v>) 2023-01-30 22:14:57 +08:00
Sean Cross
4133238d8a emulation: ticktimer: fix higher bits of ticktimer
The ticktimer wasn't properly adjusting the upper bits, meaning delays
of more than 42 days did not function properly. This was discovered as
part of the libstd tests.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 21:59:30 +08:00
Sean Cross
b5b22c9119 emulation: timer0: adapt timer0 to custom precursor
Precursor has a custom TIMER0 module that is different from other LiteX
timers. Adapt the Renode model to match the hardware.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 21:58:47 +08:00
Sean Cross
c1728f482c kernel: services: fix corner cases on thread selection
There were a few corner cases when it came to thread selection. Namely,
the same thread had a higher chance of repeatedly being executed.

Clean up these corner cases, and as a result get libstd tests to pass.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 21:57:46 +08:00
Sean Cross
179048c1b2 kernel: syscall: add notes for handing mem to user
Add notes on how to properly hand memory to userspace. This does not yet
work, but is committed here as a work-in-progress.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 21:56:39 +08:00
Sean Cross
bdad4f9204 kernel: mem: increase default mem size
The default mem size got shrunk down to 4 MB earlier, but there is a
lingering issue that prevents specifying virtual addresses. As a result,
pddb and others don't work.

Temporarily revert this change.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 21:55:40 +08:00
Sean Cross
5dbad15744 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 21:55:04 +08:00
Sean Cross
011f10c9d1 kernel: riscv: print processes from tid #0
Start numbering threads from index 0. This matches up with what the rest
of the system uses.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 21:54:08 +08:00
Sean Cross
25b7f72af4 kernel: syscall: short-circuit return_scalar irq
When in an IRQ, short-circuit the return logic. This should make
interrupt returns slightly faster.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 21:53:18 +08:00
Sean Cross
aece50a8fa kernel: syscall: rename context to tid
The word `context` is an older word. We now use "thread" or "tid".

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 21:52:35 +08:00
Sean Cross
a406648bcc xous: use asm!() macro for syscalls
Previously we used externally-linked assembly in order to make syscalls.
Now that `asm!()` is stable, use this macro.

This will help to optimize IPC between programs and the kernel.
Additionally, it resolves an unsoundness issue where we were filling in
values on the stack and hoping that Rust didn't reorder the structs.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 21:51:01 +08:00
Sean Cross
cfb8c216e2 xous-ticktimer: overhaul condvars
The previous condvar implementation was unsound, and didn't do the right
thing. Overhaul condvars so that they now pass the libstd tests.

As part of this, function calls were added to free the mutex and condvar
objects that may have been allocated.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 21:48:25 +08:00
Sean Cross
49a87dcfe2 kernel: services: optimize find_next_thread()
Use a multiply-based algorithm to count the number of leading zeroes.
This results in a function that's just 20 instructions long.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 20:57:49 +08:00
bunnie
8e440609c2 add an extra test for checking if time server blocks on PDDB mount
gated with a feature so it doesn't bloat the shipping code base
2023-01-30 19:01:13 +08:00
bunnie
797bb0adc6 fix https://github.com/google/OpenSK/issues/584
I suspect this fix is actually the correct solution to the problem,
but refer to the issue above for tracking.
2023-01-30 18:34:43 +08:00
bunnie
b4ce65cb8e possible fix for https://github.com/google/OpenSK/issues/586
This may not be the correct fix, but it causes the test bench to pass.
This will be revisted once I hear back from the OpenSK maintainers.

I strongly supect the issue is actually a bug in how permissions are cleared
after a user presence test, and not that the checks themselves are
incorrect.
2023-01-30 18:33:33 +08:00
bunnie
e64351569f update ctap timeouts in the main loop
This is necessary because there are some timed permissions that
must expire over time that are not asynchronous like the
user presence tests.
2023-01-30 18:32:26 +08:00
bunnie
7cd2512e95 turn down some debug spew 2023-01-30 18:32:06 +08:00
bunnie
b1362c0ca4 chore: add a comment 2023-01-30 18:31:53 +08:00
bunnie
c237ff7b46 fix https://github.com/google/OpenSK/issues/582
See the above issue for more details
2023-01-30 18:31:12 +08:00
Sean Cross
a46fc0d217 Revert "renode: remove custom LiteX_Timer_32"
The custom litex timer is more custom than we thought.

This reverts commit 46fab8cbc8.
2023-01-30 11:23:16 +08:00
Sean Cross
94c30c0388 kernel: minor formatting cleanups
These files have had rustfmt run on them.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 21:27:14 +08:00
Sean Cross
27b777192d kernel: use common function for finding next thread
THe act of finding a runnable thread is so common, yet the kernel
contains three ways of doing this.

Use a unified function to select the next available thread.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 20:52:25 +08:00
Sean Cross
dd4546c2c0 kernel: properly set current_thread on init
Previously the `current_thread` was set to 0, which is invalid. Set the
`current_thread` so that it defaults to the initial thread ID.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 18:40:58 +08:00
Sean Cross
e37f3fd191 kernel: limit memory regions to 4 MB
This memory region is much smaller than the previous value of 256 MB,
but it will limit the amount of memory used by superpages in
long-running processes.

Previously, we would march through memory as messages were passed back
and forth and a process' memory space would quickly be eaten up by 1024
pages.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 18:38:45 +08:00
Sean Cross
217b66e976 kernel: don't yield when JoinThread returns immediately
When waiting on a thread, it may be the case that the thread we're
joining has exited already. In this case, the correct approach is to
resume execution rather than switching to the parent process.

This fixes an issue where `SWITCHTO_CALLER` is None when joining a
short-lived thread.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 18:36:38 +08:00
Sean Cross
26c97dcc92 kernel: immediately switch to new thread on CreateThread
When a new thread is created, immediately switch to the new thread.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 18:35:34 +08:00
Sean Cross
9ab3180fc7 kernel: return DoubleFree on invalid Return calls
When attempting to return an invalid item, return `DoubleFree`. This is
because such cases are most likely due to instances where a message was
responded to twice.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 18:34:22 +08:00
Sean Cross
5285346b4e ticktimer: implement freemutex/freecondition
With these two API Calls, the ticktimer server will no longer grow
without bounds.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 18:32:29 +08:00
Sean Cross
f2c20dfe75 xous-api-ticktimer: add calls for freeing objects
Add calls to free Mutexes and Condvars. These will go in a destructor,
and will remove any trace of these mutexes within the ticktimer server.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 18:31:44 +08:00
Sean Cross
e7983aef87 ticktimer: improve condvar handling
Improve condvar so that it is more reliable.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 18:04:06 +08:00
Sean Cross
bd530f7a74 ticktimer: only allow RecalculateSleep from ourselves
Rewrite the RecalculateSleep opcode handler so that it will only be
processed if sent by our own process.

As part of this rewrite, use the new `let else` pattern.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 18:02:36 +08:00
Sean Cross
2707d74418 ticktimer: use sleep_heap.pop_first()
This function was stabilized in Rust 1.66.0.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 18:01:18 +08:00
Sean Cross
0572eed4b4 xous-ticktimer: don't panic in an interrupt
If we are unable to send a message in an interrupt, simply ignore it.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-29 18:00:19 +08:00
Sean Cross
ab77cf93e1 Merge branch 'main' of github.com:betrusted-io/xous-core 2023-01-29 17:59:39 +08:00
bunnie
2b6e0d2b89 fix return code bug on bulk deletion 2023-01-29 17:32:41 +08:00