From 63cf7ac0b0e65770433d4ce6ee1a05868668a807 Mon Sep 17 00:00:00 2001 From: Egggggg Date: Wed, 12 Jul 2023 06:25:38 -0400 Subject: [PATCH 1/3] fixed argument order of BMC and BRC --- hbvm/src/vm/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hbvm/src/vm/mod.rs b/hbvm/src/vm/mod.rs index 7c3a50f..872099c 100644 --- a/hbvm/src/vm/mod.rs +++ b/hbvm/src/vm/mod.rs @@ -243,7 +243,7 @@ impl<'a, PfHandler: HandlePageFault, const TIMER_QUOTIENT: usize> )?; } BMC => { - let ParamBBD(src, dst, count) = param!(self, ParamBBD); + let ParamBBD(dst, src, count) = param!(self, ParamBBD); self.memory.block_copy( self.read_reg(src).as_u64(), self.read_reg(dst).as_u64(), @@ -252,7 +252,7 @@ impl<'a, PfHandler: HandlePageFault, const TIMER_QUOTIENT: usize> )?; } BRC => { - let ParamBBB(src, dst, count) = param!(self, ParamBBB); + let ParamBBB(dst, src, count) = param!(self, ParamBBB); core::ptr::copy( self.registers.get_unchecked(usize::from(src)), self.registers.get_unchecked_mut(usize::from(dst)), From 5afd081c2a43a5f959aae336c66ea30fbbc0891f Mon Sep 17 00:00:00 2001 From: Egggggg Date: Wed, 12 Jul 2023 06:50:07 -0400 Subject: [PATCH 2/3] hehe oops --- hbvm/src/vm/mod.rs | 4 ++-- spec.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hbvm/src/vm/mod.rs b/hbvm/src/vm/mod.rs index 872099c..7c3a50f 100644 --- a/hbvm/src/vm/mod.rs +++ b/hbvm/src/vm/mod.rs @@ -243,7 +243,7 @@ impl<'a, PfHandler: HandlePageFault, const TIMER_QUOTIENT: usize> )?; } BMC => { - let ParamBBD(dst, src, count) = param!(self, ParamBBD); + let ParamBBD(src, dst, count) = param!(self, ParamBBD); self.memory.block_copy( self.read_reg(src).as_u64(), self.read_reg(dst).as_u64(), @@ -252,7 +252,7 @@ impl<'a, PfHandler: HandlePageFault, const TIMER_QUOTIENT: usize> )?; } BRC => { - let ParamBBB(dst, src, count) = param!(self, ParamBBB); + let ParamBBB(src, dst, count) = param!(self, ParamBBB); core::ptr::copy( self.registers.get_unchecked(usize::from(src)), self.registers.get_unchecked_mut(usize::from(dst)), diff --git a/spec.md b/spec.md index 4c64f26..b9adf17 100644 --- a/spec.md +++ b/spec.md @@ -153,7 +153,7 @@ | Opcode | Name | Action | |:------:|:----:|:--------------------------------:| -| 30 | BMC | `[#0] ← [#1], copy imm #2 bytes` | +| 30 | BMC | `[#1] ← [#0], copy imm #2 bytes` | ### Register copy - Type BBB @@ -161,7 +161,7 @@ | Opcode | Name | Action | |:------:|:----:|:--------------------------------:| -| 31 | BRC | `#0 ← #1, copy imm #2 registers` | +| 31 | BRC | `#1 ← #0, copy imm #2 registers` | ## Control flow From 898738fb40704883ea30b731b504e4c756882328 Mon Sep 17 00:00:00 2001 From: Egggggg Date: Wed, 12 Jul 2023 13:12:00 -0400 Subject: [PATCH 3/3] fixed the number of registers BRC copies --- hbvm/src/vm/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbvm/src/vm/mod.rs b/hbvm/src/vm/mod.rs index 7c3a50f..d9937a3 100644 --- a/hbvm/src/vm/mod.rs +++ b/hbvm/src/vm/mod.rs @@ -256,7 +256,7 @@ impl<'a, PfHandler: HandlePageFault, const TIMER_QUOTIENT: usize> core::ptr::copy( self.registers.get_unchecked(usize::from(src)), self.registers.get_unchecked_mut(usize::from(dst)), - usize::from(count * 8), + usize::from(count), ); } JMP => {