This syscal will be used to adjust various process limits. Currently
it only contains the ability to adjust the heap size and maximum.
Signed-off-by: Sean Cross <sean@xobs.io>
Previously, we only handled messages that were forwarded. With this
patch, we also handle memory messages that were returned.
This fixes#165
Signed-off-by: Sean Cross <sean@xobs.io>
This removes nearly all of the dependencies from `xous-rs`, making it
mostly self-contained.
There is one remaining dependency tree which is `xous-macros`. This is a
legacy feature from before a time we had main(). Attempts will be made
to remove it as well.
Signed-off-by: Sean Cross <sean@xobs.io>
The `xous-rs` library is used in many places, and should have as few
dependencies as possible. Remove these as dependencies.
Signed-off-by: Sean Cross <sean@xobs.io>
We now us `ProcessStartup` as the return type. This builds in tset
mode, hosted mode, and RISC-V mode.
Process Startup is still not implemented for RISC-V mode.
Signed-off-by: Sean Cross <sean@xobs.io>
Messages should be able to be forwarded from one Server to another. This
is a wrapper around the machinery that would do that.
Signed-off-by: Sean Cross <sean@xobs.io>
Allow setting a message's ID by adding a `set_id(&mut self, ...)`
function. This can be used when regifting a message.
Signed-off-by: Sean Cross <sean@xobs.io>
Use a `Vec<u8>` as a backing for memory across the entire project.
Previously we used `Vec<u8>` as a backing for MemoryMessages and used
`alloc` for all other messages. This unifies that to always use
`Vec<u8>`.
I'd prefer if we used `alloc` instead, however that has not been working
and I'm not sure why. Standardize on this for now and look into why
later.
Signed-off-by: Sean Cross <sean@xobs.io>
The `Messages` types were getting hairy, and `definitions.rs` was really
long. Trim it down by moving types into their own files.
Signed-off-by: Sean Cross <sean@xobs.io>
Keyboard setting is "the one and only" exception to user settings
that are saved without encryption. This is because you need your
keyboard layout to be set in order for you to type your password.
Thus, this needed a bit of a special-case to handle its storage record.
We decided to lop off 1 page from the loader and have it store
the keyboard layout code.
Let's hope we can have the discipline to really just store that
one word of information and not later be like "gee wally, you have
a whoooole 4092 unused bytes of space we can cram unencrypted
user settings in, sure would be a waste to not put those use those".
Turns out we didn't end up needing this capability, so, commenting it
out because it is a shy too powerful and is like packing a live
mortar shell in a storage unit: eventually, someone is going to
get hurt, even though it seems mostly harmless at the moment.
Code just commented out in case we need this feature in the future,
but, the main reason it was asked for (the PDDB) was accomplished
without it.
Each Cargo.toml now includes a comment which remnids maintainers
of the dependency policy for Xous (that is, nail down every dependency
to the minor number).
these are secondary attack surfaces -- code that isn't directly
in the kernel, but involved in the manipulation, handling, grooming
and preparation of source and binary files
Add a function to modify the pointer of a MemoryRange. This is used by
`hosted` mode in order to modify memory pointers when we receive them
from the remote client.
Signed-off-by: Sean Cross <sean@xobs.io>
This completely redoes the client-side of syscalls such that there is a
lot less lock contention. Processes now properly sleep rather than
spinning, unless they're waiting for a response due to a blocked server,
which rarely happens in practice.
Signed-off-by: Sean Cross <sean@xobs.io>
When running tests, `processes-as-threads` gets enabled. Look for this
feature flag to determine if we need to use that architecture.
Note that this change requires `resolver v2` to be enabled.
Signed-off-by: Sean Cross <sean@xobs.io>
The test module uses this feature to avoid having to spawn external
processes. Make this a feature flag since it doesn't make sense for any
other target.
Signed-off-by: Sean Cross <sean@xobs.io>
The `test` arch works with TLS and allows for multiple servers and
processes per "process".
This is a special case, and warrants its own arch.
Signed-off-by: Sean Cross <sean@xobs.io>
This has been tested end-to-end. We now have exception handler support.
There is a potential issue when passing messages to our own process in
an exception handler. This will need to be investigated.
Signed-off-by: Sean Cross <sean@xobs.io>
If a MemoryRange is defined as immutable, don't allow `as_mut_slice()`
to be called. This is an API-breaking change.
Signed-off-by: Sean Cross <sean@xobs.io>
- you can only "patch" regions of memory. caller provides a slice
to the region of data they are patching, so that patches can be
computed by the lib-side code of the server.
- erasing is done with a "patch" with all 0xff's as the write data.
a sequence of pure 0xff for a page does not actually cause a write,
the condition is detected and the write is skipped after an erase.
- patches attempt to be somewhat intelligent and not re-write unchnaged
data, or erase blocks that don't need udpating. However, if a user
submits a "sparse patch" with just a couple bytes modified in a
megabyte region they can expect bad performance. Ideally, in that
scenario, each of the smaller modifications are submitted as
individual calls to the patch function, instead of regurgitating
all the data and hoping that hthe patch function does some intelligent
diffing to be as light-fingered as possible about updating the flash.
In other words, the onus is on the calling server to format
patches intelligently. The patch server does only the simplest,
safest optimizations. You don't want to be shuttling megabytes of
redundant data anyways between servers for many other reasons....!
This fixes the MemoryRange refactor where `.addr` and `.size` are now
private fields.
Previously it had only been tested on baremetal mode.
Signed-off-by: Sean Cross <sean@xobs.io>
Mark the private fields in a `MemoryRange` struct as being private. This
allows us to perform operations on the memory range armed with the
knowledge that the entire range is valid and unaliased.
Signed-off-by: Sean Cross <sean@xobs.io>
Add functions to obtain various slices from a `MemoryRange`. These
functions are safe because we know that the memory in the range is
valid, and we know the size of the type.
Signed-off-by: Sean Cross <sean@xobs.io>
This function allows for creating arbitrary memory ranges. Mark this
function as `unsafe` in order to warn users that this can be used to
create invalid memory regions.
Signed-off-by: Sean Cross <sean@xobs.io>
When running on Hosted mode, reconstitute the Vec and dispose of it
rather than freeing the memory by passing it back to the kernel.
This is because the data was previously allocated by way of a vec, and
only a reconstituted vec knows how to properly dispose of the data.
Signed-off-by: Sean Cross <sean@xobs.io>
Call `shrink_to_fit()` on the array that contains memory messages. This
is beacuse we throw away the `capacity` field, and we want to make sure
we can reconstitute the vector at a later stage.
Signed-off-by: Sean Cross <sean@xobs.io>
VexRiscv has accelerated AES instructions. This adds ASM hooks for these
instructions so they can be called from Rust.
Signed-off-by: Sean Cross <sean@xobs.io>
This is a simple lendable StringBuffer variant of String that is
suitable for sending across process boundaries.
Signed-off-by: Sean Cross <sean@xobs.io>
- debounce is now in hardware (requires latest version of betrusted-soc)
- key events originate from an interrupt context and propagate through
to the listeners as messages
- attempt to reduce the use of heapless::Vec; there is an awkward
interposer step still between the array methodology and the Vec
methodology
I'm not sure if trying to eliminate the Vec is a good idea,
because...I'm finding that we're just re-implementing Vec, but
much worse.
However, for the purpose of movement of data across
IPC boundaries, it's more robust to use primitive types,
because serializing Vec is not possible without either
forking the heapless crate to derive the rkyv traits; or, we'd
have to do some probably quite dangerous conversion of the Vec
to a raw slice which also doesn't feel nice.
The syntax to pattern-match a message is a pretty heavy cognitive
burden. Try to ease that by introducing a macro.
The main coin-toss here is whether to include the "what you do
with the message" expression within the macro, or to allow it to
be a block that trails it.
The main benefit of including the body inside the macro is that
we can append an "else" clause that spits out an error message
in case the template didn't match. The drawback is the awkwardness
of putting curly braces inside the parens of the macro expansion.
I think Rust coders are probably more OK with that awkwardness,
even though I find it visually unappealing; and the benefit is that
scalars sent to opcodes expecting blockingscalars (and vice versa)
don't go to a "black hole" -- you'll get an error message.
This error message will probably save someone an hour of debugging
someday, so we'll go with the awkwardness.
This rewrites the entire project so that most runnable projects now use
`xous-ipc` instead of `xous::String` where possible.
This also removes `rkyv` from the list of dependencies in `xous-rs`.
Signed-off-by: Sean Cross <sean@xobs.io>
When a MemoryMessage goes out of scope, update the buffer offset and
valid fields. This allows the caller to see what's changed.
Signed-off-by: Sean Cross <sean@xobs.io>
This will enable us to have more information about the result that is
returned when mutable memory is modified by a server.
Signed-off-by: Sean Cross <sean@xobs.io>
Bring the two branches up to date, while also laying the groundwork
for XousServerName to be used as a native index type in xous-names
so we aren't burdening xous::String with a hasher