single file change

This commit is contained in:
Able 2024-09-17 12:08:19 -05:00
parent 570b566310
commit 7a256dde68
11 changed files with 85 additions and 78 deletions

6
Cargo.lock generated
View file

@ -390,7 +390,7 @@ 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#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#ece9bb8bf21507b5d2a7c870f55aa2e9c5ab9f26"
[[package]] [[package]]
name = "hbbytecode" name = "hbbytecode"
@ -400,7 +400,7 @@ source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#4a9b9de87fd56a6bbd5
[[package]] [[package]]
name = "hblang" name = "hblang"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#ece9bb8bf21507b5d2a7c870f55aa2e9c5ab9f26"
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)",
] ]
@ -408,7 +408,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#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#ece9bb8bf21507b5d2a7c870f55aa2e9c5ab9f26"
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)",
] ]

View file

@ -7,8 +7,57 @@ PCIAddress := struct {
function: u8, function: u8,
} }
find_device := fn(vendor_id: int, device_id: int, pci_address: PCIAddress): int { PCI_ID := struct {
return 1 vendor: u16,
device: u16,
}
get_ids := fn(bus: u8, device: u8, function: u8): PCI_ID {
res := config_read32(bus, device, function, 0)
dev_id := res >> 16
dev_id &= 0xFFFF
vnd_id := res & 0xFFFF
return PCI_ID.(dev_id, vnd_id)
}
PciDeviceInfo := struct {
pci_id: PCI_ID,
}
calculate_address := fn(bus: u8, device: u8, function: u8, offset: u8): int {
address := bus << 16
address |= device << 11
address |= function << 8
address |= offset & 0xFC
address |= 0x80000000
return address
}
check_device := fn(bus: u8, device: u8): PciDeviceInfo {
pci_id := get_ids(bus, device, 0)
if pci_id.vendor == 0xFFFF {
stn.log.warn(":|\0")
} else {
stn.log.info(":)\0")
}
address := calculate_address(bus, device, 0, 0x8)
reg2 := config_read32(bus, device, 0, 0x8)
class := reg2 >> 16 & 0xFFFF
b := "\0\0\0\0\0\0\0"
string.display_int(class, b)
stn.log.info(b)
return PciDeviceInfo.(pci_id)
}
find_device := fn(vendor_id: int, device_id: int, pci_address: PCIAddress): PCI_ID {
pci_id := get_ids(0, 2, 0)
return pci_id
} }
scan_bus := fn(): void { scan_bus := fn(): void {

View file

@ -1,6 +1,12 @@
//! This is a reserved file for use with the AbleOS Clustering System //! This is a reserved file for use with the AbleOS Clustering System
HostID := int HostID := int
FileID := struct {
host_id: HostID,
id: int,
}
// A DeviceID points to a specific device in the ACS. // A DeviceID points to a specific device in the ACS.
DeviceID := struct { DeviceID := struct {
host_id: HostID, host_id: HostID,

View file

@ -1,13 +1,13 @@
acs := @use("rel:acs.hb") acs := @use("rel:acs.hb");
.{DiskID, FileID} := acs
// Paths without a node-disk component are to be treated as local files. // Paths without a node-disk component are to be treated as local files.
// file_path := "DID:/test\0"; // file_path := "DID:/test\0";
Path := struct {// DiskID holds the host id Path := struct {
disk_id: acs.DiskID, length: u8, data: ^u8} // DiskID holds the host id
disk_id: DiskID,
FileID := struct { length: u8,
host_id: int, data: ^u8,
id: int,
} }
open := fn(file_path: Path): FileID { open := fn(file_path: Path): FileID {

View file

@ -6,5 +6,4 @@ memory := @use("rel:memory.hb")
buffer := @use("rel:buffer.hb") buffer := @use("rel:buffer.hb")
math := @use("rel:math.hb") math := @use("rel:math.hb")
random := @use("rel:random.hb") random := @use("rel:random.hb")
pci := @use("rel:pci.hb")
file := @use("rel:file_io.hb") file := @use("rel:file_io.hb")

View file

@ -4,8 +4,8 @@ buffer := @use("rel:buffer.hb")
log := fn(message: ^u8, level: u8): void { log := fn(message: ^u8, level: u8): void {
message_length := @inline(string.length, message); message_length := @inline(string.length, message);
*(message + message_length) = level *(message + message_length) = level
@eca(i32, 3, 1, message, message_length + 1)
return return @eca(3, 1, message, message_length + 1)
} }
error := fn(message: ^u8): void return log(message, 0) error := fn(message: ^u8): void return log(message, 0)

View file

@ -23,7 +23,7 @@ OutlMsg := struct {a: u8, b: u8, addr: u16, value: u32}
InlMsg := struct {a: u8, b: u8, addr: u16} InlMsg := struct {a: u8, b: u8, addr: u16}
outb := fn(addr: u16, value: u8): void { outb := fn(addr: u16, value: u8): void {
return @eca(void, 3, 3, &OutbMsg.(1, 0, addr, value), @sizeof(OutbMsg)) return @eca(3, 3, &OutbMsg.(1, 0, addr, value), @sizeof(OutbMsg))
} }
inb := fn(addr: u16): u8 { inb := fn(addr: u16): u8 {
@ -31,9 +31,9 @@ inb := fn(addr: u16): u8 {
} }
outl := fn(addr: u16, value: u32): void { outl := fn(addr: u16, value: u32): void {
return @eca(void, 3, 3, &OutlMsg.(1, 2, addr, value), @sizeof(OutlMsg)) return @eca(3, 3, &OutlMsg.(1, 2, addr, value), @sizeof(OutlMsg))
} }
inl := fn(addr: u16): u32 { inl := fn(addr: u16): u32 {
return @eca(u32, 3, 3, &InlMsg.(0, 2, addr), @sizeof(InlMsg)) return @eca(3, 3, &InlMsg.(0, 2, addr), @sizeof(InlMsg))
} }

View file

@ -1,50 +0,0 @@
.{inl, outl} := @use("rel:memory.hb")
config_read := fn(bus: u8, device: u8, func: u8, offset: u8): u32 {
lbus := @as(u32, bus)
ldevice := @as(u32, device)
lfunc := @as(u32, func)
loffset := @as(u32, offset)
address := lbus << 16 | ldevice << 11 | lfunc << 8 | loffset & 0xFC | @as(u32, 0x80000000)
outl(0xCF8, address)
return inl(0xCFC)
}
config_write := fn(bus: u8, device: u8, func: u8, offset: u8, value: u32): void {
lbus := @as(u32, bus)
ldevice := @as(u32, device)
lfunc := @as(u32, func)
loffset := @as(u32, offset)
address := lbus << 16 | ldevice << 11 | lfunc << 8 | loffset & 0xFC | @as(u32, 0x80000000)
outl(0xCF8, address)
outl(0xCFC, value)
}
get_header_type := fn(bus: u8, device: u8, func: u8): u8 {
return @as(u8, config_read(bus, device, func, 0xC) >> 16 & 0xFF)
}
Ids := struct {vendor: u16, device: u16}
get_ids := fn(bus: u8, device: u8, func: u8): Ids {
res := config_read(bus, device, func, 0)
return .(@as(u16, res >> 16 & 0xFFFF), @as(u16, res & 0xFFFF))
}
PciDeviceInfo := struct {header_type: u8, device: u8, bus: u8, device_id: Ids, full_class: u16, rev_id: u8}
check_device := fn(bus: u8, device: u8): PciDeviceInfo {
ids := get_ids(bus, device, 0)
if ids.vendor == 0xFFFF {
return .(0, 0, 0, .(0, 0), 0, 0)
}
reg2 := config_read(bus, device, 0, 0x8)
class := @as(u16, reg2 >> 16 & 0xFFFF)
header_type := get_header_type(bus, device, 0)
return .(header_type, device, bus, ids, class, @as(u8, reg2 & 0xFF))
}

View file

@ -1,15 +1,19 @@
stn := @use("../../../libraries/stn/src/lib.hb");
.{string, memory, buffer, log} := stn
pci := @use("../../../libraries/pci/src/lib.hb"); pci := @use("../../../libraries/pci/src/lib.hb");
.{PCIAddress} := pci .{PCIAddress} := pci
FIFO := struct { FIFO := struct {
reserved_size: u32, reserved_size: u32,
using_bounce_buffer: u8, using_bounce_buffer: u8,
bounce_buffer: [u8; 1024 * 1024], //bounce_buffer: [u8; 1024 * 1024],
next_fence: u32, next_fence: u32,
} }
new_fifo := fn(): FIFO { new_fifo := fn(): FIFO {
bounce_buffer := @as([u8; 1024 * 1024], idk) //bounce_buffer := @as([u8; 1024 * 1024], idk)
return FIFO.(0, 0, bounce_buffer, 0) /*bounce_buffer,*/
return FIFO.(0, 0, 0)
} }
IRQ := struct { IRQ := struct {

View file

@ -12,9 +12,8 @@ PCI_DEVICE_ID_VMWARE_SVGA2 := 0x405
init := fn(): void { init := fn(): void {
svga_struct := device.svga_device() svga_struct := device.svga_device()
if pci.find_device(PCI_VENDOR_ID_VMWARE, PCI_DEVICE_ID_VMWARE_SVGA2, svga_struct.pciAddr) { pci_dev := pci.check_device(0, 2)
log.error("No VMware SVGA device found.\0")
}
return return
} }

View file

@ -44,7 +44,7 @@ resolution = "1024x768x24"
[boot.limine.ableos.modules.svga_driver] [boot.limine.ableos.modules.svga_driver]
path = "boot:///svga_driver.hbf" path = "boot:///svga_driver.hbf"
[boot.limine.ableos.modules.filesystem_fat32] # [boot.limine.ableos.modules.filesystem_fat32]
path = "boot:///filesystem_fat32.hbf" # path = "boot:///filesystem_fat32.hbf"
[boot.limine.ableos.modules.pumpkin_print] # [boot.limine.ableos.modules.pumpkin_print]
path = "boot:///pumpkin_print.hbf" # path = "boot:///pumpkin_print.hbf"