Sean Cross
5186594f17
kernel: remove excess debug output from hosted mode
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 16:22:29 +08:00
Sean Cross
b8d9d1e1b3
Revert "kernel: hosted: don't send responses twice"
...
This causes problems, and fixes an issue that doesn't actually exist.
Revert it.
This reverts commit fc9f597092 .
2020-11-11 16:18:39 +08:00
Sean Cross
4e6a189e4e
kernel: fix returning scalars in interrupt context
...
This is now allowed.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 16:06:08 +08:00
Sean Cross
4b83edc43b
kernel: server: replace ctx with tid
...
Threads haven't been called contexts for a very long time.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 16:04:35 +08:00
Sean Cross
7156ab5e79
kernel: mem: match riscv printf with rest of formatting
...
We don't use `println` anymore, we use `print`.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 16:03:52 +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
fc9f597092
kernel: hosted: don't send responses twice
...
If we've already sent a response, don't send a second response.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 12:55:58 +08:00
Sean Cross
2698333382
kernel: allow making syscalls from an interrupt
...
This enables calling some syscalls from within an interrupt context.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-01 17:59:26 +08:00
Sean Cross
c6e12a5ecd
kernel: remove dead code from hosted/irq.rs
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-01 16:29:36 +08:00
Sean Cross
7ab2338ff3
kernel: add in_irq parameter to syscall::handle()
...
This parameter will determine whether a syscall is being handled from
within an interrupt context. This is because certain calls cannot be
called from such a context.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-01 16:27:39 +08:00
Sean Cross
719549a2cb
xous: rename ReturnToParentI -> ReturnToParent
...
This syscall isn't the only one that can be called from an interrupt
context.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-01 16:26:19 +08:00
Sean Cross
d76832dada
kernel: services: return ServerNotFound when server isn't found
...
This is more intuitive than `OutOfMemory`.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 20:43:59 +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
6e312ffc8a
kernel: process: only print process inits when printing is enabled
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 20:42:57 +08:00
Sean Cross
e5003eee6d
kernel: only print RISC-V exceptions when printing is enabled
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 20:42:25 +08:00
Sean Cross
49d3ce8a6f
kernel: syscall: unify print!() messages
...
Use `print!()` instead of `println!()` in order to make error messages
easier to read in the debug console.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:19:28 +08:00
Sean Cross
b3d918358e
kernel: syscall: don't error on unaligned memory when Hosted
...
When running in a Hosted environment, unaligned memory is not an error,
so don't return `BadAlignment`.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:18:50 +08:00
Sean Cross
95ab9d3c02
kernel: server: unify print messages
...
Don't use `println!()`, and instead prefer to use `print!()` when in the
kernel.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:17:27 +08:00
Sean Cross
20a65b88f2
kernel: server: don't Forget Borrow and MutableBorrow messages
...
These should be returned to the client process after the message is
done, not forgotten straightaway.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:16:52 +08:00
Sean Cross
cb2d810b38
kernel: irq: prefix pagefault message with KERNEL(pid)
...
This unifies this message with other kernel messages.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:16:14 +08:00
Sean Cross
04a3493550
kernel: hosted: print status adding memory to return val
...
When returning memory to a thread, attach memory if present.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:15:32 +08:00
Sean Cross
74b3fde198
kernel: add memory from Results to network packets
...
If a Result contains attached memory, add that memory on to the network
packet that gets sent by the kernel.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:14:43 +08:00
Sean Cross
702676031e
kernel: hosted: run rustfmt
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:14:33 +08:00
Sean Cross
5f6b42d534
kernel: hosted: print pid of a process that exited
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:14:02 +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
9a8c402cc2
add hosted mode bits back in
2020-10-14 23:04:54 +08:00
bunnie
6ff8c8518c
Merge branch 'master' of github.com:betrusted-io/xous-core
2020-10-14 23:02:14 +08:00
bunnie
ac4d79ea68
logging server bringup
2020-10-14 23:01:57 +08:00
Sean Cross
797d622cc7
kernel: use connect() for some kernel tests
...
Now that `connect()` works, use that for some tests rather than
exclusively using `try_connect()`.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 19:19:01 +08:00
Sean Cross
80a003c839
kernel: syscall: implement connect()
...
This implements the `connect()` syscall as a blocking version of
`try_connect()`.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 19:18:16 +08:00
bunnie
5cf8e9e3bc
Merge remote-tracking branch 'origin/master' into ticktimer
2020-10-14 15:30:47 +08:00
Sean Cross
54a8de2776
kernel: fix return_scalar and return_scalar2
...
These didn't correctly set the thread status in the server when
returning a value. Instead of marking a server as runnable, it remained
in an idle state.
This correctly sets the thread status in the server, and resumes the
client.
This has been tested in Renode as well as using `cargo test`.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 11:16:21 +08:00
Sean Cross
ecd2d00f47
kernel: fix return_scalar2
...
This call did not work, because it wasn't properly returning control to
the parent process.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 10:54:23 +08:00
Sean Cross
61fdd5be15
kernel: hosted: add current_tid() to Process
...
This allows us to mock the current TID for debugging purposes on hosted
environments.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 10:54:19 +08:00
Sean Cross
e5100bcb33
kernel: syscall: implement SendMessage
...
SendMessage is a blocking version of TrySendMessage, except this call
will block if the server queue is full.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 10:14:43 +08:00
Sean Cross
0c344efb60
kernel: syscall: move do_yield() to its own function
...
This will allow us to call `Yield` for other operations that need to be
blocking.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 10:14:43 +08:00
Sean Cross
585e55e8b7
kernel: implement retry_instruction()
...
This function is used to decrement the program counter to re-run a given
instruction. This can be used as a cheap way to implement blocking
calls.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 10:04:36 +08:00
bunnie
62b625ec60
convert kernel debug to utra
2020-10-14 03:04:33 +08:00
bunnie
67c49ddbce
clean up a warning
2020-10-14 03:04:25 +08:00
bunnie
4d21f2d868
intermediate progress on debugging return messages
2020-10-14 01:28:10 +08:00
Sean Cross
84b39c931a
kernel: services: switch address space prior to passing messages
...
Switch address spaces to pass messages to the new process, and switch
backafterwards.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-13 22:56:04 +08:00
Sean Cross
39c7dced01
kernel: services: switch address space prior to passing messages
...
Switch address spaces to pass messages to the new process, and switch
backafterwards.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-13 22:54:43 +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
154384e3bb
output hex for kernel debug
...
makes it much easier to read memory allocation requests
2020-10-13 16:15:15 +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
Sean Cross
d4f0496371
kernel: remove unused debug data
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-04 19:08:29 +08:00
Sean Cross
8759f552f7
kernel: syscall: allow returning to the kernel
...
If nothing is running, don't crash when the timer hits.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-04 18:28:58 +08:00
Sean Cross
fa23cfa88b
kernel: services: update some debug comments
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-04 18:28:29 +08:00
Sean Cross
7843189c45
kernel: remove printing of "hello, world!"
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-04 18:28:02 +08:00
Sean Cross
a00151b4de
kernel: use IRQ 0 for UART
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-04 18:27:49 +08:00
Sean Cross
5f4ee01a0d
kernel: use fixed address for debug port
...
Don't use the hardware address, since it is not likely to be in
the universal address space.
Signed-off-by: Sean <xobs@ci.betrusted.io>
2020-10-04 18:13:58 +08:00
Sean
bbab52be7f
kernel: flush MMU when we rotate the SATP value
...
Signed-off-by: Sean <xobs@ci.betrusted.io>
2020-10-04 18:12:27 +08:00
bunnie
711e5ea910
slot in utra references
2020-10-02 04:52:03 +08:00
bunnie
4cded404e3
fix offset of UART
2020-09-26 01:36:45 +08:00
bunnie
44f1a6b307
Merge branch 'master' of https://github.com/betrusted-io/xous-core into dvt-hardware
2020-09-25 17:50:24 +08:00
bunnie
8cc85f4e11
mods for running on DVT hardware
2020-09-25 17:50:02 +08:00
Sean Cross
e5583a7646
kernel: fix message sender parameter
...
The `sender` was, previously, somewhat mislabeled. It was a combination
of PID and TID, except when it wasn't.
Instead, make this value a combination of ConnectionID and queue index.
This makes it easier to reason about which connection we're responding
to.
Additionally, don't expose teh global Server Index Table to userspace
programs.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-09-23 10:52:22 +08:00
Sean Cross
435612a370
kernel: syscall: use new is_blocking() call
...
This removes the need to manually specify whether a call is blocking.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-09-22 22:14:03 +08:00
Sean Cross
43002b8627
kernel: add blocking scalars
...
Add a new type: BlockingScalar, that can be used to do blocking scalar
calls such as sleep().
Signed-off-by: Sean Cross <sean@xobs.io>
2020-09-22 22:05:18 +08:00
Sean Cross
6d931ccc33
kernel: irq: disable irqs during handler
...
This fixes issue #1 , which correctly noted the comment was correct but
the code implementation was not correct.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-09-22 21:13:56 +08:00
Sean
1b59719a74
kernel: hosted: support per-thread memory messages
...
Previously, each process could return one chunk of memory. With this
change, processes can now return one chunk of memory per thread. This
enables multiple threads to lend memory to a server.
Signed-off-by: Sean <xobs@ci.betrusted.io>
2020-09-03 13:20:16 +08:00
Sean
3e6d3904fb
kernel: hosted: handle TrySendMessage the same as SendMessage
...
With the introduction of TrySendMessage, the kernel needs to know that
this data structure should be transmitted over the wire in the same
manner as SendMessage. Previously it was not special-casing this, which
resulted in memory errors.
Signed-off-by: Sean <xobs@ci.betrusted.io>
2020-09-03 13:17:01 +08:00
Sean
2dc0545eaa
kernel: test: print informative error when kernel data changes
...
When the message coming in from the client to a server changes, print
an informative message rather than just "left != right".
Signed-off-by: Sean <xobs@ci.betrusted.io>
2020-09-03 13:13:44 +08:00
Sean Cross
77426aaf56
kernel: hosted: ignore errors from shutting down network socket
...
When running on Linux, attempting to shut down a network socket that
has already been closed results in an error. That is, if the client
disconnects, then the server will throw an error when it also attempts
to disconnect.
Ignore errors to `.shutdown()` to fix `cargo test` on Linux.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-09-03 10:19:05 +08:00
Sean Cross
cd7f8f67fc
kernel: rename Connect/SendMessage to TryConnect/TrySendMessage
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 17:39:29 +08:00
Sean Cross
ae6dda0ad3
kernel: fix tests after message body rename
...
The test suite hadn't been updated to work with the new naming
convention.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 10:47:10 +08:00
Sean Cross
fbda077aff
kernel: remove excess println() statements
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 10:46:48 +08:00
Sean Cross
96c5739cdd
kernel: fix remaining warnings
...
This fixes all remaining warnings in the kernel. For now.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 01:17:35 +08:00
Sean Cross
bc92f4b042
kernel: services: fix build on riscv
...
Somehow the build broke. Oops.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 00:36:39 +08:00
Sean Cross
25824df335
kernel: services: print fewer diagnostic messages
...
These were printed a lot, which is not a thing we want right now.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 00:36:11 +08:00
Sean Cross
d87b59d47c
kernel: riscv: print fewer debug messages
...
The IRQ handler was very noisy, which generated a lot of spew.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 00:35:28 +08:00
Sean Cross
9af28d0a90
kernel: irq: fix build
...
We were missing some packages when building on riscv.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 00:34:49 +08:00
Sean Cross
b78a71c495
kernel: print-panics: implement this feature in debug.rs
...
With this feature enabled, claim the kernel UART for panic printing.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 00:34:41 +08:00
Sean Cross
8f70c0640c
kernel: fix server indexing
...
Server IDs were being improperly indexed, resulting in a
probably-invalid server index being returned.
Adjust these so that correct server indices are returned.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-29 22:10:24 +08:00
Sean Cross
0ca7fe6f12
kernel/loader: fix build arguments
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-18 12:10:46 +08:00
Sean Cross
bb17038bfe
kernel: rename "xous" to "xous-kernel" in import
...
Cargo appears to cache packages in the workspace when multiple packages
use the same crate. Unfortunately, Xous uses different features
depending on whether it's running in the kernel or in userspace.
Pull the kernel version of "xous" in under a different namespace in
order to force it to use a different build.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-17 18:37:40 +08:00
Sean Cross
cb959eb1cf
kernel: fix interrupts
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-10 22:43:38 +08:00
Sean Cross
31f63c3f5f
kernel: threads work now
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-10 22:05:06 +08:00
Sean Cross
1d23bc5aae
kernel: first multiple threads working
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-10 21:17:48 +08:00
Sean Cross
a467d6fcc7
kernel: baremetal: 2nd process starts to run and crashes
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-10 16:06:38 +08:00
Sean Cross
75449f1deb
kernel: get PID1 running, now working on PID2
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-10 00:35:37 +08:00
Sean Cross
10ecacd136
kernel: native: create process for initial processes
...
These all need to bootstrap themselves.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 23:08:54 +08:00
Sean Cross
bef0168c20
kernel: more warning fixes
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 22:14:14 +08:00
Sean Cross
ba30b4919d
kernel: remove more warnings
...
Still haven't run it on real hardware, but this removes more warnings
from the system.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 21:52:28 +08:00
Sean Cross
0006d4d99c
kernel: get building
...
This is where the story really starts...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 21:33:21 +08:00
Sean Cross
8ccecb6d99
kernel: down to 12 errors again
...
Slowly chipping away at it.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 20:59:31 +08:00
Sean Cross
299b9fc298
kernel: start working on lifetime errors
...
Only about 24 errors, so it's better than it could have been.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 19:45:02 +08:00
Sean Cross
8925964754
kernel: on to lifetime issues now!
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 19:38:15 +08:00
Sean Cross
30fef020f2
baremetal: just one more build error for this phase
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 19:27:43 +08:00
Sean Cross
e7a4927943
kernel: down to 7 compile errors
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 19:21:54 +08:00
Sean Cross
9bba5cbe4d
server: pass memory buffer to server init
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 19:02:05 +08:00
Sean Cross
e48e1820f6
kernel: down to 12 errors
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 18:27:18 +08:00
Sean Cross
814be7cd84
kernel: down to 29 errors on bare metal
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 16:48:58 +08:00
Sean Cross
ebf568dadd
baremetal: slowly whittling down the number of errors
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 16:14:34 +08:00
Sean Cross
fb6d42be55
kernel: begin re-porting xous to baremetal
...
Only 68 errors to fix!
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-07 18:57:55 +08:00
Sean Cross
285b92401e
mem: get tests working again on hosted
...
This fixes all tests so they now work (and pass!) when running in a
hosted environment.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-03 18:15:56 +08:00
Sean Cross
ea3a473c9f
reworking memory allocation
...
The kernel should run in a `no_std` environment, which means it must
currently run without `alloc`. We have our own allocation methods when
running on baremetal hardware.
Begin the work to break out the allocation method so that it will work
on both desktop and baremetal environments.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-03 17:40:57 +08:00
Sean Cross
21aa67b748
workspace: remove workspace
...
The kernel and userspace both need to use `xous`, but have different
requirements. If we use a workspace, then all instances of `xous-rs`
must have the same feature set.
This breaks them apart so the kernel can have one set of features and
programs can have another set.
As part of this change, tests are now integrated into the kernel, and a
new `create_process_as_thread()` and `wait_process_as_thread()` function
pair have been added.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-02 16:11:12 +08:00
Sean Cross
ef0ef924c8
fix more clippy warnings
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-29 22:48:48 +08:00
Sean Cross
869ebcff8b
kernel: get tests and running working
...
This fixes process creation so that it works for both tests and running
it as a program.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-29 22:37:03 +08:00
Sean Cross
039975323e
tests: add tests package
...
This package serves only to build tests for the kernel, because the
kernel wants to use a different mechanism for spawning processes.
Cargo doesn't support having `#[cfg(test)]` attributes on modules in
order to allow conditional compilation depending on whether we're
running a test or not. To work around this, `main.rs` is included in
another dummy crate.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-29 21:18:30 +08:00
Sean Cross
cece761ff1
xous: SID: convert to using newtype
...
Rather than simply casting a tuple as a type, create a new struct SID.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-29 20:03:21 +08:00
Sean Cross
e7e8a2b748
kernel: get initial hosted non-test processes working
...
This now has the ability to fork off processes.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-29 17:52:01 +08:00
Sean Cross
d9024076c6
kernel: beginnings of hosted mode
...
This splits hosted mode out from tests so they can run standalone.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 18:41:49 +08:00
Sean Cross
fbcbc8dfa1
kernel: fix deadlock in threaded messages
...
Due to an ordering issue, it was possible for thread message responses
to become deadlocked, wherein a message would get stored in the shared
table in between checking the table value and locking the network
connection.
This change makes a second check of the table after the network
connection is locked, in order to prevent this condition.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 18:12:52 +08:00
Sean Cross
f925011ea2
kernel: fix multiple contexts test
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 14:03:44 +08:00
Sean Cross
9af0fec049
kernel: convert multi-thread test (it's broken right now)
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 13:54:11 +08:00
Sean Cross
c40e0a138d
kernel: convert scalar message test to use processes
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 13:40:02 +08:00
Sean Cross
1512d2138e
kernel: tests: remove excess prints
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 13:35:15 +08:00
Sean Cross
19222c34a9
kernel: get shutdown and multi-clients working
...
THis now has proper authentication for tests.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 13:28:14 +08:00
Sean Cross
7258fc83b7
kernel: rework process creation
...
This now uses a system of access keys to associate processes with the
kernel.
This currently does not pass tests.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-27 21:44:50 +08:00
Sean Cross
ab7a56937c
create_process: rename from spawn_process
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-27 09:30:43 +08:00
Sean Cross
b9d211af3b
xous: begin adding a create_process() call
...
This will mimic the `create_thread()` call and will obviate our own
process-creation code.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-26 10:54:54 +08:00
Sean Cross
cf992e9b09
kernel: hosted: properly shut down process
...
This ensures a process with a server can be reused.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-23 17:57:35 +08:00
Sean Cross
0c2eb002ec
kernel: hosted: use timeout for tcp reading
...
Previously we were blocking, which used way too much processing power.
Instead, use a timeout of ~200 ms.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-23 17:56:39 +08:00
Sean Cross
ca73e8a8dd
kernel: test: ensure environment variables are cleared
...
These interfere with the test.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-23 17:55:48 +08:00
Sean Cross
8242f1b53f
kernel: make server IDs 128 bits
...
This makes server IDs a full 128 bits, and changes the argument to
CreateServer from 32-bits to 128-bits.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 17:28:18 +08:00
Sean Cross
68691a757d
kernel: fix hanging shutdown thread and warnings
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 16:23:21 +08:00
Sean Cross
4130ce7bd1
kernel: fix threading and multiplexing issues
...
Connections weren't getting multiplexed correctly. As a result, they
would respond with the wrong message to a given thread.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 15:51:51 +08:00
Sean Cross
e63e29916a
kernel: syscall: move return_memory into its own function
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 10:18:40 +08:00
Sean Cross
d84fd73cfa
kernel: rename mod files for IDE support
...
If these files are called `mod.rs`, the IDE interface gets really
confusing.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 10:14:43 +08:00
Sean Cross
cf571ad1ee
kernel: more renaming context -> thread
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 10:13:24 +08:00
Sean Cross
e1bf9965c3
kernel: more renaming context -> thread
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 10:01:57 +08:00
Sean Cross
16d88d8cb5
kernel: syscall: move receive_message to its own function
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 09:57:06 +08:00
Sean Cross
549866bcd5
kernel: remove printlns, needless context queries
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 09:52:18 +08:00
Sean Cross
1a6b1160a3
syscall: move send_message into its own function
...
This breaks up the giant `handle()` function.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 09:44:16 +08:00
Sean Cross
42f95e6488
threading: get basic threading tests working
...
With this, we can now run two "threads" within one process.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 12:23:09 +08:00
Sean Cross
e2296fceac
ThreadID: rename from CtxID
...
Contexts are now renamed to Threads, which better reflects what they
actually are.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 11:04:31 +08:00
Sean Cross
11994d325b
kernel: test: add test for server_client_same_process
...
This is part of `multiple_contexts`, but it's nice to have an explicit
test for this functionality.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 10:22:26 +08:00
Sean Cross
1216963d24
rename contexts -> threads and spawn -> create
...
This ensures we're more consistent in naming for these constructs.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 10:17:46 +08:00
Sean Cross
ba7bb29ce2
kernel: don't block on full queue for Scalar/Move msgs
...
For Scalar and Move messages, the client does not need to block if the
server does not have any waiting messages. In this case, send an `Ok`
response.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 10:16:42 +08:00
Sean Cross
506d01fe4a
kernel: test: use server_address() to create fn as_process()
...
This allows us to spawn a new process and set the server address
transparently.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 10:04:50 +08:00
Sean Cross
fb32aab691
kernel: testing: move memory profiling into its own test
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-15 21:24:18 +08:00
Sean Cross
bf15ac08f4
kernel: tests: add memory measurement to test suite
...
This adds a feature to enable memory measurement, so we can determine if
we're leaking memory anywhere.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-15 17:08:05 +08:00
Sean Cross
e652150c6e
kernel: get multiple message passing working
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-15 16:09:42 +08:00
Sean Cross
0ffbaa369a
kernel: fix remaining warnings
...
This just silences them, which isn't great in the long run.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-14 15:16:51 +08:00
Sean Cross
b93abcc926
kernel: test: implement mutable borrow
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-14 15:10:25 +08:00
Sean Cross
d7006e675e
kernel: get send_borrow_message test working
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-14 12:11:57 +08:00
Sean Cross
964b6e0f46
kernel: disable more debug prints
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-14 10:08:49 +08:00
Sean Cross
05d1cf71dc
port: use kernel-assigned port number for tests
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-13 19:57:30 +08:00
Sean Cross
b388d2e1f4
kernel: use SocketAddr instead of &str
...
This is easier to copy around and seems to be more informative.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-13 19:45:29 +08:00
Sean Cross
8f74159674
rename ImmutableBorrow -> Borrow
...
THis is more in-line with Rust conventions.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-13 19:19:25 +08:00
Sean Cross
85c719643a
kernel: tests: factor out common connect code
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-13 19:15:51 +08:00
Sean Cross
05ccba9450
kernel: implement move test
...
We can now `Move` memory from one "process" to another.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-13 18:31:51 +08:00
Sean Cross
40ed6365e2
first memory message works
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-13 17:41:50 +08:00
Sean Cross
acf9b049f7
hosted: start working on memory-based message passing
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-12 11:18:26 +08:00
Sean Cross
e1a92e929c
kernel: replace more unimplemented!() with UnhandledSyscall
...
This should prevent pacnics when calling unhandled functions.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-04 11:58:18 +08:00
Sean Cross
acfe8e5076
kernel: fix pid termination
...
Previously, we were recycling PIDs when devices disconnected, however we
weren't cleaning up PIDs within the system-level table.
This now cleans up these entries.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-25 18:15:36 +08:00
Sean Cross
9f1b1e7ec8
kernel: tests: get both tests working
...
We now have two tests. These tests may be run either in parallel or in series.
If they are run in parallel, then they will each have their own thread
local storage, and each will initialize things from scratch.
If they are run in series, then the thread local storage will be reused
between the two processes.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-25 17:41:17 +08:00
Sean Cross
54a0db50b3
kernel: start using tls
...
This allows us to run multiple kernels in parallel.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-24 17:51:31 +08:00
Sean Cross
abcba48a2a
kernel: add tests
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-24 12:29:04 +08:00
Sean Cross
04faa898c7
hosted: cutting down on println messages
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-23 16:40:51 +08:00
Sean Cross
cbd8ec3a30
test: get message passing working
...
We are now able to pass messages around as part of a test.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-23 15:47:18 +08:00
Sean Cross
e9469991be
test: get initial test passing
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-23 14:42:01 +08:00
Sean Cross
b1a41978ba
shutdown: add shutdown syscall
...
This will be used during testing to shutdown the kernel once it's
finished.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-23 13:58:15 +08:00
Sean Cross
14bb1ac1e5
kernel: working on getting process termination functioning
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-22 17:42:24 +08:00
Sean Cross
9361055aec
kernel: work-in-progress for process termination
...
Processes can go away. This is initial work to support process
termination.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-18 11:39:46 +08:00
Sean Cross
2786ad697b
kernel: get scalar message passing working again
...
This gets basic scalar message passing working again. With this, the
following operations may be performed:
* Starting a server
* Connecting to a server
* Sending a scalar message
Care must be taken to not overflow a server's queue, particularly if
writers are faster than readers.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-16 16:34:49 +08:00
Sean Cross
723529ba20
wip: working on getting message passing working
...
The goal is to get a basic message passing engine working that will also
function as a device that works on real hardware.
This is still reworking it to function correctly on a desktop system.
Once that is working, it will be reworked to function once again on
hardware.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-15 18:13:10 +08:00
Sean Cross
21c46de60e
kernel: move to allow hosted init
...
This prepares for new calls to init SystemServices and the MemoryManager
so that they can be initialized with something other than a
KernelArguments struct.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-03 18:28:22 +08:00
Sean Cross
17ae34a1c1
kernel: begin actor refactor
...
This refactors the kernel so that it *can* run on baremetal, but it can
also run as part of a full system.
This will aid in developing, and ensure that a minimum amount of unsafe
code is present within the kernel.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-03 15:34:55 +08:00
Sean Cross
d4db20e516
kernel: add preemptive multitasking
...
This is still a work in progress, but we now can have multiple processes
running at once.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-06 15:52:07 +08:00
Sean Cross
a1c88b4ffd
kernel: remove old code at top of syscall::handle
...
This was pseudocode from back before we had a better idea of how
everything would be laid out.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-06 10:44:41 +08:00
Sean Cross
1f478925ce
kernel: return context on failure
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-06 10:43:26 +08:00
Sean Cross
fd5cc8a1f0
kernel: implement mutable borrows
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-03 14:23:49 +08:00
Sean Cross
48717d3870
kernel: return a MessageResult after sending a message
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-03 14:23:15 +08:00
Sean Cross
9c5cb3da32
kernel: properly share pages between processes
...
This improves page sharing. Permissions are retained during sharing,
and we should now be able to share multiple pages. Additionally, this
lays the groundwork for mutable sharing.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-03 12:28:44 +08:00
Sean Cross
ed977fd564
kernel: initial work to support lending pages
...
This lays groundwork to support lending pages from one process to
another, and to restore permissions when pages are handed back.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-02 17:40:14 +08:00
Sean Cross
bedb499edb
kernel: get immutable borrows working
...
We can now pass memory immutably between processes
Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-01 17:27:59 +08:00
Sean Cross
d6f985c141
syscall: add call to return memory from a message
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-01 13:21:23 +08:00
Sean Cross
bdb8eac9ad
MemoryRange: move to using this struct for memory ranges
...
This is a combination of MemoryAddress and MemorySize. This is
guaranteed to be not null.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-01 10:28:36 +08:00
Sean Cross
a947d7fd79
kernel: clean up most warnings
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-31 18:37:19 +08:00
Sean Cross
b61f1518d0
kernel: syscall: implement UnmapMemory
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-31 18:37:08 +08:00
Sean Cross
abce9eb0c1
message::move: implement movable messages
...
This is the first implementation of message passing with moving memory.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-31 18:03:19 +08:00
Sean Cross
8c3f931445
messaging: first message passing example
...
THis commit allows us to pass Scalar messages between processes.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-30 16:07:58 +08:00
Sean Cross
f56b5e969d
server: use CtxID type instead of usize
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-30 12:35:50 +08:00
Sean Cross
9367905e6f
kernel: services: don't resume sleeping processes after irq
...
After an IRQ occurs, check to see if there are any available threads.
If there are none, put the process back to sleep.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-27 17:05:37 +08:00
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
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
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
a723fb6a02
kernel: reflow multiple files' comments
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-25 14:07:46 +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
33162a1c1f
services: implement basics of ReceiveMessage
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-20 17:21:34 +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
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
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