Commit graph

84 commits

Author SHA1 Message Date
Sean Cross
263e57d4aa kernel: disable lots of debug output
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-27 16:59:46 +08:00
Sean Cross
6b729d9ebc kernel: services: resume correct context after interrupt
We were resuming the wrong context after returning from an interrupt.
This resulted in us resuming context 3 more often than not.

This now properly banks the current process context prior to the switch.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-27 16:58:04 +08:00
Sean Cross
405a9227cf xous: add contextid return value
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-27 16:22:51 +08:00
Sean Cross
da2036a182 kernel: services: minor documentation improvements
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-27 16:22:17 +08:00
Sean Cross
cfe7c4a3bc kernel: irq: take() previous process pair
This prevents us from continuously resuming the same task

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-27 16:21:46 +08:00
Sean Cross
beea92ddab kernel: fix context id assignment
previously, we were assigning the trap context as a valid ID.  This is
not valid, and causes many problems.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-27 15:58:59 +08:00
Sean Cross
d8d0c3838a xous: add context id and context error
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-27 13:32:41 +08:00
Sean Cross
dafec2bb89 kernel: make contexts first-class
Due to an initial misunderstanding of how the RISC-V is architected,
contexts were going to be an emergent property of the kernel.

However, after further consideration, contexts must now be baked into
the kernel.  Switching between contexts can be handled by the scheduler,
but the kernel must keep track of processor registers.

Keep track of context IDs and ensure they are sane.  With this patch,
interrupts work, as does basic context switching.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-27 12:30:29 +08:00
Sean Cross
2ba9f69015 kernel: fix build error in main.rs
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-25 14:09:17 +08:00
Sean Cross
97238861a1 xous: syscall: define the return value for SwitchTo
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-25 14:08:13 +08:00
Sean Cross
a723fb6a02 kernel: reflow multiple files' comments
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-25 14:07:46 +08:00
Sean Cross
a05258654c xous: rename WaitMessage -> ReceiveMessage
It might not wait.  The name `ReceiveMessage` better reflects the
operation.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-24 15:26:25 +08:00
Sean Cross
fa22d9bad8 kernel: fix isr context handling
We were loading both the context and the banked context, which resulted
in an invalid context being selected.  This caused a cascading failure.

Load only the lower halfword in order to correctly enter the interrupt
context.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-24 15:24:19 +08:00
Sean Cross
fb01359821 server: fix Connect() call
This fixes the index in the Connect() call, so that clients can now
Connect to servers that exist.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-24 14:52:25 +08:00
Sean Cross
e298f125c9 kernel: rework server structures
They are now inverted and mvoed into their own file.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-24 14:13:11 +08:00
Sean Cross
484e21fd30 messaging: more work on transferring messages
Still need to work on passing messages.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-23 16:56:56 +08:00
Sean Cross
569a4196de kernel: return a Result from syscall::handle
This will simplify error handling.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-23 14:07:54 +08:00
Sean Cross
f32596570f services: don't map messaging region to userspace
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-23 12:59:48 +08:00
Sean Cross
fb69426f28 kernel: riscv: print "SYSTEM HALT" when halting system
This minor patch helps me remember that these errors are fatal.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-23 12:59:09 +08:00
Sean Cross
0be1b8b94c kernel: mem: don't unilaterally hand memory to userspace
If it's needed for use in the kernel, don't hand it over.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-23 12:58:13 +08:00
Sean Cross
a31c4722fa kernel: add space for message reply pointer
With this, we now have enough space to store the return context
information for when `message_reply()` is called.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-23 09:10:19 +08:00
Sean Cross
537e9da79d xous: adjust message envelope struct
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-20 17:22:02 +08:00
Sean Cross
33162a1c1f services: implement basics of ReceiveMessage
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-20 17:21:34 +08:00
Sean Cross
8b54ebff35 examples: the beginnings of message passing and receiving
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-19 17:26:16 +08:00
Sean Cross
646cf9340e xous: add Connect syscall
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-19 17:26:01 +08:00
Sean Cross
ae473b5aa7 kernel: broken commit: add server message polling
This [broken] commit starts to add message polling to the kernel, so a
server can use the MessageReceive call.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-19 17:25:12 +08:00
Sean Cross
26cccb6374 Merge branch 'master' of github.com:betrusted-io/xous-core 2020-03-19 12:29:28 +08:00
Sean Cross
4597e5291c log: print out received message
The syscall isn't hooked up yet, but we're ready for when it is.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-19 09:06:21 +08:00
Sean Cross
04eb18e2fb kernel: add Connect stub
It doesn't respond, but it prints a message now at least.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-19 08:54:52 +08:00
Sean Cross
2dd62e50fd xous: rework definition of message structs
Message structs are used to pass memory between processes.  Rework how
this struct is laid out so as to better describe this process.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-19 08:52:25 +08:00
Sean Cross
b0d3a41067 emulation: add powershell script to build renode
This script can be used to build Renode on Windows.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-18 14:40:23 +08:00
Sean Cross
19ddb32d9d xous: add syscalls for connecting to a server
This is required because server IDs are 128 bits, but we only have
enough space for 32 bits in the message.

This is fine, because it means we can drop "Connect" permissions to
prevent compromised clients from making new connections.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-17 13:00:06 +08:00
Sean Cross
ebe3efc097 kernel: properly zero out pages prior to handing them to userspace
Until now, we were relying on luck to ensure pages were zeroed.
However, now we properly zero pages in the kernel before handing them
off to userspace.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-17 11:35:38 +08:00
Sean Cross
d10bc2e894 syscalls: begin adding message-passing syscalls
These are still not connected, however their existence is starting to
solidify the API.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-17 10:27:03 +08:00
Sean Cross
17efc950c8 cargo: add lock file for sha3 implementation
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-16 19:04:46 +08:00
Sean Cross
2abf3c8600 examples: remove memory checks
These take a long time to start up.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-16 19:04:26 +08:00
Sean Cross
1b8f97a5a3 xous-rs: implement create_server call
This call isn't properly handled by the kernel, but it's now available
in the standard library.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-16 19:03:51 +08:00
Sean Cross
85522602ea kernel: silence warnings and remove excess prints
These prints were used to debug errors in the new process switching
architecture.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-16 19:03:10 +08:00
Sean Cross
1730cb377b examples: log: use name when creating server
The create_server call now takes a name.  Provide this name.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-16 19:02:40 +08:00
Sean Cross
022bedc8e3 kernel: refactor processes to support banking
We now have a concept of context banking.  When an interrupt fires, the
process context is banked.

As part of this, process-level data is now stored in the page within the
process itself.  This reduces memory consumption and allows us to have
features such as a hash within each process itself.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-16 18:22:59 +08:00
Sean Cross
fcdc0da19f kernel: use upstream riscv crate
Now that this is published upstream, we can remove our dependency on a
particular git version.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-16 08:42:32 +08:00
Sean Cross
99d19866cf kernel: mem: zero out memory as part of alloc()
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-14 22:11:57 +08:00
Sean Cross
db87a94960 kernel: services: add a page for the queue
Eventually this will be rolled into an existing page.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-14 22:06:22 +08:00
Sean Cross
77c07f0d79 mem: add map_page()
This shortcut function ensures a page is mapped.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-14 22:06:00 +08:00
Sean Cross
9a10f50ce1 kernel: services: keep track of current pid
Currently we use the ASID inside the MMU to figure out the current PID.
We should also keep track of what we think it is, for consistency.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-14 21:28:01 +08:00
Sean Cross
845cef3771 kernel: services: add servers to SYSTEM_SERVICES
This array will be used to keep track of what servers are running.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-14 16:58:15 +08:00
Sean Cross
4cd6a5d64d log: call create_server syscall
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-14 15:58:22 +08:00
Sean Cross
5a1bcf4c21 xous-rs: implement create_server syscall
The kernel doesn't have this wired up yet, but the syscall works.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-14 15:57:58 +08:00
Sean Cross
c8ccbe27c1 emulation: add initial files for lcd and keyboard
keyboard doesn't work yet, possibly due to upstream bug.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-14 15:44:44 +08:00
Sean Cross
672896a1a3 log: use claim_interrupt wrapper
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-14 15:42:11 +08:00