Commit graph

10340 commits

Author SHA1 Message Date
Sean Cross
6cdd9b4b4c services: use shorter timeout for thread 4
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-25 11:31:50 +08:00
Sean Cross
5367697b54 services: kernel-test: use create_thread_n
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-25 11:12:44 +08:00
Sean Cross
4cbfe5f90f services: log-server: use create_thread_1()
This moves away from the deprecated `create_thread_simple()` call.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-25 10:54:22 +08:00
Sean Cross
5410d62ef5 xous: fix create_thread_[2..4] arg count
These functions assumed there was only one argument, which was
incorrect.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-25 10:53:50 +08:00
Sean Cross
cecd78fd61 xous: hosted: implement create_thread_n()
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-25 10:53:32 +08:00
Sean Cross
2b97ea25ab xous: add create_thread_n functions
These are used to create threads with between 0 and 4 arguments.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-25 10:42:49 +08:00
Sean Cross
568d1263a3 kernel: syscall: remove variables that never change
The `can_resume` variable doesn't change, and can be made a constant.
This slightly improves reasoning about what the function is doing.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-25 09:14:43 +08:00
Sean Cross
eb2014bc80 kernel: hosted: fix kernel tests
We don't need to re-create the PID1 process, since it is done
immediately now.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-25 09:13:27 +08:00
bunnie
10d66c799f fix typo in script 2021-03-25 03:25:26 +08:00
bunnie
ef3653bf36 add updated SVD files for WDT interrupt rev 2021-03-25 02:40:18 +08:00
bunnie
0940894b27 add a minimal target 2021-03-25 02:40:00 +08:00
bunnie
bb3d96de27 Merge branch 'master' of https://github.com/betrusted-io/xous-core into HEAD 2021-03-25 02:37:58 +08:00
bunnie
8763cf3133 stash before merge 2021-03-24 22:48:23 +08:00
Sean Cross
455bd4ccfb kernel: services: add more debug print crumbs
These could be useful in finding out what's gone wrong.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-24 22:12:29 +08:00
Sean Cross
cc0c395e1e kernel: server: rework queue with generation counter
This reworks the server queue to add a "generation counter". This
counter ensures messages are removed from the queue in the order they
were added, even if they are jumbled up within the queue itself.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-24 22:10:11 +08:00
Sean Cross
f8309dc580 kernel: riscv: add klog messages to mem.rs
These are useful in tracking down certain violations.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-24 22:07:06 +08:00
Sean Cross
090354c882 kernel: services: remove syscall_stack
This field is unused, so remove it.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-24 20:21:30 +08:00
Sean Cross
b967712e5f kernel: use correct thread ID when server queue is full
Instead of queueing the client thread number inside the server, queue
the server's thread number inside the server.

This prevents many spooky messages that were occurring when server
queues got full.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-24 17:23:39 +08:00
Sean Cross
ca24b74cd2 Merge remote-tracking branch 'origin/master' into fix-create-thread 2021-03-24 12:52:01 +08:00
Sean Cross
2d7dda93a9 kernel-test: add testcase for ticktimer/kernel bustage
The ticktimer server breaks spectacularly with this.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-24 12:51:06 +08:00
Sean Cross
0e8c231758 emulation: add description to renode.svd
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-24 08:41:40 +08:00
bunnie
e39c186c4a Revert "Revert "kernel: services: remember new thread if specified""
This reverts commit c72d67203a.
2021-03-23 23:37:54 +08:00
bunnie
c72d67203a Revert "kernel: services: remember new thread if specified"
This reverts commit 00e7f07187.
2021-03-23 23:35:07 +08:00
bunnie
9541523d76 move GPIO mapping earlier in LLIO so we can capture the boot prompt 2021-03-23 23:10:26 +08:00
Sean Cross
e894dbd7b8 Merge branch 'fix-messages' 2021-03-23 21:58:11 +08:00
Sean Cross
9a702437b0 cargo: add lockfile for kernel-test
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:43:55 +08:00
Sean Cross
d16d0c9bd8 ticktimer-server: set quantum to 10ms
This is an experiment to see if this shorter time improves things.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:43:35 +08:00
Sean Cross
e624c184cd ticktimer-server: rewrite sleep server as deadline
Use deadlines for sleep, rather than calculating the amount of remaining
time.

This keeps time consistent, because it means we don't have to
recalculate all sleeps whenever one expires.

It also allows us to take advantage of the hardware which will fire an
interrupt if we schedule a wakeup in the past.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:41:30 +08:00
Sean Cross
89cf0c1ab1 ticktimer-server: run rustfmt on Cargo.toml
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:37:52 +08:00
Sean Cross
861565054e kernel: don't activate target thread on hosted mode
This operation is unneeded on hosted, and causes an error.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:35:52 +08:00
Sean Cross
bf3a3879d2 kernel: hosted: create thread id 1
This ensures that PID1 has a thread ID created as well.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:35:20 +08:00
Sean Cross
2a6de6ed67 kernel: hosted: remove unused interrupt calls
These were removed from riscv, and have no place in hosted mode.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:34:37 +08:00
Sean Cross
91647592ca kernel-test: implement sleep test
This patch implements a simple sleep test.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:53:54 +08:00
Sean Cross
ff05fff4d6 kernel: syscall: run cargo fmt on syscall.rs
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:53:22 +08:00
Sean Cross
93fc8a0b99 kernel: cargo: add wrap-print feature
This is used to force kernel messages to be wrapped to 80 columns.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:52:53 +08:00
Sean Cross
0d77f704a9 kernel: services: run cargo fmt on this file
Minor text reformatting.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:51:33 +08:00
Sean Cross
00e7f07187 kernel: services: remember new thread if specified
If we switch to a thread and specify a thread ID, remember that as the
current thread ID.

This prevents thread starvation by repeatedly going back to the same
thread ID.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:50:12 +08:00
Sean Cross
9ab5b4880f kernel: server: allow taking multiple messages from queue
Previously, we would only look at the top item on the server queue. If
it was not a known message, we would return an error.

This patch changes this behavior to look through the entire queue for
something we can take, and then clean it up as we go along.

This allow for having outstanding requests in the queue an forms the
backbone of the sleep server.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:45:32 +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
6987df997d kernel: irq: don't disable interrupts when claiming irq
When claiming an IRQ, we used to disable interrupts.

This is unnecessary, as interrupts are already disabled when running in
kernel mode.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:40:56 +08:00
Sean Cross
6e290500db kernel: riscv: fix wfi handling for interrupts
Keep interrupts nominally disabled in supervisor mode, and only enable
them for a brief period after WFI hits.

If an interrupt occurs, then WFI becomes a NOP. The `idle()` function is
only called when no more processes are running, which happens when all
processes are waiting for an interrupt.

Therefore, enable interrupts for a brief period when WFI returns in
order to drain all pending interrupts and return to the caller to handle
any change in the process table.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:38:48 +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
06a5997a45 kernel: debug: add wrap-print feature
This feature works around a bug in Renode where unwrapped lines cause it
to crash. This forces columns to be wrapped at 80 characters.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-22 22:27:53 +08:00
Sean Cross
f3ed417c7a emulation: xous-release: add more debug examples
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-22 22:23:53 +08:00
Sean Cross
cb5efccdf8 emulation: ticktimer: fix spurious interrupt on init
Due to a race condition, an IRQ was always fired when the timer was
turned on.

Force a recalculation of the IRQ state when the IRQ is turned on to
avoid firing an interrupt when none should fire.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-22 22:23:03 +08:00
Sean Cross
751dc8ee3a kernel-test: add test for ticktimer-server
This test is an attempt to fix `sleep_ms()`.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-18 20:10:58 +08:00
Sean Cross
27c35223cd xous: run cargo-fmt
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-18 20:10:26 +08:00
Sean Cross
071f2047f8 xous: return TID and PID from current_tid() and current_pid()
These should return the raw values, rather than the Result values.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-18 20:10:01 +08:00
bunnie
184a284da5 sleep_ms() bug exhibitition 2021-03-18 17:34:48 +08:00
bunnie
6677d79834 initial RTC framework 2021-03-18 16:22:08 +08:00