refactor(userspace): split syscall/fat16/ext4 by concern; trim comments

This commit is contained in:
2026-10-27 13:21:53 +01:00
parent 99273db6d3
commit b4390b7b6d
25 changed files with 1283 additions and 1229 deletions

View File

@@ -0,0 +1,58 @@
//! Notifications and interrupts.
use super::{call0, raw, slot_of, Result};
use types::bounded::CapSlot;
use types::syscall_abi::*;
// ---- notifications and interrupts ----
pub fn create_notification() -> Result<CapSlot> {
slot_of(call0(SYS_CREATE_NOTIFICATION))
}
pub fn signal(notification: CapSlot) -> Result<()> {
raw(SYS_SIGNAL, [notification.value() as usize, 0, 0, 0, 0, 0]).map(|_| ())
}
/// Blocks until the notification has bits, then returns and clears them.
pub fn wait(notification: CapSlot) -> Result<usize> {
raw(SYS_WAIT, [notification.value() as usize, 0, 0, 0, 0, 0]).map(|r| r[1])
}
/// Returns and clears the bits without blocking.
pub fn poll(notification: CapSlot) -> Result<usize> {
raw(SYS_POLL, [notification.value() as usize, 0, 0, 0, 0, 0]).map(|r| r[1])
}
/// After this, `receive` also returns when the notification is signalled.
pub fn bind_notification(notification: CapSlot) -> Result<()> {
raw(
SYS_BIND_NOTIFICATION,
[notification.value() as usize, 0, 0, 0, 0, 0],
)
.map(|_| ())
}
/// Delivers interrupt `irq` as a signal on `notification`.
pub fn set_irq_notification(irq: CapSlot, notification: CapSlot) -> Result<()> {
raw(
SYS_SET_IRQ_NOTIFICATION,
[
irq.value() as usize,
notification.value() as usize,
0,
0,
0,
0,
],
)
.map(|_| ())
}
pub fn ack_interrupt(irq: CapSlot) -> Result<()> {
raw(
SYS_ACKNOWLEDGE_INTERRUPT,
[irq.value() as usize, 0, 0, 0, 0, 0],
)
.map(|_| ())
}