forked from AbleOS/ableos
single file change
This commit is contained in:
parent
570b566310
commit
7a256dde68
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -390,7 +390,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "hbbytecode"
|
||||
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]]
|
||||
name = "hbbytecode"
|
||||
|
@ -400,7 +400,7 @@ source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#4a9b9de87fd56a6bbd5
|
|||
[[package]]
|
||||
name = "hblang"
|
||||
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 = [
|
||||
"hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
||||
]
|
||||
|
@ -408,7 +408,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "hbvm"
|
||||
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 = [
|
||||
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
||||
]
|
||||
|
|
|
@ -7,8 +7,57 @@ PCIAddress := struct {
|
|||
function: u8,
|
||||
}
|
||||
|
||||
find_device := fn(vendor_id: int, device_id: int, pci_address: PCIAddress): int {
|
||||
return 1
|
||||
PCI_ID := struct {
|
||||
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 {
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
//! This is a reserved file for use with the AbleOS Clustering System
|
||||
|
||||
HostID := int
|
||||
|
||||
FileID := struct {
|
||||
host_id: HostID,
|
||||
id: int,
|
||||
}
|
||||
|
||||
// A DeviceID points to a specific device in the ACS.
|
||||
DeviceID := struct {
|
||||
host_id: HostID,
|
||||
|
|
|
@ -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.
|
||||
// file_path := "DID:/test\0";
|
||||
Path := struct {// DiskID holds the host id
|
||||
disk_id: acs.DiskID, length: u8, data: ^u8}
|
||||
|
||||
FileID := struct {
|
||||
host_id: int,
|
||||
id: int,
|
||||
Path := struct {
|
||||
// DiskID holds the host id
|
||||
disk_id: DiskID,
|
||||
length: u8,
|
||||
data: ^u8,
|
||||
}
|
||||
|
||||
open := fn(file_path: Path): FileID {
|
||||
|
|
|
@ -6,5 +6,4 @@ memory := @use("rel:memory.hb")
|
|||
buffer := @use("rel:buffer.hb")
|
||||
math := @use("rel:math.hb")
|
||||
random := @use("rel:random.hb")
|
||||
pci := @use("rel:pci.hb")
|
||||
file := @use("rel:file_io.hb")
|
|
@ -4,8 +4,8 @@ buffer := @use("rel:buffer.hb")
|
|||
log := fn(message: ^u8, level: u8): void {
|
||||
message_length := @inline(string.length, message);
|
||||
*(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)
|
||||
|
|
|
@ -23,7 +23,7 @@ OutlMsg := struct {a: u8, b: u8, addr: u16, value: u32}
|
|||
InlMsg := struct {a: u8, b: u8, addr: u16}
|
||||
|
||||
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 {
|
||||
|
@ -31,9 +31,9 @@ inb := fn(addr: u16): u8 {
|
|||
}
|
||||
|
||||
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 {
|
||||
return @eca(u32, 3, 3, &InlMsg.(0, 2, addr), @sizeof(InlMsg))
|
||||
return @eca(3, 3, &InlMsg.(0, 2, addr), @sizeof(InlMsg))
|
||||
}
|
|
@ -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))
|
||||
}
|
|
@ -1,15 +1,19 @@
|
|||
stn := @use("../../../libraries/stn/src/lib.hb");
|
||||
.{string, memory, buffer, log} := stn
|
||||
|
||||
pci := @use("../../../libraries/pci/src/lib.hb");
|
||||
.{PCIAddress} := pci
|
||||
|
||||
FIFO := struct {
|
||||
reserved_size: u32,
|
||||
using_bounce_buffer: u8,
|
||||
bounce_buffer: [u8; 1024 * 1024],
|
||||
//bounce_buffer: [u8; 1024 * 1024],
|
||||
next_fence: u32,
|
||||
}
|
||||
new_fifo := fn(): FIFO {
|
||||
bounce_buffer := @as([u8; 1024 * 1024], idk)
|
||||
return FIFO.(0, 0, bounce_buffer, 0)
|
||||
//bounce_buffer := @as([u8; 1024 * 1024], idk)
|
||||
/*bounce_buffer,*/
|
||||
return FIFO.(0, 0, 0)
|
||||
}
|
||||
|
||||
IRQ := struct {
|
||||
|
|
|
@ -12,9 +12,8 @@ PCI_DEVICE_ID_VMWARE_SVGA2 := 0x405
|
|||
init := fn(): void {
|
||||
svga_struct := device.svga_device()
|
||||
|
||||
if pci.find_device(PCI_VENDOR_ID_VMWARE, PCI_DEVICE_ID_VMWARE_SVGA2, svga_struct.pciAddr) {
|
||||
log.error("No VMware SVGA device found.\0")
|
||||
}
|
||||
pci_dev := pci.check_device(0, 2)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ resolution = "1024x768x24"
|
|||
[boot.limine.ableos.modules.svga_driver]
|
||||
path = "boot:///svga_driver.hbf"
|
||||
|
||||
[boot.limine.ableos.modules.filesystem_fat32]
|
||||
path = "boot:///filesystem_fat32.hbf"
|
||||
[boot.limine.ableos.modules.pumpkin_print]
|
||||
path = "boot:///pumpkin_print.hbf"
|
||||
# [boot.limine.ableos.modules.filesystem_fat32]
|
||||
# path = "boot:///filesystem_fat32.hbf"
|
||||
# [boot.limine.ableos.modules.pumpkin_print]
|
||||
# path = "boot:///pumpkin_print.hbf"
|
||||
|
|
Loading…
Reference in a new issue