From fd575a17c9bfc3aa667a07c989af00dd554d36a8 Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 3 Nov 2023 09:04:22 +0100 Subject: [PATCH] Fixed memory bug --- kernel/src/holeybytes/mem.rs | 2 +- repbuild/holeybytes/vfs_test.rhai | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/src/holeybytes/mem.rs b/kernel/src/holeybytes/mem.rs index e45087dd..e34b8dcc 100644 --- a/kernel/src/holeybytes/mem.rs +++ b/kernel/src/holeybytes/mem.rs @@ -35,6 +35,6 @@ impl hbvm::mem::Memory for Memory { #[inline] unsafe fn prog_read(&mut self, addr: Address) -> T { - (addr.get() as *const T).read() + (addr.get() as *const T).read_unaligned() } } diff --git a/repbuild/holeybytes/vfs_test.rhai b/repbuild/holeybytes/vfs_test.rhai index aa4b8481..2883f384 100644 --- a/repbuild/holeybytes/vfs_test.rhai +++ b/repbuild/holeybytes/vfs_test.rhai @@ -11,9 +11,16 @@ fn main(){ std::ipc_send(2, str, str.len); std::ipc_recv(2); - // load r2 - // loop through r3 + li8(r1, 0x7); + li8(r2, 0); + li64(r3, 128821000); + let start = label(); + st(r1, r2, 0xFFFF8000C0000000, 1); + addi64(r2, r2, 1); + jltu(r2, r3, start); + + std::Info("VFS Test done!"); // un(); tx(); }