1
0
Fork 0
forked from AbleOS/ableos

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,8 +109,17 @@ pub fn handler(vm: &mut Vm) {
info!("Recieve {:?} from Buffer({})", msg, r2);
}
5 => {
#[cfg(target_arch = "x86_64")]
{
let r2 = vm.registers[2].cast::<u64>();
vm.registers[3] = hbvm::value::Value( unsafe { x86_in(r2 as u16) } as 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);
}
}
// 5
_ => {
@ -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> {
// let message_length = 8 + 8 + 8;
// log::info!("Mem Addr 0x{:x?} length {}", mem_addr, length);
@ -139,7 +141,7 @@ fn log_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogE
}
let log_level = msg_vec.pop().unwrap();
match String::from_utf8(msg_vec) {
Ok (strr) => {
Ok(strr) => {
// use LogLevel::*;
let ll = match log_level {
0 | 48 => error!("{}", strr),

View file

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

View file

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

View file

@ -72,7 +72,7 @@ fn clear() {
}
// Define main
fn main(){
fn main() {
// Log the arguments
{
cp(r3, r1);