aboutsummaryrefslogtreecommitdiff
path: root/examples/zero_stream/src/main.zig
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-07-08 16:28:53 +0200
committerHimbeer <himbeer@disroot.org>2024-07-08 16:28:53 +0200
commit439fd6152386408a244fdcb035323cdbfba31461 (patch)
treecb3fad545de1ae355d65516056ae1e65f5f2122c /examples/zero_stream/src/main.zig
parentc20f8ceeba73e68f5db1619c287283a739a95755 (diff)
zero_stream: Convert global buffer back to stack buffer
This is possible because #45 (secure buffer copies) is implemented now.
Diffstat (limited to 'examples/zero_stream/src/main.zig')
-rw-r--r--examples/zero_stream/src/main.zig10
1 files changed, 1 insertions, 9 deletions
diff --git a/examples/zero_stream/src/main.zig b/examples/zero_stream/src/main.zig
index 1536157..8e529cb 100644
--- a/examples/zero_stream/src/main.zig
+++ b/examples/zero_stream/src/main.zig
@@ -9,15 +9,6 @@ const Result = extern struct {
status: usize,
};
-// The buffer has to be a global variable
-// because a stack buffer would be mapped to different physical memory addresses
-// in the driver thread compared to the main thread due to paging
-// (because each thread has its own stack).
-// This will be fixed in a future kernel version because the same root cause
-// also prevents a distinct driver process from accessing the memory
-// (its attempt to modify the buffer would raise a page fault).
-var buf = [8]u8{ 1, 2, 3, 4, 5, 6, 7, 8 };
-
export fn _start() void {
main();
}
@@ -73,6 +64,7 @@ pub fn main() void {
: "a7"
);
+ var buf = [8]u8{ 1, 2, 3, 4, 5, 6, 7, 8 };
asm volatile (
\\ li a7, 100009
\\ ecall