diff --git a/src/kernel/exception.rs b/src/kernel/exception.rs index c982264..223827a 100644 --- a/src/kernel/exception.rs +++ b/src/kernel/exception.rs @@ -353,9 +353,18 @@ mod test { let mut machine = Machine::new(true, get_debug_configuration()); machine.write_int_register(17, SC_SHUTDOWN as i64); // Set type to shutdown // let ecall = Instruction::new(0b000000000000_00000_000_00000_1110011); - - machine.write_memory(4, 0, 0b000000000000_00000_000_00000_1110011); // ecall - machine.write_memory(4, 4, 0b000000001010_00000_000_00001_0010011); // r1 <- 10 + let insts: [u8; 4] = 0b000000000000_00000_000_00000_1110011_u32.to_le_bytes(); + machine.write_memory(1, 0, insts[0] as u64); + machine.write_memory(1, 1, insts[1] as u64); + machine.write_memory(1, 2, insts[2] as u64); + machine.write_memory(1, 3, insts[3] as u64); // ecall + // machine.write_memory(4, 0, 0b000000000000_00000_000_00000_1110011_u64.to_be()); // ecall + let insts: [u8; 4] = 0b000000001010_00000_000_00001_0010011_u32.to_le_bytes(); + machine.write_memory(1, 4, insts[0] as u64); + machine.write_memory(1, 5, insts[1] as u64); + machine.write_memory(1, 6, insts[2] as u64); + machine.write_memory(1, 7, insts[3] as u64); // r1 <- 10 + // machine.write_memory(4, 4, 0b000000001010_00000_000_00001_0010011_u64.to_be()); // r1 <- 10 let mut system = System::new(true); machine.run(&mut system); // If the machine was stopped with no error, the shutdown worked