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` 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>