3 ms·
> Hubris does support shared memory via leases, but I'm not sure how it manages to map them into the very limited 8 Cortex-M MPU regions. What I did in a simil
by monocasa 5y ago
> Hubris does support shared memory via leases, but I'm not sure how it manages to map them into the very limited 8 Cortex-M MPU regions.
What I did in a similar kernel was dynamically map them from a larger table on faults, sort of like you would with a soft fill TLB. When you turn off the MPU in supervisor mode you get a sane 'map everything' mapping, leaving all 8 entries to user code.
The way LDM/STM restart after faults is amenable to this model on the M series cores.
- TD-Linux 5y agoNeat, I didn't know that the MPU fault handler was complete enough to allow for restarts. Now that the source is available, I took a look at what hubris does - it is not actually anything fancy, just a static list of up to 8 MPU regions per task [1]. It seems that leases aren't actually shared memory, but rather just grant permission for a memcpy-like syscall [2]. This is slightly better than plain message passing as the recipient gets to decide what memory it wants to access, but is still a memcpy. [1] https://github.com/oxidecomputer/hubris/blob/8833cc1dcfdbf107369e188a035a38651ba7ab46/build/xtask/src/dist.rs#L1293 https://github.com/oxidecomputer/hubris/blob/8833cc1dcfdbf10... [2] https://hubris.oxide.computer/reference/#_borrow_read_4 https://hubris.oxide.computer/reference/#_borrow_read_4
- elcritch 5y agoThat's interesting, and pretty neat what you can do with Cortex M mpus. Leases seem an interesting twist to regular message passing.