diff --git a/Asuro.iso b/Asuro.iso index ee7b1bb2..9ffbec84 100644 Binary files a/Asuro.iso and b/Asuro.iso differ diff --git a/bin/kernel.bin b/bin/kernel.bin index 3492cfbf..30dd8030 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 3492cfbf..30dd8030 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 ad2a7318..f48a2f2c 100644 Binary files a/lib/E1000.ppu and b/lib/E1000.ppu differ diff --git a/lib/arp.ppu b/lib/arp.ppu index a9104844..98d5a332 100644 Binary files a/lib/arp.ppu and b/lib/arp.ppu differ diff --git a/lib/asuro.ppu b/lib/asuro.ppu index 6d11550b..c2e4c0ae 100644 Binary files a/lib/asuro.ppu and b/lib/asuro.ppu differ diff --git a/lib/eth2.ppu b/lib/eth2.ppu index 944ec227..ac124ed2 100644 Binary files a/lib/eth2.ppu and b/lib/eth2.ppu differ diff --git a/lib/ipv4.ppu b/lib/ipv4.ppu index e24fc059..4dde0094 100644 Binary files a/lib/ipv4.ppu and b/lib/ipv4.ppu differ diff --git a/lib/kernel.ppu b/lib/kernel.ppu index 8a77ec91..8309833e 100644 Binary files a/lib/kernel.ppu and b/lib/kernel.ppu differ diff --git a/lib/libpconsole.a b/lib/libpconsole.a index 4ca2793a..e82dbf62 100644 Binary files a/lib/libpconsole.a and b/lib/libpconsole.a differ diff --git a/lib/libpmultiboot.a b/lib/libpmultiboot.a index 32853958..b6756a9b 100644 Binary files a/lib/libpmultiboot.a and b/lib/libpmultiboot.a differ diff --git a/lib/libpsystem.a b/lib/libpsystem.a index c3ab83b3..0bd7129d 100644 Binary files a/lib/libpsystem.a and b/lib/libpsystem.a differ diff --git a/lib/net.ppu b/lib/net.ppu index 3a50bbec..84bb03fa 100644 Binary files a/lib/net.ppu and b/lib/net.ppu differ diff --git a/lib/nettypes.ppu b/lib/nettypes.ppu index 47460cb0..9c713592 100644 Binary files a/lib/nettypes.ppu and b/lib/nettypes.ppu differ diff --git a/lib/netutils.ppu b/lib/netutils.ppu index 53e48575..ec8c21c2 100644 Binary files a/lib/netutils.ppu and b/lib/netutils.ppu differ diff --git a/lib/shell.ppu b/lib/shell.ppu index b17ea1c9..7277198a 100644 Binary files a/lib/shell.ppu and b/lib/shell.ppu differ diff --git a/lib/terminal.ppu b/lib/terminal.ppu index e118f1db..b0d137b0 100644 Binary files a/lib/terminal.ppu and b/lib/terminal.ppu differ diff --git a/src/driver/net/include/nettypes.pas b/src/driver/net/include/nettypes.pas index 59447401..73dfe4e1 100644 --- a/src/driver/net/include/nettypes.pas +++ b/src/driver/net/include/nettypes.pas @@ -77,7 +77,7 @@ type total_len_Lo : uint8; identifier_Hi : uint8; identifier_Lo : uint8; - Flags : ubit3; + Flags : ubit3; Fragment_Off : ubit13; TTL : uint8; Protocol : uint8; @@ -89,6 +89,11 @@ type Padding : uint8; end; + PIPv4AsWORDs = ^TIPv4AsWORDs; + TIPv4AsWORDs = bitpacked record + WORDS : Array[0..11] of uint16; + end; + TTCPFlags = record RS : Boolean; DF : Boolean; diff --git a/src/driver/net/l1/net.pas b/src/driver/net/l1/net.pas index 716e7954..bddf0e8e 100644 --- a/src/driver/net/l1/net.pas +++ b/src/driver/net/l1/net.pas @@ -21,7 +21,7 @@ procedure writeToLogLn(str : pchar); implementation uses - ipv4, arp, eth2; + ipv4, arp, eth2, e1000, terminal; var CBSend : TNetSendCallback = nil; @@ -108,12 +108,18 @@ begin pop_trace; end; +procedure terminal_command_e1000status(Params : PParamList); +begin + console.writeHexLnWND(e1000.readStatus, getTerminalHWND); +end; + procedure init; begin push_trace('net.init'); eth2.register; arp.register; ipv4.register; + terminal.registerCommand('e1000status', @terminal_command_e1000status, 'e1000 status'); pop_trace; end; diff --git a/src/driver/net/l3/arp.pas b/src/driver/net/l3/arp.pas index 0f729a49..dd85d961 100644 --- a/src/driver/net/l3/arp.pas +++ b/src/driver/net/l3/arp.pas @@ -67,6 +67,18 @@ begin end; end; +function findCacheRecord(ip : puint8) : PARPCacheRecord; +var + CacheRecord : PARPCacheRecord; + +begin + CacheRecord:= findCacheRecordByIP(ip); + if CacheRecord = nil then begin + + end; + findCacheRecord:= CacheRecord; +end; + procedure send(hType : uint16; pType : uint16; op : uint16; p_context : PPacketContext); var buf : void; @@ -124,6 +136,24 @@ begin freePacketContext(context); end; +procedure sendRequestGateway(ip : puint8); +var + context : PPacketContext; + CacheRecord : PARPCacheRecord; + +begin + context:= newPacketContext; + CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]); + if CacheRecord <> nil then begin + CopyMAC(@CacheRecord^.MAC[0], @context^.MAC.Destination[0]); + CopyIPv4(ip, @context^.IP.Destination[0]); + CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]); + CopyMAC(GetMAC, @context^.MAC.Source[0]); + arp.send($1, $0800, $1, context); + end; + freePacketContext(context); +end; + procedure sendRequest(ip : puint8); var context : PPacketContext; @@ -135,10 +165,10 @@ begin CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]); CopyMAC(GetMAC, @context^.MAC.Source[0]); CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]); - if CacheRecord <> nil then CopyMAC(@CacheRecord^.MAC[0], @context^.MAC.Destination[0]) - else CopyMAC(@NULL_MAC[0], @context^.MAC.Destination[0]); + CopyMAC(@NULL_MAC[0], @context^.MAC.Destination[0]); arp.send($1, $0800, $1, context); freePacketContext(context); + sendRequestGateway(ip); end; procedure recv(p_data : void; p_len : uint16; p_context : PPacketContext); diff --git a/src/driver/netdev/E1000.pas b/src/driver/netdev/E1000.pas index 57d57e3f..cf6b59f4 100644 --- a/src/driver/netdev/E1000.pas +++ b/src/driver/netdev/E1000.pas @@ -135,6 +135,7 @@ type procedure init(); function getMACAddress : puint8; function sendPacket(p_data : void; p_len : uint16) : sint32; +function readStatus : uint32; implementation @@ -186,6 +187,11 @@ begin pop_trace; end; +function readStatus : uint32; +begin + readStatus:= readCommand(REG_STATUS); +end; + function detectEEPROM() : boolean; var val, i : uint32; @@ -305,7 +311,7 @@ begin writeCommand(REG_RXDESCLO, uint32(outptr)); writeCommand(REG_RXDESCHI, 0); - writeCommand(REG_RXDESCLEN, E1000_NUM_RX_DESC * 16); + writeCommand(REG_RXDESCLEN, E1000_NUM_RX_DESC * sizeof(TE1000_rx_desc)); writeCommand(REG_RXDESCHEAD, 0); writeCommand(REG_RXDESCTAIL, E1000_NUM_RX_DESC-1); @@ -343,7 +349,7 @@ begin writeCommand(REG_TXDESCHI, 0); writeCommand(REG_TXDESCLO, uint32(outptr)); - writeCommand(REG_TXDESCLEN, E1000_NUM_TX_DESC * 16); + writeCommand(REG_TXDESCLEN, E1000_NUM_TX_DESC * sizeof(TE1000_tx_desc)); writeCommand( REG_TXDESCHEAD, 0 ); writeCommand( REG_TXDESCTAIL, 0 ); diff --git a/src/include/asuro.pas b/src/include/asuro.pas index 20631ab7..34584b78 100644 --- a/src/include/asuro.pas +++ b/src/include/asuro.pas @@ -9,14 +9,14 @@ const VERSION_SUB = '1'; REVISION = '677'; RELEASE = 'ia'; - LINE_COUNT = 28049; + LINE_COUNT = 28096; FILE_COUNT = 90; DRIVER_COUNT = 32; FPC_VERSION = '2.6.4'; NASM_VERSION = '2.10.09'; MAKE_VERSION = '3.81'; - COMPILE_DATE = '11/05/18'; - COMPILE_TIME = '10:15:31'; + COMPILE_DATE = '12/05/18'; + COMPILE_TIME = '10:20:16'; implementation