let's just use strings for now
This commit is contained in:
parent
df74b09134
commit
78553a3190
|
@ -13,7 +13,7 @@ use {
|
||||||
|
|
||||||
pub fn handler(vm: &mut Vm) {
|
pub fn handler(vm: &mut Vm) {
|
||||||
let ecall_number = vm.registers[2].cast::<u64>();
|
let ecall_number = vm.registers[2].cast::<u64>();
|
||||||
log::info!("eca called :pensive:");
|
// log::info!("eca called :pensive:");
|
||||||
// debug!("Ecall number {:?}", ecall_number);
|
// debug!("Ecall number {:?}", ecall_number);
|
||||||
//info!("Register dump: {:?}", vm.registers);
|
//info!("Register dump: {:?}", vm.registers);
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,32 @@ release_page := fn(ptr: ^u8, page_count: u8): void {
|
||||||
return @eca(void, 3, 2, msg, 12)
|
return @eca(void, 3, 2, msg, 12)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// outb := fn(addr: u16, value: u8): void {
|
||||||
|
// msg := [u8; 5].(1, 0, @as(u8, addr & 0xFF), @as(u8, addr >> 8 & 0xFF), value)
|
||||||
|
// return @eca(void, 3, 3, &msg, 5)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// inb := fn(addr: u16): u8 {
|
||||||
|
// msg := [u8; 4].(0, 0, @as(u8, addr & 0xFF), @as(u8, addr >> 8 & 0xFF))
|
||||||
|
// return @eca(u8, 3, 3, &msg, 4)
|
||||||
|
// }
|
||||||
|
|
||||||
outb := fn(addr: u16, value: u8): void {
|
outb := fn(addr: u16, value: u8): void {
|
||||||
msg := [u8; 5].(1, 0, @as(u8, addr & 0xFF), @as(u8, addr >> 8 & 0xFF), value)
|
msg := "\0\0\0\0\0";
|
||||||
return @eca(void, 3, 3, &msg, 5)
|
*@as(^u8, msg) = @as(u8, 1);
|
||||||
|
*@as(^u8, msg + 1) = @as(u8, 0);
|
||||||
|
*@as(^u16, @bitcast(msg + 2)) = addr;
|
||||||
|
*@as(^u8, msg + 4) = value
|
||||||
|
@eca(void, 3, 3, msg, 5)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
inb := fn(addr: u16): u8 {
|
inb := fn(addr: u16): u8 {
|
||||||
msg := [u8; 4].(0, 0, @as(u8, addr & 0xFF), @as(u8, addr >> 8 & 0xFF))
|
msg := "\0\0\0\0";
|
||||||
return @eca(u8, 3, 3, &msg, 4)
|
*@as(^u8, msg) = @as(u8, 0);
|
||||||
|
*@as(^u8, msg + 1) = @as(u8, 0);
|
||||||
|
*@as(^u16, @bitcast(msg + 2)) = addr
|
||||||
|
return @eca(u8, 3, 3, msg, 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
outl := fn(addr: u16, value: u32): void {
|
outl := fn(addr: u16, value: u32): void {
|
||||||
|
|
|
@ -6,31 +6,28 @@ send_byte := fn(byte: u8): u8 {
|
||||||
}
|
}
|
||||||
|
|
||||||
main := fn(): int {
|
main := fn(): int {
|
||||||
memory.outb(96, 238)
|
send_byte(238)
|
||||||
// memory.inb(96)
|
log.info("PS/2 Driver Loaded\0")
|
||||||
|
if send_byte(238) == 238 {
|
||||||
// send_byte(238)
|
log.info("PS/2 Keyboard Echoed\0")
|
||||||
// log.info("PS/2 Driver Loaded\0")
|
}
|
||||||
// if send_byte(238) == 238 {
|
a := 0
|
||||||
// log.info("PS/2 Keyboard Echoed\0")
|
a += 1
|
||||||
// }
|
if send_byte(244) == 250 {
|
||||||
// a := 0
|
log.info("Enabled scanning\0")
|
||||||
// a += 1
|
}
|
||||||
// if send_byte(244) == 250 {
|
buf := buffer.create("XKeyboard\0")
|
||||||
// log.info("Enabled scanning\0")
|
ptr := memory.request_page(1)
|
||||||
// }
|
prev_input := 250
|
||||||
// buf := buffer.create("XKeyboard\0")
|
loop {
|
||||||
// ptr := memory.request_page(1)
|
input := memory.inb(96)
|
||||||
// prev_input := 250
|
if input == prev_input {
|
||||||
// loop {
|
continue
|
||||||
// input := memory.inb(96)
|
}
|
||||||
// if input == prev_input {
|
prev_input = input
|
||||||
// continue
|
keycode_str := string.display_int(input, ptr)
|
||||||
// }
|
log.info(string.display_int(input, ptr))
|
||||||
// prev_input = input
|
buffer.send_message(keycode_str, buf)
|
||||||
// keycode_str := string.display_int(input, ptr)
|
}
|
||||||
// log.info(string.display_int(input, ptr))
|
|
||||||
// buffer.send_message(keycode_str, buf)
|
|
||||||
// }
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
Loading…
Reference in a new issue