aboutsummaryrefslogtreecommitdiff
path: root/src/lib/syscall.zig
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-07-30 20:27:51 +0200
committerHimbeer <himbeer@disroot.org>2024-07-30 20:28:49 +0200
commit6c9cad1f566f6a8716fa94fb84668bf9d6c62a2a (patch)
treefdb99def34905af988efe615b8d8b62983e69159 /src/lib/syscall.zig
parent48d6fa3e80193a3cc735f5e0b0390a18a7bf5a83 (diff)
channel: Implement and fully switch to joined channel receiving
Unjoined receiving is no longer possible due to complications with whether the unjoined copy should be popped when a joined process receives it. Closes #56.
Diffstat (limited to 'src/lib/syscall.zig')
-rw-r--r--src/lib/syscall.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/syscall.zig b/src/lib/syscall.zig
index 97dc811..43db5a5 100644
--- a/src/lib/syscall.zig
+++ b/src/lib/syscall.zig
@@ -35,7 +35,7 @@ pub fn handler(proc: *process.Info, trap_frame: *TrapFrame) !void {
100009 => trap_frame.setReturnValue(join(proc, trap_frame)),
100010 => trap_frame.setReturnValue(leave(proc, trap_frame)),
100011 => trap_frame.setReturnValue(pass(trap_frame)),
- 100012 => trap_frame.setReturnValue(receive(trap_frame)),
+ 100012 => trap_frame.setReturnValue(receive(proc, trap_frame)),
else => return HandleError.UnknownSyscall,
}
}
@@ -174,13 +174,13 @@ fn devicesByKind(trap_frame: *const TrapFrame) !usize {
}
// join(channel_id: usize) !void
-fn join(proc: *process.Info, trap_frame: *const TrapFrame) !void {
+fn join(proc: *const process.Info, trap_frame: *const TrapFrame) !void {
const id = trap_frame.general_purpose_registers[10];
return channel.join(proc.id, id);
}
// leave(channel_id: usize) void
-fn leave(proc: *process.Info, trap_frame: *const TrapFrame) void {
+fn leave(proc: *const process.Info, trap_frame: *const TrapFrame) void {
const id = trap_frame.general_purpose_registers[10];
channel.leave(proc.id, id);
}
@@ -198,11 +198,11 @@ fn pass(trap_frame: *const TrapFrame) !void {
}
// receive(channel_id: usize, buffer: [*]u8, len: usize) !usize
-fn receive(trap_frame: *const TrapFrame) !usize {
+fn receive(proc: *const process.Info, trap_frame: *const TrapFrame) !usize {
const id = trap_frame.general_purpose_registers[10];
const buffer_ptr: [*]u8 = @ptrFromInt(trap_frame.general_purpose_registers[11]);
const len = trap_frame.general_purpose_registers[12];
const buffer = buffer_ptr[0..len];
- return channel.receive(id, buffer);
+ return channel.receive(proc.id, id, buffer);
}