diff options
Diffstat (limited to 'examples/vfs_console/src/main.zig')
-rw-r--r-- | examples/vfs_console/src/main.zig | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/vfs_console/src/main.zig b/examples/vfs_console/src/main.zig new file mode 100644 index 0000000..0ca6d59 --- /dev/null +++ b/examples/vfs_console/src/main.zig @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Himbeer <himbeer@disroot.org> +// +// SPDX-License-Identifier: AGPL-3.0-or-later + +const std = @import("std"); + +export fn _start() void { + main(); +} + +pub fn main() void { + const path = "/io/debug\x00"; + const handle = asm volatile ( + \\ li a7, 100001 + \\ ecall + : [handle] "={a0}" (-> usize), + : [path] "{a0}" (path.ptr), + : "a7", "a1" + ); + + const msg = "Hello, VFS console!\r\n"; + asm volatile ( + \\ li a7, 100010 + \\ ecall + : + : [handle] "{a0}" (handle), + [bytes] "{a1}" (msg.ptr), + [len] "{a2}" (msg.len), + : "a7" + ); +} |