1
0
Fork 0
forked from koniifer/ableos

update hblang to latest git

remove old ps/2 driver
remove defunct time driver
clean up stuff
i promise im done fiddling with ecah.rs and memory.hb
This commit is contained in:
koniifer 2024-09-02 01:04:00 +01:00
parent f7b970eaf0
commit 19992595fc
16 changed files with 13 additions and 131 deletions

10
Cargo.lock generated
View file

@ -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)",
]

View file

@ -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?"),
}

View file

@ -1 +0,0 @@
software := @use("rel:software.hb")

View file

@ -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
}

View file

@ -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
}

View file

@ -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))
}

View file

@ -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

View file

@ -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"

View file

@ -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
}

View file

@ -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")

View file

@ -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"

View file

@ -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"

View file

@ -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
}

View file

@ -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"