forked from koniifer/ableos
Changed magic
This commit is contained in:
parent
73b998911c
commit
8287b1bdc1
|
@ -72,7 +72,7 @@ impl Assembler {
|
||||||
/// Why 12 bytes? That's the size of largest instruction parameter part.
|
/// Why 12 bytes? That's the size of largest instruction parameter part.
|
||||||
pub fn finalise(&mut self) {
|
pub fn finalise(&mut self) {
|
||||||
self.buf.extend([0; 12]);
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ macro_rules! gen_valider {
|
||||||
/// sound to execute.
|
/// sound to execute.
|
||||||
pub fn validate(mut program: &[u8]) -> Result<(), Error> {
|
pub fn validate(mut program: &[u8]) -> Result<(), Error> {
|
||||||
// Validate magic
|
// 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 {
|
return Err(Error {
|
||||||
kind: ErrorKind::MissingMagic,
|
kind: ErrorKind::MissingMagic,
|
||||||
index: 0,
|
index: 0,
|
||||||
|
@ -67,7 +67,7 @@ macro_rules! gen_valider {
|
||||||
}
|
}
|
||||||
|
|
||||||
let start = program;
|
let start = program;
|
||||||
program = &program[3..];
|
program = &program[4..];
|
||||||
loop {
|
loop {
|
||||||
use crate::opcode::*;
|
use crate::opcode::*;
|
||||||
program = match program {
|
program = match program {
|
||||||
|
|
|
@ -73,7 +73,7 @@ impl<'a, PfHandler: HandlePageFault, const TIMER_QUOTIENT: usize>
|
||||||
pfhandler: traph,
|
pfhandler: traph,
|
||||||
pc: 0,
|
pc: 0,
|
||||||
program_len: program.len() - 12,
|
program_len: program.len() - 12,
|
||||||
program: &program[3..],
|
program: &program[4..],
|
||||||
timer: 0,
|
timer: 0,
|
||||||
copier: None,
|
copier: None,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue