forked from AbleOS/ableos
Compare commits
No commits in common. "501e2f5cb5ed3883ac89248386b7e8224f5c1c90" and "161529753698f2020ead4fd6f87e36b40e71e415" have entirely different histories.
501e2f5cb5
...
1615297536
|
@ -131,10 +131,6 @@ pub fn handler(vm: &mut Vm) {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
// source of rng
|
||||
4 => {
|
||||
vm.registers[1] = hbvm::value::Value(crate::arch::hardware_random_u64());
|
||||
}
|
||||
buffer_id => {
|
||||
let mut buffs = IPC_BUFFERS.lock();
|
||||
match buffs.get_mut(&buffer_id) {
|
||||
|
@ -171,7 +167,7 @@ pub fn handler(vm: &mut Vm) {
|
|||
if buffs.get_mut(&buffer_id).is_some() {
|
||||
buff = buffs.get_mut(&buffer_id).unwrap();
|
||||
} else {
|
||||
// info!("AHHH");
|
||||
info!("AHHH");
|
||||
vm.registers[1] = hbvm::value::Value(0);
|
||||
return;
|
||||
}
|
||||
|
@ -209,6 +205,7 @@ pub fn handler(vm: &mut Vm) {
|
|||
vm.registers[3] = x
|
||||
}
|
||||
}
|
||||
// 5
|
||||
_ => {
|
||||
log::error!("Syscall unknown {:?}{:?}", ecall_number, vm.registers);
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
software := @use("rel:software.hb")
|
|
@ -1,16 +0,0 @@
|
|||
.{buffer} := @use("../../stn/src/lib.hb")
|
||||
|
||||
test := fn(): int {
|
||||
buffer_id := buffer.search("XGraphics\0")
|
||||
msg := "\0"
|
||||
buffer.send_message(msg, buffer_id)
|
||||
return 0
|
||||
}
|
||||
|
||||
put_pixel := fn(): int {
|
||||
return 0
|
||||
}
|
||||
|
||||
sync := fn(): int {
|
||||
return 0
|
||||
}
|
|
@ -4,9 +4,8 @@ receive_message := fn(buffer_id: int, memory_map_location: ^u8, length: int): ^u
|
|||
return @eca(^u8, 4, buffer_id, memory_map_location, length)
|
||||
}
|
||||
|
||||
send_message := fn(msg: ^u8, buffer_id: int): void {
|
||||
msg_length := string.length(msg)
|
||||
@eca(i32, 3, buffer_id, msg, msg_length)
|
||||
send_message := fn(buffer_id: int, message: ^u8, message_length: int): void {
|
||||
@eca(i32, 3, buffer_id, message, message_length)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -3,4 +3,3 @@ log := @use("rel:log.hb")
|
|||
memory := @use("rel:memory.hb")
|
||||
buffer := @use("rel:buffer.hb")
|
||||
math := @use("rel:math.hb")
|
||||
random := @use("rel:random.hb")
|
|
@ -1,8 +0,0 @@
|
|||
uint_64 := fn(min: uint, max: uint): uint {
|
||||
rng := @eca(uint, 3, 4)
|
||||
|
||||
if min != 0 | max != 0 {
|
||||
return rng % (max - min + 1) + min
|
||||
}
|
||||
return rng
|
||||
}
|
|
@ -1,20 +1,7 @@
|
|||
.{log, memory, string, buffer} := @use("../../../libraries/stn/src/lib.hb");
|
||||
.{front_buffer_ptr, screenidx, ColorBGRA, Point} := @use("./lib.hb")
|
||||
// change "lines.hb" to another example to see it onscreen
|
||||
example := @use("examples/lines.hb").example
|
||||
|
||||
main := fn(): int {
|
||||
buffer_id := buffer.create("XGraphics\0")
|
||||
memmap := memory.request_page(1)
|
||||
x := 0
|
||||
loop {
|
||||
msg := buffer.receive_message(buffer_id, memmap, 0)
|
||||
if msg != 0 {
|
||||
log.info("Hello, Framebuffer!\0")
|
||||
}
|
||||
loop if x == 4096 {
|
||||
*(memmap + x) = 0
|
||||
x += 1
|
||||
}
|
||||
x = 0
|
||||
}
|
||||
example()
|
||||
return 0
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
[package]
|
||||
name = "fb_driver_stresstest"
|
||||
authors = ["aurlex"]
|
||||
|
||||
[dependants.libraries]
|
||||
|
||||
[dependants.binaries]
|
||||
hblang.version = "1.0.0"
|
||||
|
||||
[build]
|
||||
command = "hblang src/main.hb"
|
|
@ -1,6 +0,0 @@
|
|||
.{test, put_pixel, sync} := @use("../../../libraries/render/src/lib.hb").software
|
||||
|
||||
main := fn(): int {
|
||||
test()
|
||||
return 0
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
.{memory, log, string, buffer} := @use("../../../libraries/stn/src/lib.hb")
|
||||
|
||||
init := fn(): void {
|
||||
send_byte_to_controller(173)
|
||||
send_byte_to_controller(167)
|
||||
|
||||
// flush output buffer
|
||||
memory.inb(0, 96)
|
||||
|
||||
send_byte_to_controller(32)
|
||||
config_byte := read_byte()
|
||||
log.info("What\0")
|
||||
|
||||
// TODO: We just assume there's a second device here and set up the
|
||||
// controller as such. We should probably look for the second device FIRST
|
||||
// The OSWiki has a page about this
|
||||
// https://wiki.osdev.org/%228042%22_PS/2_Controller#Step_7:_Determine_If_There_Are_2_Channels
|
||||
config_byte &= 32
|
||||
send_byte_to_controller(96)
|
||||
send_byte(config_byte)
|
||||
|
||||
if perform_self_test() {
|
||||
log.info("PS/2 Controller self test successful\0")
|
||||
send_byte_to_controller(171)
|
||||
if read_byte() != 0 {
|
||||
log.error("PS/2 First port test failed\0")
|
||||
}
|
||||
send_byte_to_controller(169)
|
||||
if read_byte() != 0 {
|
||||
log.error("PS/2 Second port test failed\0")
|
||||
}
|
||||
} else {
|
||||
log.error("PS/2 Controller self test failed\0")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
perform_self_test := fn(): bool {
|
||||
send_byte_to_controller(32)
|
||||
config_byte := read_byte()
|
||||
|
||||
send_byte_to_controller(170)
|
||||
response := read_byte()
|
||||
|
||||
send_byte_to_controller(96)
|
||||
send_byte(config_byte)
|
||||
return response == 85
|
||||
}
|
||||
|
||||
send_byte_to_controller := fn(byte: u8): void {
|
||||
loop {
|
||||
status := memory.inb(0, 100)
|
||||
// Bitwise OR with 1011 1111
|
||||
// If the second bit was set in the status register,
|
||||
// status is now equal to 255
|
||||
status |= 191
|
||||
|
||||
if status != 255 {
|
||||
memory.outb(0, 100, byte)
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
send_byte := fn(byte: u8): void {
|
||||
loop {
|
||||
status := memory.inb(0, 100)
|
||||
// Bitwise OR with 1011 1111
|
||||
// If the second bit was set in the status register,
|
||||
// status is now equal to 255
|
||||
status |= 191
|
||||
|
||||
if status != 255 {
|
||||
memory.outb(0, 96, byte)
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
read_byte := fn(): u8 {
|
||||
ptr := memory.request_page(1)
|
||||
loop {
|
||||
status := memory.inb(0, 100)
|
||||
// Bitwise OR with 0111 1111
|
||||
// If the first bit was set in the status register,
|
||||
// status is now equal to 255
|
||||
status |= 127
|
||||
str := string.display_int(status, ptr)
|
||||
log.info(ptr)
|
||||
|
||||
if status == 255 {
|
||||
return memory.inb(0, 96)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,28 +1,31 @@
|
|||
.{memory, log, string, buffer} := @use("../../../libraries/stn/src/lib.hb")
|
||||
controller := @use("./controller.hb")
|
||||
|
||||
send_byte := fn(byte: u8): u8 {
|
||||
memory.outb(0, 96, byte)
|
||||
input := memory.inb(0, 96)
|
||||
return input
|
||||
}
|
||||
|
||||
main := fn(): int {
|
||||
log.info("PS/2 Driver Loaded\0")
|
||||
controller.init()
|
||||
if send_byte(238) == 238 {
|
||||
log.info("PS/2 Keyboard Echoed\0")
|
||||
}
|
||||
if send_byte(244) == 250 {
|
||||
log.info("Enabled scanning\0")
|
||||
}
|
||||
buf := buffer.create()
|
||||
ptr := memory.request_page(1)
|
||||
prev_input := 250
|
||||
loop {
|
||||
input := memory.inb(0, 96)
|
||||
if input == prev_input {
|
||||
continue
|
||||
}
|
||||
prev_input = input
|
||||
keycode_str := string.display_int(input, ptr)
|
||||
log.info(string.display_int(buf))
|
||||
buffer.send_message(buf, keycode_str, string.length(keycode_str))
|
||||
}
|
||||
return 0
|
||||
// if send_byte(238) == 238 {
|
||||
// log.info("PS/2 Keyboard Echoed\0")
|
||||
// }
|
||||
// if send_byte(244) == 250 {
|
||||
// log.info("Enabled scanning\0")
|
||||
// }
|
||||
// buf := buffer.create("XKeyboard\0")
|
||||
// ptr := memory.request_page(1)
|
||||
// prev_input := 250
|
||||
// loop {
|
||||
// input := memory.inb(0, 96)
|
||||
// if input == prev_input {
|
||||
// continue
|
||||
// }
|
||||
// prev_input = input
|
||||
// keycode_str := string.display_int(input, ptr)
|
||||
// log.info(string.display_int(buf))
|
||||
// buffer.send_message(keycode_str, buf)
|
||||
// }
|
||||
// return 0
|
||||
}
|
|
@ -19,12 +19,11 @@ resolution = "1024x768x24"
|
|||
|
||||
# [boot.limine.ableos.modules.tests]
|
||||
# path = "boot:///tests.hbf"
|
||||
|
||||
[boot.limine.ableos.modules.a_serial_driver]
|
||||
path = "boot:///a_serial_driver.hbf"
|
||||
|
||||
[boot.limine.ableos.modules.ps2_driver]
|
||||
path = "boot:///ps2_driver.hbf"
|
||||
path = "boot:///ps2_driver.hbf"
|
||||
|
||||
[boot.limine.ableos.modules.diskio_driver]
|
||||
path = "boot:///diskio_driver.hbf"
|
||||
|
@ -32,8 +31,6 @@ path = "boot:///diskio_driver.hbf"
|
|||
[boot.limine.ableos.modules.fb_driver]
|
||||
path = "boot:///fb_driver.hbf"
|
||||
|
||||
|
||||
[boot.limine.ableos.modules.serial_driver_test]
|
||||
path = "boot:///serial_driver_test.hbf"
|
||||
|
||||
[boot.limine.ableos.modules.fb_driver_stresstest]
|
||||
path = "boot:///fb_driver_stresstest.hbf"
|
Loading…
Reference in a new issue