From e9e7f0c58512727345346f8a3542bf553a600add Mon Sep 17 00:00:00 2001 From: Erin Date: Tue, 1 Aug 2023 22:20:11 +0200 Subject: [PATCH] Changed magic --- hbasm/src/lib.rs | 2 +- hbbytecode/src/gen_valider.rs | 4 ++-- hbvm/src/lib.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hbasm/src/lib.rs b/hbasm/src/lib.rs index 0b301b96..f7690c05 100644 --- a/hbasm/src/lib.rs +++ b/hbasm/src/lib.rs @@ -72,7 +72,7 @@ impl Assembler { /// Why 12 bytes? That's the size of largest instruction parameter part. pub fn finalise(&mut self) { self.buf.extend([0; 12]); - self.buf[0..3].copy_from_slice(&[0xAB, 0x1E, 0x0B]); + self.buf[0..4].copy_from_slice(&0xAB1E0B_u32.to_le_bytes()); } } diff --git a/hbbytecode/src/gen_valider.rs b/hbbytecode/src/gen_valider.rs index c9d9ab73..d1e078f9 100644 --- a/hbbytecode/src/gen_valider.rs +++ b/hbbytecode/src/gen_valider.rs @@ -40,7 +40,7 @@ macro_rules! gen_valider { /// sound to execute. pub fn validate(mut program: &[u8]) -> Result<(), Error> { // Validate magic - if program.get(0..3) != Some(&[0xAB, 0x1E, 0x0B]) { + if program.get(0..4) != Some(&0xAB1E0B_u32.to_le_bytes()) { return Err(Error { kind: ErrorKind::MissingMagic, index: 0, @@ -67,7 +67,7 @@ macro_rules! gen_valider { } let start = program; - program = &program[3..]; + program = &program[4..]; loop { use crate::opcode::*; program = match program { diff --git a/hbvm/src/lib.rs b/hbvm/src/lib.rs index 67b1dda1..5c1021ad 100644 --- a/hbvm/src/lib.rs +++ b/hbvm/src/lib.rs @@ -73,7 +73,7 @@ impl<'a, PfHandler: HandlePageFault, const TIMER_QUOTIENT: usize> pfhandler: traph, pc: 0, program_len: program.len() - 12, - program: &program[3..], + program: &program[4..], timer: 0, copier: None, }