Implement a functioning CreateProcess syscall on riscv. This call
creates a server in the child process, and connects the server to the
parent. The parent can communicate with the child process using this
server.
The Server ID is passed as four `u32` values to the entrypoint function.
This can be reassembled into something that can then be passed to the
`ReceiveMessage` syscall.
Signed-off-by: Sean Cross <sean@xobs.io>
Memory is on-demand allocated, meaning it's entirely possible to
allocate and free memory without ever touching physical pages.
Previously, when we attempted to free memory, it would skip over pages
that were never backed by real memory.
With this patch, we continue to free the virtual page even if there is
no associated physical page.
Signed-off-by: Sean Cross <sean@xobs.io>
Memory is on-demand allocated, meaning it's entirely possible to
allocate and free memory without ever touching physical pages.
Previously, when we attempted to free memory, it would skip over pages
that were never backed by real memory.
With this patch, we continue to free the virtual page even if there is
no associated physical page.
Signed-off-by: Sean Cross <sean@xobs.io>
This compresses the entirety of the memory range finder into a single
statement. As a result, duplicate code is removed and we can elide more
range checks.
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>
Due to several errors, multi-page lending did not work properly.
To begin with, if a page was not allocated then it would not be able to
be sent. That is, if you allocated 8192 bytes but only ever accessed the
first 4096 bytes, then an error would be encountered when lending the
unaccessed upper page.
Furthermore, due to a striding error in accessing pointers, half-pages
were treated as full pages.
Signed-off-by: Sean Cross <sean@xobs.io>
When moving memory between processes, update the owner of that page to
match the new PID. Otherwise, memory can never be released.
Signed-off-by: Sean Cross <sean@xobs.io>
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>
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>
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>
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>
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>
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>
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>
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>