Commit graph

6 commits

Author SHA1 Message Date
bunnie
a1bf70b9ed regex search/replace instances of xous_ipc::String to String
split into a couple commits for ease of committing
2024-09-22 14:14:55 +08:00
bunnie
19ebae2715 format apps/transientdisk 2024-01-14 18:56:19 +08:00
Sean Cross
5dfad296ae xous: mark MemoryRange::as_slice and friends as unsafe
Mark `MemoryRange::as_slice()` and `MemoryRange::as_slice_mut()` as
unsafe.

This is due to the fact that not all representable types can be cast to
an arbitrary value. For example, if Process A sends random values to
Process B, then Process B casts the memory to a slice of `bool`, then
any values that are not 0 or 1 are undefined.

Because these functions can leak UB into the program, they are marked as
unsafe.

This patch adds `unsafe {}` blocks to all instances where this function
is called. Additionally, all instances have been checked to verify that
they do not cast to any invalid types -- most use `u8` or `u32`.

Additionally, the long-deprecated `MemoryRange::from_parts()` call was
removed, since that causes UB without being marked as unsafe.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-09-12 10:07:38 +08:00
Gianguido Sorà
dca88da039
transientdisk: move flash drive implementation in a separate file
Also encapsulate the entire MemoryMessage handling.
2023-01-31 22:55:04 +01:00
Gianguido Sorà
14679efb0b
transientdisk: clean up us fence macros
Just use "mass-storage", and add a log message to inform the user they
compiled a kernel image without `--feature mass-storage`.
2023-01-31 22:37:46 +01:00
Gianguido Sorà
916c22896a
apps/transientdisk: app to demonstrate userspace usb mass storage api
Exposes a 1.44mb usb drive, that survives until you either shutdown
the device, or change app.
2023-01-26 19:31:40 +01:00