1
0
Fork 0
forked from koniifer/ableos

omfg it's fixed 🙏

This commit is contained in:
koniifer 2024-09-16 21:56:52 +01:00
parent a8d38e04c4
commit 41b339dfd0
5 changed files with 50 additions and 86 deletions

21
Cargo.lock generated
View file

@ -390,26 +390,25 @@ dependencies = [
[[package]] [[package]]
name = "hbbytecode" name = "hbbytecode"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
[[package]] [[package]]
name = "hbbytecode" name = "hbbytecode"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb" source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
[[package]] [[package]]
name = "hblang" name = "hblang"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
dependencies = [ dependencies = [
"hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", "hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
"regalloc2",
] ]
[[package]] [[package]]
name = "hbvm" name = "hbvm"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
dependencies = [ dependencies = [
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", "hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
] ]
@ -417,7 +416,7 @@ dependencies = [
[[package]] [[package]]
name = "hbvm" name = "hbvm"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb" source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
dependencies = [ dependencies = [
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes.git)", "hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes.git)",
] ]
@ -900,16 +899,6 @@ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
] ]
[[package]]
name = "regalloc2"
version = "0.10.2"
source = "git+https://github.com/jakubDoka/regalloc2.git#34d8424a0d74746d231a96239fdb32e3d5ec0245"
dependencies = [
"hashbrown",
"rustc-hash",
"smallvec",
]
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.8.4" version = "0.8.4"

View file

@ -4,10 +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) return @eca(^u8, 4, buffer_id, memory_map_location, length)
} }
send_message := fn(msg: ^u8, buffer_id: int): void { send_message := fn(msg: ^u8, buffer_id: int, length: int): void {
msg_length := @inline(string.length, msg) return @eca(void, 3, buffer_id, msg, length)
@eca(i32, 3, buffer_id, msg, msg_length)
return
} }
create := fn(msg: ^u8): int { create := fn(msg: ^u8): int {

View file

@ -17,48 +17,23 @@ 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 { OutbMsg := struct {a: u8, b: u8, addr: u16, value: u8}
// msg := [u8; 5].(1, 0, @as(u8, addr & 0xFF), @as(u8, addr >> 8 & 0xFF), value) InbMsg := struct {a: u8, b: u8, addr: u16}
// return @eca(void, 3, 3, &msg, 5) OutlMsg := struct {a: u8, b: u8, addr: u16, value: u32}
// } InlMsg := struct {a: u8, b: u8, addr: u16}
// 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 := "\0\0\0\0\0"; return @eca(void, 3, 3, &OutbMsg.(1, 0, addr, value), @sizeof(OutbMsg))
*@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 := "\0\0\0\0"; return @eca(u8, 3, 3, &InbMsg.(0, 0, addr), @sizeof(InbMsg))
*@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 {
msg := "\0\0\0\0\0\0\0\0"; return @eca(void, 3, 3, &OutlMsg.(1, 2, addr, value), @sizeof(OutlMsg))
*@as(^u8, msg) = @as(u8, 1);
*@as(^u8, msg + 1) = @as(u8, 2);
*@as(^u16, @bitcast(msg + 2)) = addr;
*@as(^u32, @bitcast(msg + 4)) = value
@eca(void, 3, 3, msg, 8)
return
} }
inl := fn(addr: u16): u32 { inl := fn(addr: u16): u32 {
msg := "\0\0\0\0"; return @eca(u32, 3, 3, &InlMsg.(0, 2, addr), @sizeof(InlMsg))
*@as(^u8, msg) = @as(u8, 0);
*@as(^u8, msg + 1) = @as(u8, 2);
*@as(^u16, @bitcast(msg + 2)) = addr
return @eca(u32, 3, 3, msg, 4)
} }

View file

@ -4,43 +4,45 @@ length := fn(ptr: ^u8): int {
return len return len
} }
// WTFFF is wrong with display_int
display_int := fn(num: int, p: ^u8): ^u8 { display_int := fn(num: int, p: ^u8): ^u8 {
i := 0 ptr := p
if num == 0 { negative := num < 0
*p = 48; if negative {
*(p + 1) = 0
return p
}
neg := num < 0
if neg {
num = -num num = -num
} }
if num == 0 {
loop if num == 0 break else { *ptr = 48
*(p + i) = num % 10 + 48 ptr += 1
num /= 10 } else {
i += 1 loop if num == 0 break else {
*ptr = num % 10 + 48
ptr += 1
num /= 10
}
} }
if negative {
if neg { *ptr = 45
*(p + i) = 45 ptr += 1
i += 1 };
} *ptr = 0
@inline(reverse, p, i) @inline(reverse, p)
return p return p
} }
reverse := fn(p: ^u8, len: int): void { reverse := fn(s: ^u8): void {
start := 0 //reverse a string, don't remove digits
end := len - 1 len := 0
loop if start >= end break else { loop if *(s + len) == 0 break else len += 1
temp := *(p + start); i := 0
*(p + start) = *(p + end); j := len - 1
*(p + end) = temp temp := 0
start += 1 loop if i >= j break else {
end -= 1 temp = *(s + i);
*(s + i) = *(s + j);
*(s + j) = temp
i += 1
j -= 1
} }
return return
} }

View file

@ -12,7 +12,7 @@ main := fn(): int {
log.info("PS/2 Keyboard Echoed\0") log.info("PS/2 Keyboard Echoed\0")
} }
a := 0 a := 0
a += 1 // a += 1
if send_byte(244) == 250 { if send_byte(244) == 250 {
log.info("Enabled scanning\0") log.info("Enabled scanning\0")
} }
@ -26,8 +26,8 @@ main := fn(): int {
} }
prev_input = input prev_input = input
keycode_str := string.display_int(input, ptr) keycode_str := string.display_int(input, ptr)
log.info(string.display_int(input, ptr)) log.info(keycode_str)
buffer.send_message(keycode_str, buf) buffer.send_message(&input, buf, 1)
} }
return 0 return 0
} }