diff --git a/Asuro.iso b/Asuro.iso index f17cd0c0..b7394e5c 100644 Binary files a/Asuro.iso and b/Asuro.iso differ diff --git a/bin/kernel.bin b/bin/kernel.bin index ebd937fc..b85be84a 100755 Binary files a/bin/kernel.bin and b/bin/kernel.bin differ diff --git a/iso/boot/asuro.bin b/iso/boot/asuro.bin index ebd937fc..b85be84a 100755 Binary files a/iso/boot/asuro.bin and b/iso/boot/asuro.bin differ diff --git a/lib/E1000.ppu b/lib/E1000.ppu index 5be6646e..40648db7 100644 Binary files a/lib/E1000.ppu and b/lib/E1000.ppu differ diff --git a/lib/PCI.ppu b/lib/PCI.ppu index 217a8245..00c4d4de 100644 Binary files a/lib/PCI.ppu and b/lib/PCI.ppu differ diff --git a/lib/USB.ppu b/lib/USB.ppu index a7f12dc2..5223d492 100644 Binary files a/lib/USB.ppu and b/lib/USB.ppu differ diff --git a/lib/bios_data_area.ppu b/lib/bios_data_area.ppu index 3c206fe8..cfc331a7 100644 Binary files a/lib/bios_data_area.ppu and b/lib/bios_data_area.ppu differ diff --git a/lib/kernel.ppu b/lib/kernel.ppu index 7423f323..0706e82a 100644 Binary files a/lib/kernel.ppu and b/lib/kernel.ppu differ diff --git a/lib/libpconsole.a b/lib/libpconsole.a index c41b752d..590834aa 100644 Binary files a/lib/libpconsole.a and b/lib/libpconsole.a differ diff --git a/lib/libpmultiboot.a b/lib/libpmultiboot.a index d0e4566e..3684ca3e 100644 Binary files a/lib/libpmultiboot.a and b/lib/libpmultiboot.a differ diff --git a/lib/libpsystem.a b/lib/libpsystem.a index 63f08141..8ec607f6 100644 Binary files a/lib/libpsystem.a and b/lib/libpsystem.a differ diff --git a/lib/lmemorymanager.ppu b/lib/lmemorymanager.ppu index c43c439d..40371b80 100644 Binary files a/lib/lmemorymanager.ppu and b/lib/lmemorymanager.ppu differ diff --git a/lib/tss.ppu b/lib/tss.ppu index 9916f0d0..2f2fae2f 100644 Binary files a/lib/tss.ppu and b/lib/tss.ppu differ diff --git a/lib/vmemorymanager.ppu b/lib/vmemorymanager.ppu index 93276555..3eaa1c31 100644 Binary files a/lib/vmemorymanager.ppu and b/lib/vmemorymanager.ppu differ diff --git a/src/driver/network/E1000.pas b/src/driver/network/E1000.pas index a1289a55..be35e278 100644 --- a/src/driver/network/E1000.pas +++ b/src/driver/network/E1000.pas @@ -134,6 +134,7 @@ function sendPacket(p_data : void; p_len : uint16) : sint32; implementation var + bus, slot, func : uint8; loaded : boolean; card_type : TCardType; bar_type : uint8; @@ -265,13 +266,18 @@ begin ptr:= puint8(kalloc(sizeof(TE1000_rx_desc) * E1000_NUM_RX_DESC + 16)); descs:= PE1000_rx_desc(ptr); for i:=0 to E1000_NUM_RX_DESC do begin - rx_descs[i]:= PE1000_rx_desc(uint32(descs + i*16)); + rx_descs[i]:= @descs[i];//PE1000_rx_desc(uint32(descs) + i*16); rx_descs[i]^.address:= uint64(kalloc(8192 + 16)); rx_descs[i]^.status:= 0; end; - - outptr:= puint8(uint32(ptr) - KERNEL_VIRTUAL_BASE); - + + outptr:= puint8(vtop(uint32(ptr)));//puint8(uint32(ptr) - KERNEL_VIRTUAL_BASE); + + console.output('E1000 Driver', 'RX VMem: '); + console.writehexln(uint32(ptr)); + console.output('E1000 Driver', 'RX Mem: '); + console.writehexln(uint32(outptr)); + writeCommand(REG_TXDESCLO, uint32(uint64(outptr) SHR 32)); writeCommand(REG_TXDESCHI, uint32(uint64(outptr) AND $FFFFFFFF)); @@ -298,16 +304,21 @@ begin ptr:= puint8(kalloc(sizeof(TE1000_tx_desc) * (E1000_NUM_TX_DESC + 16))); descs:= PE1000_tx_desc(ptr); for i:=0 to E1000_NUM_TX_DESC do begin - tx_descs[i]:= PE1000_tx_desc(uint32(descs + i*16)); + tx_descs[i]:= @descs[i];//PE1000_tx_desc(uint32(descs + i*16)); tx_descs[i]^.address:= 0; tx_descs[i]^.cmd:= 0; tx_descs[i]^.status:= TSTA_DD; end; - outptr:= puint8(uint32(ptr) - KERNEL_VIRTUAL_BASE); + outptr:= puint8(vtop(uint32(ptr))); //puint8(uint32(ptr) - KERNEL_VIRTUAL_BASE); - writeCommand(REG_TXDESCHI, uint32(uint64(outptr) SHR 32)); - writeCommand(REG_TXDESCLO, uint32(uint64(outptr) AND $FFFFFFFF)); + console.output('E1000 Driver', 'TX VMem: '); + console.writehexln(uint32(ptr)); + console.output('E1000 Driver', 'TX Mem: '); + console.writehexln(uint32(outptr)); + + writeCommand(REG_TXDESCHI, 0); + writeCommand(REG_TXDESCLO, uint32(outptr)); writeCommand(REG_TXDESCLEN, E1000_NUM_TX_DESC * 16); @@ -379,12 +390,22 @@ end; procedure fire(); interrupt; var status : uint32; + data : uint32; + begin + console.outputln('E1000 Driver', 'Interrupt begin.'); + CLI; + + requestConfig(bus, slot, func, 1); + data := inl($CFC); + data := data AND $FFF7FFFF; + writeConfig(bus, slot, func, 1, data); status:= readCommand($0C); - //console.outputln('E1000 Driver', 'Interrupt Fired.'); - //console.output('E1000 Driver', 'Int Status: '); - //console.writehexln(status); + + console.output('E1000 Driver', 'Int Status: '); + console.writehexln(status); + if (status AND $04) > 0 then begin startLink(); end else if (Status AND $10) > 0 then begin @@ -392,8 +413,11 @@ begin end else if (Status AND $80) > 0 then begin handleReceive(); end; - outb($20, $20); + outb($A0, $20); + outb($20, $20); + + console.outputln('E1000 Driver', 'Interrupt End.'); end; procedure console_command_mac(params : PParamList); @@ -455,6 +479,9 @@ begin kpalloc(io_base); kpalloc(mem_base); + bus:= PCI_Info^.bus; + slot:= PCI_Info^.slot; + func:= PCI_Info^.func; setBusMaster(PCI_Info^.bus, PCI_Info^.slot, PCI_Info^.func, true); eeprom_exists:= false; @@ -475,7 +502,8 @@ begin end; IDT.set_gate(32 + PCI_Info^.interrupt_line, uint32(@fire), $08, ISR_RING_0); - enableInturrupt(); + + //enableInturrupt(); rxinit(); txinit(); @@ -544,7 +572,7 @@ var old_cur : uint8; begin - tx_descs[tx_curr]^.address:= uint32(uint32(p_data) - KERNEL_VIRTUAL_BASE); + tx_descs[tx_curr]^.address:= uint32(vtop(uint32(p_data))); tx_descs[tx_curr]^.length:= p_len; tx_descs[tx_curr]^.cmd:= CMD_EOP OR CMD_IFCS OR CMD_RS OR CMD_RPS; tx_descs[tx_curr]^.status:= 0; diff --git a/src/kernel.pas b/src/kernel.pas index 22ccdfa9..8257b191 100644 --- a/src/kernel.pas +++ b/src/kernel.pas @@ -36,8 +36,7 @@ uses testdriver, E1000, AHCI_OLD, - IDE, - storagemanagement; + IDE; procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; @@ -95,7 +94,6 @@ begin terminal.registerCommand('BSOD', @terminal_command_bsod, 'Force a Panic Screen.'); drivermanagement.init(); - storagemanagement.init(); console.init(); @@ -142,7 +140,7 @@ begin testdriver.init(); E1000.init(); //AHCI_OLD.init(); - IDE.init(); + //IDE.init(); //Nothing beyond here USB.init(); pci.init(); diff --git a/src/vmemorymanager.pas b/src/vmemorymanager.pas index 42dbe03e..3e70dfdc 100644 --- a/src/vmemorymanager.pas +++ b/src/vmemorymanager.pas @@ -48,6 +48,7 @@ procedure free_page(page_number : uint16); procedure free_page_at_address(address : uint32); function new_page_directory : uint32; function new_kernel_mapped_page_directory : uint32; +function vtop(address : uint32) : uint32; implementation @@ -153,6 +154,19 @@ begin end; end; +function vtop(address : uint32) : uint32; +var + idx : uint32; + paddress : uint32; + loadd : uint32; + +begin + idx:= address SHR 22; + paddress:= uint32(KERNEL_PAGE_DIRECTORY^[idx].address) SHL 12; + loadd:= address AND $FFFFFF; + vtop:= paddress + loadd; +end; + function new_page(page_number : uint16) : boolean; var block : uint16;