diff --git a/Cargo.lock b/Cargo.lock index 8a4f12e5..5bfd9b7a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -444,17 +444,17 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#cbe6f98dff9960e6b070173f35cf54434b0262f6" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#641be15703153386fef1a6b083a7e00c85414df9" [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/ableos/holey-bytes#cbe6f98dff9960e6b070173f35cf54434b0262f6" +source = "git+https://git.ablecorp.us/ableos/holey-bytes#641be15703153386fef1a6b083a7e00c85414df9" [[package]] name = "hblang" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#cbe6f98dff9960e6b070173f35cf54434b0262f6" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#641be15703153386fef1a6b083a7e00c85414df9" dependencies = [ "hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", ] @@ -462,7 +462,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#cbe6f98dff9960e6b070173f35cf54434b0262f6" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#641be15703153386fef1a6b083a7e00c85414df9" dependencies = [ "hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", ] @@ -470,7 +470,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/ableos/holey-bytes#cbe6f98dff9960e6b070173f35cf54434b0262f6" +source = "git+https://git.ablecorp.us/ableos/holey-bytes#641be15703153386fef1a6b083a7e00c85414df9" dependencies = [ "hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes)", ] diff --git a/kernel/src/holeybytes/ecah.rs b/kernel/src/holeybytes/ecah.rs index 85713636..548ddeb9 100644 --- a/kernel/src/holeybytes/ecah.rs +++ b/kernel/src/holeybytes/ecah.rs @@ -111,13 +111,7 @@ pub fn handler(vm: &mut Vm) { let msg_type = msg_vec[0]; msg_vec.remove(0); match msg_type { - // XY\0\0V - // X = 0: Read, 1: Write - // Y = 0: 8bit, 1: 16bit, 2: 32bit - // \0 = Port - // V = Value 0 => 'wow: { - // info!("inb"); let size = match msg_vec[0] { 0 => 1, 1 => 2, @@ -128,8 +122,7 @@ pub fn handler(vm: &mut Vm) { } }; msg_vec.remove(0); - - let addr = ((msg_vec[0] as u16) << 8) | msg_vec[1] as u16; + let addr = u16::from_le_bytes(msg_vec[0..2].try_into().unwrap()); msg_vec.remove(0); msg_vec.remove(0); let value = unsafe { @@ -155,7 +148,7 @@ pub fn handler(vm: &mut Vm) { } }; msg_vec.remove(0); - let addr = ((msg_vec[0] as u16) << 8) | msg_vec[1] as u16; + let addr = u16::from_le_bytes(msg_vec[0..2].try_into().unwrap()); msg_vec.remove(0); msg_vec.remove(0); trace!("Setting address {}", addr); @@ -164,14 +157,11 @@ pub fn handler(vm: &mut Vm) { 1 => x86_out(addr, msg_vec[0]), 2 => x86_out_16( addr, - ((msg_vec[0] as u16) << 8) | msg_vec[1] as u16, + u16::from_le_bytes(msg_vec[0..2].try_into().unwrap()), ), 4 => x86_out_32( addr, - ((msg_vec[0] as u32) << 24) - | ((msg_vec[1] as u32) << 16) - | ((msg_vec[2] as u32) << 8) - | (msg_vec[3] as u32), + u32::from_le_bytes(msg_vec[0..4].try_into().unwrap()), ), _ => panic!("How?"), } diff --git a/sysdata/libraries/render/src/lib.hb b/sysdata/libraries/render/src/lib.hb deleted file mode 100644 index 0ef71218..00000000 --- a/sysdata/libraries/render/src/lib.hb +++ /dev/null @@ -1 +0,0 @@ -software := @use("rel:software.hb") \ No newline at end of file diff --git a/sysdata/libraries/render/src/software.hb b/sysdata/libraries/render/src/software.hb deleted file mode 100644 index 37966bcb..00000000 --- a/sysdata/libraries/render/src/software.hb +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/sysdata/libraries/stn/src/memory.hb b/sysdata/libraries/stn/src/memory.hb index 54ca26d4..0d25d874 100644 --- a/sysdata/libraries/stn/src/memory.hb +++ b/sysdata/libraries/stn/src/memory.hb @@ -40,10 +40,7 @@ outl := fn(addr: u16, value: u32): void { *msg = 1; *(msg + 1) = 2; *@as(^u16, @bitcast(msg + 2)) = addr; - *(msg + 4) = value >> 24 & 0xFF; - *(msg + 5) = value >> 16 & 0xFF; - *(msg + 6) = value >> 8 & 0xFF; - *(msg + 7) = value & 0xFF + *@as(^u32, @bitcast(msg + 4)) = value @eca(void, 3, 3, msg, 8) return } diff --git a/sysdata/programs/fb_driver/src/lib.hb b/sysdata/programs/fb_driver/src/lib.hb index c4d86f36..02c88c5e 100644 --- a/sysdata/programs/fb_driver/src/lib.hb +++ b/sysdata/programs/fb_driver/src/lib.hb @@ -7,9 +7,7 @@ FB_PIXELS := FB_WIDTH * FB_HEIGHT FB_BYTES := FB_PIXELS << 2 // actual enforced max copy size is 0xFFFF, but this was faster MAX_COPY_SIZE := 0x1800 -// see stn.math.min, cant use here due to compiler bug (reg id leaked) -// COPY_PIXELS := math.min(MAX_COPY_SIZE, FB_BYTES) >> 2 -COPY_PIXELS := MAX_COPY_SIZE + (FB_BYTES - MAX_COPY_SIZE & FB_BYTES - MAX_COPY_SIZE >> 31) >> 2 +COPY_PIXELS := math.min(MAX_COPY_SIZE, FB_BYTES) >> 2 PARTITIONS := FB_PIXELS / COPY_PIXELS TOTAL_PAGES := 1 + FB_BYTES >> 12 @@ -35,8 +33,6 @@ create_buffer := fn(): Buffer { return buffer } create_raw_buffer := fn(): ^ColorBGRA { - // helps to trace allocation bugs - log.info("Creating buffer. This will allocate.\0") if TOTAL_PAGES <= 0xFF { return @bitcast(memory.request_page(TOTAL_PAGES)) } diff --git a/sysdata/programs/ps2_driver/README.md b/sysdata/programs/ps2_driver/README.md deleted file mode 100644 index 96840d1e..00000000 --- a/sysdata/programs/ps2_driver/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# PS/2 Driver -This program is a simple driver to read keypresses from a PS/2 Keyboard -Also will contain an abstraction for the PS/2 controller in general so the Mouse code will probably also live here...maybe diff --git a/sysdata/programs/ps2_driver/meta.toml b/sysdata/programs/ps2_driver/meta.toml deleted file mode 100644 index 0a2d770c..00000000 --- a/sysdata/programs/ps2_driver/meta.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "ps2_driver" -authors = ["Talha Qamar"] - -[dependants.libraries] - -[dependants.binaries] -hblang.version = "1.0.0" - -[build] -command = "hblang src/main.hb" diff --git a/sysdata/programs/ps2_driver/src/controller.hb b/sysdata/programs/ps2_driver/src/controller.hb deleted file mode 100644 index e69de29b..00000000 diff --git a/sysdata/programs/ps2_driver/src/keyboard.hb b/sysdata/programs/ps2_driver/src/keyboard.hb deleted file mode 100644 index e69de29b..00000000 diff --git a/sysdata/programs/ps2_driver/src/main.hb b/sysdata/programs/ps2_driver/src/main.hb deleted file mode 100644 index bec3e3d6..00000000 --- a/sysdata/programs/ps2_driver/src/main.hb +++ /dev/null @@ -1,30 +0,0 @@ -.{memory, log, string, buffer} := @use("../../../libraries/stn/src/lib.hb") - -send_byte := fn(byte: u8): u8 { - memory.outb(0x6000, byte) - return memory.inb(0x6000) -} - -main := fn(): int { - log.info("PS/2 Driver Loaded\0") - if send_byte(0xEE) == 0xEE { - log.info("PS/2 Keyboard Echoed\0") - } - if send_byte(0xF4) == 0xFA { - log.info("Enabled scanning\0") - } - buf := buffer.create("XKeyboard\0") - ptr := memory.request_page(1) - prev_input := 0xFA - loop { - input := memory.inb(0x6000) - if input == prev_input { - continue - } - prev_input = input - keycode_str := string.display_int(input, ptr) - log.info(string.display_int(input, ptr)) - buffer.send_message(keycode_str, buf) - } - return 0 -} \ No newline at end of file diff --git a/sysdata/programs/serial_driver_test/src/main.hb b/sysdata/programs/serial_driver_test/src/main.hb index c1f67618..da3b881e 100644 --- a/sysdata/programs/serial_driver_test/src/main.hb +++ b/sysdata/programs/serial_driver_test/src/main.hb @@ -1,7 +1,4 @@ -stn := @use("../../../libraries/stn/src/lib.hb"); -.{string, memory, buffer} := stn - -frame_buffer := @as(^u8, @bitcast(18446603339442421760)) +.{string, memory, buffer} := @use("../../../libraries/stn/src/lib.hb") log_info := fn(): void { a := buffer.search("XNumber\0") diff --git a/sysdata/programs/tests/src/main.hb b/sysdata/programs/tests/src/main.hb index a8dbc78e..bf078994 100644 --- a/sysdata/programs/tests/src/main.hb +++ b/sysdata/programs/tests/src/main.hb @@ -1,5 +1,4 @@ -stn := @use("../../../libraries/stn/src/lib.hb"); -.{log, string, memory, buffer} := stn +.{log, string, memory, buffer} := @use("../../../libraries/stn/src/lib.hb") service_search := fn(): void { a := "\{01}\0" diff --git a/sysdata/programs/time_driver/meta.toml b/sysdata/programs/time_driver/meta.toml deleted file mode 100644 index 84cc97e6..00000000 --- a/sysdata/programs/time_driver/meta.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "time_driver" -authors = ["SamBuckley"] - -[dependants.libraries] - -[dependants.binaries] -hblang.version = "1.0.0" - -[build] -command = "hblang src/main.hb" diff --git a/sysdata/programs/time_driver/src/main.hb b/sysdata/programs/time_driver/src/main.hb deleted file mode 100644 index 45e752bc..00000000 --- a/sysdata/programs/time_driver/src/main.hb +++ /dev/null @@ -1,22 +0,0 @@ -stn := @use("../../../libraries/stn/src/lib.hb") -log := stn.log -mem := stn.memory -s := stn.string -page := 0 - -main := fn(): void { - page += mem.request_page(1) - port_str := "\0\0\{47}\0" - a := @eca(u8, 3, 3, port_str, 4) - - n := 5000000 - loop { - if n == 0 break - n -= 1 - stack_reclamation_edge_case := 0 - } - td := s.display_int(a, page) - log.debug(td) - - return -} \ No newline at end of file diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 2d19bf89..ee0625ca 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -23,9 +23,6 @@ resolution = "1024x768x24" [boot.limine.ableos.modules.a_serial_driver] path = "boot:///a_serial_driver.hbf" -[boot.limine.ableos.modules.ps2_driver] -path = "boot:///ps2_driver.hbf" - [boot.limine.ableos.modules.diskio_driver] path = "boot:///diskio_driver.hbf"