compiling on arm works again

This commit is contained in:
able 2023-12-13 04:21:32 -06:00
parent 5fba1eb890
commit 195192db8a
4 changed files with 14 additions and 13 deletions

View file

@ -109,9 +109,18 @@ pub fn handler(vm: &mut Vm) {
info!("Recieve {:?} from Buffer({})", msg, r2); info!("Recieve {:?} from Buffer({})", msg, r2);
} }
5 => { 5 => {
#[cfg(target_arch = "x86_64")]
{
let r2 = vm.registers[2].cast::<u64>(); let r2 = vm.registers[2].cast::<u64>();
unsafe fn x86_in(address: u16) -> u32 {
x86_64::instructions::port::Port::new(address).read()
}
unsafe fn x86_out(address: u16, value: u32) {
x86_64::instructions::port::Port::new(address).write(value);
}
vm.registers[3] = hbvm::value::Value(unsafe { x86_in(r2 as u16) } as u64); vm.registers[3] = hbvm::value::Value(unsafe { x86_in(r2 as u16) } as u64);
} }
}
// 5 // 5
_ => { _ => {
log::error!("Syscall unknown {:?}{:?}", r1, vm.registers); log::error!("Syscall unknown {:?}{:?}", r1, vm.registers);
@ -119,13 +128,6 @@ pub fn handler(vm: &mut Vm) {
} }
} }
unsafe fn x86_in(address: u16) -> u32{
x86_64::instructions::port::Port::new(address).read()
}
unsafe fn x86_out(address: u16, value: u32){
x86_64::instructions::port::Port::new(address).write(value);
}
fn log_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogError> { fn log_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogError> {
// let message_length = 8 + 8 + 8; // let message_length = 8 + 8 + 8;
// log::info!("Mem Addr 0x{:x?} length {}", mem_addr, length); // log::info!("Mem Addr 0x{:x?} length {}", mem_addr, length);

View file

@ -28,7 +28,7 @@ TERM_BACKDROP=008080
MODULE_CMDLINE="" MODULE_CMDLINE=""
MODULE_PATH=boot:///keyboard_driver.hbf MODULE_PATH=boot:///keyboard_driver.hbf
MODULE_CMDLINE="" MODULE_CMDLINE="arch=${ARCH}"
MODULE_PATH=boot:///vfs_test.hbf MODULE_PATH=boot:///vfs_test.hbf
MODULE_CMDLINE="" MODULE_CMDLINE=""

View file

@ -29,7 +29,6 @@ fn ipc_make_bound_buffer(length) {
private fn log(log_level, string){ private fn log(log_level, string){
// This is NOT the final format // This is NOT the final format
let str = data::str(string + log_level); let str = data::str(string + log_level);
// 1 byte for the log level // 1 byte for the log level
// 8 bytes for the length to the message // 8 bytes for the length to the message
// 8 bytes for the pointer to the string // 8 bytes for the pointer to the string