E1000 Driver & Net Stack
- E1000 Driver Near Finished - Network stack added (Eth->IPv4) - Other Stuff - Things. - This commit message needs to be longer to make it look like I'm doing more work than I actually am. - Other things. git-svn-id: https://spexeah.com:8443/svn/Asuro@456 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
db8376875b
commit
d98a81b540
BIN
bin/kernel.bin
BIN
bin/kernel.bin
Binary file not shown.
Binary file not shown.
BIN
lib/AHCI_OLD.ppu
BIN
lib/AHCI_OLD.ppu
Binary file not shown.
BIN
lib/E1000.ppu
BIN
lib/E1000.ppu
Binary file not shown.
BIN
lib/IDE.ppu
BIN
lib/IDE.ppu
Binary file not shown.
BIN
lib/PCI.ppu
BIN
lib/PCI.ppu
Binary file not shown.
BIN
lib/USB.ppu
BIN
lib/USB.ppu
Binary file not shown.
Binary file not shown.
BIN
lib/console.ppu
BIN
lib/console.ppu
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/eth2.ppu
BIN
lib/eth2.ppu
Binary file not shown.
BIN
lib/gdt.ppu
BIN
lib/gdt.ppu
Binary file not shown.
BIN
lib/idt.ppu
BIN
lib/idt.ppu
Binary file not shown.
BIN
lib/ipv4.ppu
Normal file
BIN
lib/ipv4.ppu
Normal file
Binary file not shown.
BIN
lib/irq.ppu
BIN
lib/irq.ppu
Binary file not shown.
BIN
lib/isr.ppu
BIN
lib/isr.ppu
Binary file not shown.
BIN
lib/isr0.ppu
BIN
lib/isr0.ppu
Binary file not shown.
BIN
lib/isr1.ppu
BIN
lib/isr1.ppu
Binary file not shown.
BIN
lib/isr10.ppu
BIN
lib/isr10.ppu
Binary file not shown.
BIN
lib/isr11.ppu
BIN
lib/isr11.ppu
Binary file not shown.
BIN
lib/isr12.ppu
BIN
lib/isr12.ppu
Binary file not shown.
BIN
lib/isr13.ppu
BIN
lib/isr13.ppu
Binary file not shown.
BIN
lib/isr14.ppu
BIN
lib/isr14.ppu
Binary file not shown.
BIN
lib/isr15.ppu
BIN
lib/isr15.ppu
Binary file not shown.
BIN
lib/isr16.ppu
BIN
lib/isr16.ppu
Binary file not shown.
BIN
lib/isr17.ppu
BIN
lib/isr17.ppu
Binary file not shown.
BIN
lib/isr18.ppu
BIN
lib/isr18.ppu
Binary file not shown.
BIN
lib/isr2.ppu
BIN
lib/isr2.ppu
Binary file not shown.
BIN
lib/isr3.ppu
BIN
lib/isr3.ppu
Binary file not shown.
BIN
lib/isr32.ppu
BIN
lib/isr32.ppu
Binary file not shown.
BIN
lib/isr33.ppu
BIN
lib/isr33.ppu
Binary file not shown.
BIN
lib/isr4.ppu
BIN
lib/isr4.ppu
Binary file not shown.
BIN
lib/isr40.ppu
BIN
lib/isr40.ppu
Binary file not shown.
BIN
lib/isr44.ppu
BIN
lib/isr44.ppu
Binary file not shown.
BIN
lib/isr5.ppu
BIN
lib/isr5.ppu
Binary file not shown.
BIN
lib/isr6.ppu
BIN
lib/isr6.ppu
Binary file not shown.
BIN
lib/isr7.ppu
BIN
lib/isr7.ppu
Binary file not shown.
BIN
lib/isr76.ppu
BIN
lib/isr76.ppu
Binary file not shown.
BIN
lib/isr8.ppu
BIN
lib/isr8.ppu
Binary file not shown.
BIN
lib/isr9.ppu
BIN
lib/isr9.ppu
Binary file not shown.
Binary file not shown.
BIN
lib/kernel.ppu
BIN
lib/kernel.ppu
Binary file not shown.
BIN
lib/keyboard.ppu
BIN
lib/keyboard.ppu
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/libpsystem.a
BIN
lib/libpsystem.a
Binary file not shown.
Binary file not shown.
BIN
lib/mouse.ppu
BIN
lib/mouse.ppu
Binary file not shown.
Binary file not shown.
BIN
lib/net.ppu
BIN
lib/net.ppu
Binary file not shown.
BIN
lib/nettypes.ppu
BIN
lib/nettypes.ppu
Binary file not shown.
BIN
lib/netutils.ppu
Normal file
BIN
lib/netutils.ppu
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/strings.ppu
BIN
lib/strings.ppu
Binary file not shown.
BIN
lib/system.o
BIN
lib/system.o
Binary file not shown.
BIN
lib/system.ppu
BIN
lib/system.ppu
Binary file not shown.
BIN
lib/terminal.ppu
BIN
lib/terminal.ppu
Binary file not shown.
Binary file not shown.
BIN
lib/tss.ppu
BIN
lib/tss.ppu
Binary file not shown.
BIN
lib/util.ppu
BIN
lib/util.ppu
Binary file not shown.
Binary file not shown.
11
src/driver/net/arp.pas
Normal file
11
src/driver/net/arp.pas
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
unit arp;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
nettypes, netutils,
|
||||||
|
eth2;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
@ -3,8 +3,11 @@ unit eth2;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
net, nettypes, console;
|
nettypes, netutils,
|
||||||
|
net,
|
||||||
|
console;
|
||||||
|
|
||||||
|
procedure registerType(eType : uint16; RecvCB : TRecvCallback);
|
||||||
procedure register;
|
procedure register;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -16,21 +19,40 @@ var
|
|||||||
|
|
||||||
procedure registerType(eType : uint16; RecvCB : TRecvCallback);
|
procedure registerType(eType : uint16; RecvCB : TRecvCallback);
|
||||||
begin
|
begin
|
||||||
|
register;
|
||||||
if EthTypes[eType] = nil then EthTypes[eType]:= RecvCB;
|
if EthTypes[eType] = nil then EthTypes[eType]:= RecvCB;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure recv(p_data : void; p_len : uint16);
|
procedure recv(p_data : void; p_len : uint16);
|
||||||
var
|
var
|
||||||
src, dst : puint8;
|
Header : PEthernetHeader;
|
||||||
proto_type : uint16;
|
proto_type : uint16;
|
||||||
|
buf : puint8;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
dst:= puint8(p_data);
|
console.outputln('net.eth2', 'RECV.');
|
||||||
src:= puint8(p_data + 6);
|
buf:= puint8(p_data);
|
||||||
|
|
||||||
|
Header:= PEthernetHeader(buf);
|
||||||
|
|
||||||
console.output('net.eth2', 'DEST: ');
|
console.output('net.eth2', 'DEST: ');
|
||||||
writeMACAddress(dst);
|
writeMACAddress(@Header^.dst[0]);
|
||||||
console.output('net.eth2', 'SRC: ');
|
console.output('net.eth2', 'SRC: ');
|
||||||
writeMACAddress(src);
|
writeMACAddress(@Header^.src[0]);
|
||||||
|
|
||||||
|
proto_type:= Header^.EthTypeHi SHL 8;
|
||||||
|
proto_type:= proto_type + Header^.EthTypeLo;
|
||||||
|
console.output('net.eth2', 'PROTO: ');
|
||||||
|
console.writehexln(proto_type);
|
||||||
|
|
||||||
|
buf:= buf + 14;
|
||||||
|
|
||||||
|
if MACEqual(@Header^.dst[0], @Header^.src[0]) or MACEqual(@Header^.dst[0], @BROADCAST_MAC[0]) then begin
|
||||||
|
console.outputln('net.eth2', 'MAC HIT');
|
||||||
|
if EthTypes[proto_type] <> nil then begin
|
||||||
|
EthTypes[proto_type](void(buf), p_len - 14);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure register;
|
procedure register;
|
||||||
|
11
src/driver/net/icmp.pas
Normal file
11
src/driver/net/icmp.pas
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
unit icmp;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
nettypes, netutils,
|
||||||
|
ipv4;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
81
src/driver/net/ipv4.pas
Normal file
81
src/driver/net/ipv4.pas
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
unit ipv4;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
util, console,
|
||||||
|
nettypes, netutils,
|
||||||
|
eth2;
|
||||||
|
|
||||||
|
procedure registerProtocol(Protocol_ID : uint8; recv_callback : TRecvCallback);
|
||||||
|
procedure register;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
var
|
||||||
|
Registered : Boolean = false;
|
||||||
|
Protocols : Array[0..255] of TRecvCallback;
|
||||||
|
|
||||||
|
procedure recv(p_data : void; p_len : uint16);
|
||||||
|
var
|
||||||
|
Header : PIPV4Header;
|
||||||
|
AHeader : TIPV4AbstractHeader;
|
||||||
|
i : Integer;
|
||||||
|
|
||||||
|
buf : puint8;
|
||||||
|
len : uint16;
|
||||||
|
|
||||||
|
begin
|
||||||
|
console.outputln('net.ipv4', 'RECV.');
|
||||||
|
Header:= PIPV4Header(p_data);
|
||||||
|
AHeader.version:= Header^.version;
|
||||||
|
AHeader.header_len:= Header^.header_len;
|
||||||
|
AHeader.ToS:= Header^.ToS;
|
||||||
|
AHeader.total_len:= (Header^.total_len_Hi SHL 8) + Header^.total_len_Lo;
|
||||||
|
AHeader.identifier:= (Header^.identifier_Hi SHL 8) + Header^.identifier_Lo;
|
||||||
|
AHeader.Flags.RS:= false;
|
||||||
|
AHeader.Flags.DF:= (Header^.Flags AND $2) > 0;
|
||||||
|
AHeader.Flags.MF:= (Header^.Flags AND $1) > 0;
|
||||||
|
AHeader.Fragment_Off:= Header^.Fragment_Off;
|
||||||
|
AHeader.TTL:= Header^.TTL;
|
||||||
|
AHeader.Protocol:= Header^.Protocol;
|
||||||
|
AHeader.HDR_CHK:= (Header^.HDR_CHK_Hi SHL 8) + Header^.HDR_CHK_Lo;
|
||||||
|
for i:=0 to 3 do begin
|
||||||
|
AHeader.Src[i]:= Header^.Src[i];
|
||||||
|
AHeader.Dst[i]:= Header^.Dst[i];
|
||||||
|
end;
|
||||||
|
AHeader.Options:= Header^.Options;
|
||||||
|
|
||||||
|
console.output('net.ipv4', 'Source: ');
|
||||||
|
writeIPv4Address(puint8(@AHeader.Src[0]));
|
||||||
|
console.output('net.ipv4', 'Dest: ');
|
||||||
|
writeIPv4Address(puint8(@AHeader.Dst[0]));
|
||||||
|
|
||||||
|
buf:= puint8(p_data);
|
||||||
|
buf:= buf + AHeader.header_len;
|
||||||
|
len:= p_len - AHeader.header_len;
|
||||||
|
|
||||||
|
if Protocols[AHeader.Protocol] <> nil then Protocols[AHeader.Protocol](void(buf), len);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure register;
|
||||||
|
var
|
||||||
|
i : integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not Registered then begin
|
||||||
|
for i:=0 to 255 do begin
|
||||||
|
Protocols[i]:= nil;
|
||||||
|
end;
|
||||||
|
eth2.registerType($0800, @recv);
|
||||||
|
Registered:= true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure registerProtocol(Protocol_ID : uint8; recv_callback : TRecvCallback);
|
||||||
|
begin
|
||||||
|
register;
|
||||||
|
if Protocols[Protocol_ID] = nil then Protocols[Protocol_ID]:= recv_callback;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -3,7 +3,8 @@ unit net;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
nettypes;
|
console,
|
||||||
|
nettypes, netutils;
|
||||||
|
|
||||||
procedure registerNetworkCard(SendCallback : TNetSendCallback; _MAC : puint8);
|
procedure registerNetworkCard(SendCallback : TNetSendCallback; _MAC : puint8);
|
||||||
procedure registerNextLayer(RecvCallback : TRecvCallback);
|
procedure registerNextLayer(RecvCallback : TRecvCallback);
|
||||||
@ -35,12 +36,13 @@ end;
|
|||||||
|
|
||||||
procedure send(p_data : void; p_len : uint16);
|
procedure send(p_data : void; p_len : uint16);
|
||||||
begin
|
begin
|
||||||
CBSend(p_data, p_len);
|
if CBSend <> nil then CBSend(p_data, p_len);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure recv(p_data : void; p_len : uint16);
|
procedure recv(p_data : void; p_len : uint16);
|
||||||
begin
|
begin
|
||||||
CBNext(p_data, p_len);
|
console.outputln('net', 'RECV.');
|
||||||
|
if CBNext <> nil then CBNext(p_data, p_len);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function getMAC : puint8;
|
function getMAC : puint8;
|
||||||
|
@ -2,28 +2,64 @@ unit nettypes;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
|
||||||
console;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TNetSendCallback = function(p_data : void; p_len : uint16) : sint32;
|
TNetSendCallback = function(p_data : void; p_len : uint16) : sint32;
|
||||||
TRecvCallback = procedure(p_data : void; p_len : uint16);
|
TRecvCallback = procedure(p_data : void; p_len : uint16);
|
||||||
|
|
||||||
procedure writeMACAddress(mac : puint8);
|
PEthernetHeader = ^TEthernetHeader;
|
||||||
|
TEthernetHeader = bitpacked record
|
||||||
|
dst : array[0..5] of uint8;
|
||||||
|
src : array[0..5] of uint8;
|
||||||
|
EthTypeHi : uint8;
|
||||||
|
EthTypeLo : uint8;
|
||||||
|
end;
|
||||||
|
|
||||||
|
PIPV4Header = ^TIPV4Header;
|
||||||
|
TIPV4Header = bitpacked record
|
||||||
|
version : ubit4;
|
||||||
|
header_len : ubit4;
|
||||||
|
ToS : uint8;
|
||||||
|
total_len_Hi : uint8;
|
||||||
|
total_len_Lo : uint8;
|
||||||
|
identifier_Hi : uint8;
|
||||||
|
identifier_Lo : uint8;
|
||||||
|
Flags : ubit3;
|
||||||
|
Fragment_Off : ubit13;
|
||||||
|
TTL : uint8;
|
||||||
|
Protocol : uint8;
|
||||||
|
HDR_CHK_Hi : uint8;
|
||||||
|
HDR_CHK_Lo : uint8;
|
||||||
|
Src : Array[0..3] of uint8;
|
||||||
|
Dst : Array[0..3] of uint8;
|
||||||
|
Options : ubit24;
|
||||||
|
Padding : uint8;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TTCPFlags = record
|
||||||
|
RS : Boolean;
|
||||||
|
DF : Boolean;
|
||||||
|
MF : Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TIPV4AbstractHeader = record
|
||||||
|
version : uint8;
|
||||||
|
header_len : uint8;
|
||||||
|
ToS : uint8;
|
||||||
|
total_len : uint16;
|
||||||
|
identifier : uint16;
|
||||||
|
Flags : TTCPFlags;
|
||||||
|
Fragment_Off : uint16;
|
||||||
|
TTL : uint8;
|
||||||
|
Protocol : uint8;
|
||||||
|
HDR_CHK : uint16;
|
||||||
|
Src : Array[0..3] of uint8;
|
||||||
|
Dst : Array[0..3] of uint8;
|
||||||
|
Options : uint32;
|
||||||
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
BROADCAST_MAC : Array[0..5] of uint8 = ($FF, $FF, $FF, $FF, $FF, $FF);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
procedure writeMACAddress(mac : puint8);
|
|
||||||
var
|
|
||||||
i : integer;
|
|
||||||
|
|
||||||
begin
|
|
||||||
console.writehexpair(mac[0]);
|
|
||||||
for i:=1 to 5 do begin
|
|
||||||
console.writestring(':');
|
|
||||||
console.writehexpair(mac[i]);
|
|
||||||
end;
|
|
||||||
console.writestringln(' ');
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
end.
|
54
src/driver/net/netutils.pas
Normal file
54
src/driver/net/netutils.pas
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
unit netutils;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
nettypes, console;
|
||||||
|
|
||||||
|
procedure writeMACAddress(mac : puint8);
|
||||||
|
procedure writeIPv4Address(ip : puint8);
|
||||||
|
function MACEqual(mac1 : puint8; mac2 : puint8) : boolean;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
function MACEqual(mac1 : puint8; mac2 : puint8) : boolean;
|
||||||
|
var
|
||||||
|
i : uint8;
|
||||||
|
|
||||||
|
begin
|
||||||
|
MACEqual:= true;
|
||||||
|
for i:=0 to 5 do begin
|
||||||
|
if mac1[i] <> mac2[i] then begin
|
||||||
|
MACEqual:= false;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writeIPv4Address(ip : puint8);
|
||||||
|
var
|
||||||
|
i : integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
console.writeint(ip[0]);
|
||||||
|
for i:=1 to 3 do begin
|
||||||
|
console.writestring('.');
|
||||||
|
console.writeint(ip[i]);
|
||||||
|
end;
|
||||||
|
console.writestringln(' ');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writeMACAddress(mac : puint8);
|
||||||
|
var
|
||||||
|
i : integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
console.writehexpair(mac[0]);
|
||||||
|
for i:=1 to 5 do begin
|
||||||
|
console.writestring(':');
|
||||||
|
console.writehexpair(mac[i]);
|
||||||
|
end;
|
||||||
|
console.writestringln(' ');
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
11
src/driver/net/tcp.pas
Normal file
11
src/driver/net/tcp.pas
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
unit tcp;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
nettypes, netutils,
|
||||||
|
ipv4;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
11
src/driver/net/udp.pas
Normal file
11
src/driver/net/udp.pas
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
unit udp;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
nettypes, netutils,
|
||||||
|
ipv4;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
@ -14,7 +14,8 @@ uses
|
|||||||
PCI,
|
PCI,
|
||||||
terminal,
|
terminal,
|
||||||
net,
|
net,
|
||||||
nettypes;
|
nettypes,
|
||||||
|
netutils;
|
||||||
|
|
||||||
const
|
const
|
||||||
INTEL_VEND = $8086;
|
INTEL_VEND = $8086;
|
||||||
@ -146,8 +147,10 @@ var
|
|||||||
mac : array[0..5] of uint8;
|
mac : array[0..5] of uint8;
|
||||||
rx_descs : array[0..E1000_NUM_RX_DESC-1] of PE1000_rx_desc;
|
rx_descs : array[0..E1000_NUM_RX_DESC-1] of PE1000_rx_desc;
|
||||||
tx_descs : array[0..E1000_NUM_TX_DESC-1] of PE1000_tx_desc;
|
tx_descs : array[0..E1000_NUM_TX_DESC-1] of PE1000_tx_desc;
|
||||||
|
rx_buffs : array[0..E1000_NUM_RX_DESC-1] of puint8;
|
||||||
rx_curr : uint16;
|
rx_curr : uint16;
|
||||||
tx_curr : uint16;
|
tx_curr : uint16;
|
||||||
|
mem_aloc : boolean = false;
|
||||||
|
|
||||||
procedure writeCommand(p_address : uint16; p_value : uint32);
|
procedure writeCommand(p_address : uint16; p_value : uint32);
|
||||||
var
|
var
|
||||||
@ -269,7 +272,8 @@ begin
|
|||||||
descs:= PE1000_rx_desc(ptr);
|
descs:= PE1000_rx_desc(ptr);
|
||||||
for i:=0 to E1000_NUM_RX_DESC do begin
|
for i:=0 to E1000_NUM_RX_DESC do begin
|
||||||
rx_descs[i]:= @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_buffs[i]:= puint8(kalloc(8192 + 16));
|
||||||
|
rx_descs[i]^.address:= uint64(vtop(uint32(rx_buffs[i])));
|
||||||
rx_descs[i]^.status:= 0;
|
rx_descs[i]^.status:= 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -349,15 +353,15 @@ var
|
|||||||
got_packet : boolean;
|
got_packet : boolean;
|
||||||
buf : puint8;
|
buf : puint8;
|
||||||
len : uint16;
|
len : uint16;
|
||||||
|
i : uint16;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
while (rx_descs[rx_curr]^.status AND $1) > 0 do begin
|
while (rx_descs[rx_curr]^.status AND $1) > 0 do begin
|
||||||
got_packet:= true;
|
got_packet:= true;
|
||||||
buf:= puint8(rx_descs[rx_curr]^.address);
|
buf:= rx_buffs[rx_curr];
|
||||||
len:= rx_descs[rx_curr]^.length;
|
len:= rx_descs[rx_curr]^.length;
|
||||||
|
|
||||||
//Inject Packet into Network Stack
|
//Inject Packet into Network Stack
|
||||||
kpalloc(uint32(buf));
|
|
||||||
net.recv(void(buf), len);
|
net.recv(void(buf), len);
|
||||||
|
|
||||||
rx_descs[rx_curr]^.status:= 0;
|
rx_descs[rx_curr]^.status:= 0;
|
||||||
@ -384,6 +388,8 @@ var
|
|||||||
data : uint32;
|
data : uint32;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
console.outputln('E1000 Driver', 'FIRED.');
|
||||||
|
|
||||||
status:= readCommand($C0);
|
status:= readCommand($C0);
|
||||||
//console.output('E1000 Driver', 'Int Status: ');
|
//console.output('E1000 Driver', 'Int Status: ');
|
||||||
//console.writehexln(status);
|
//console.writehexln(status);
|
||||||
|
@ -37,7 +37,7 @@ uses
|
|||||||
E1000,
|
E1000,
|
||||||
AHCI_OLD,
|
AHCI_OLD,
|
||||||
IDE,
|
IDE,
|
||||||
storagemanagement;
|
ipv4;
|
||||||
|
|
||||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
||||||
|
|
||||||
@ -95,7 +95,6 @@ begin
|
|||||||
terminal.registerCommand('BSOD', @terminal_command_bsod, 'Force a Panic Screen.');
|
terminal.registerCommand('BSOD', @terminal_command_bsod, 'Force a Panic Screen.');
|
||||||
|
|
||||||
drivermanagement.init();
|
drivermanagement.init();
|
||||||
storagemanagement.init();
|
|
||||||
|
|
||||||
console.init();
|
console.init();
|
||||||
|
|
||||||
@ -142,12 +141,14 @@ begin
|
|||||||
testdriver.init();
|
testdriver.init();
|
||||||
E1000.init();
|
E1000.init();
|
||||||
//AHCI_OLD.init();
|
//AHCI_OLD.init();
|
||||||
IDE.init();
|
//IDE.init();
|
||||||
//Nothing beyond here
|
//Nothing beyond here
|
||||||
USB.init();
|
USB.init();
|
||||||
pci.init();
|
pci.init();
|
||||||
console.outputln('KERNEL', 'DRIVERS: INIT END.');
|
console.outputln('KERNEL', 'DRIVERS: INIT END.');
|
||||||
|
|
||||||
|
ipv4.register();
|
||||||
|
|
||||||
console.writestringln('');
|
console.writestringln('');
|
||||||
console.setdefaultattribute(console.combinecolors(Green, Black));
|
console.setdefaultattribute(console.combinecolors(Green, Black));
|
||||||
console.writestringln('Asuro Booted Correctly!');
|
console.writestringln('Asuro Booted Correctly!');
|
||||||
|
@ -55,19 +55,35 @@ type
|
|||||||
Void = ^uInt32;
|
Void = ^uInt32;
|
||||||
|
|
||||||
//Alternate Types
|
//Alternate Types
|
||||||
UBit2 = 0..(1 shl 2) - 1;
|
UBit1 = 0..(1 shl 01) - 1;
|
||||||
UBit3 = 0..(1 shl 3) - 1;
|
UBit2 = 0..(1 shl 02) - 1;
|
||||||
UBit4 = 0..(1 shl 4) - 1;
|
UBit3 = 0..(1 shl 03) - 1;
|
||||||
UBit5 = 0..(1 shl 5) - 1;
|
UBit4 = 0..(1 shl 04) - 1;
|
||||||
UBit6 = 0..(1 shl 6) - 1;
|
UBit5 = 0..(1 shl 05) - 1;
|
||||||
UBit7 = 0..(1 shl 7) - 1;
|
UBit6 = 0..(1 shl 06) - 1;
|
||||||
UBit9 = 0..(1 shl 9) - 1;
|
UBit7 = 0..(1 shl 07) - 1;
|
||||||
|
UBit9 = 0..(1 shl 09) - 1;
|
||||||
|
UBit10 = 0..(1 shl 10) - 1;
|
||||||
|
UBit11 = 0..(1 shl 11) - 1;
|
||||||
|
UBit12 = 0..(1 shl 12) - 1;
|
||||||
|
UBit13 = 0..(1 shl 13) - 1;
|
||||||
|
UBit14 = 0..(1 shl 14) - 1;
|
||||||
|
UBit15 = 0..(1 shl 15) - 1;
|
||||||
|
UBit16 = 0..(1 shl 16) - 1;
|
||||||
UBit17 = 0..(1 shl 17) - 1;
|
UBit17 = 0..(1 shl 17) - 1;
|
||||||
|
UBit18 = 0..(1 shl 18) - 1;
|
||||||
|
UBit19 = 0..(1 shl 19) - 1;
|
||||||
UBit20 = 0..(1 shl 20) - 1;
|
UBit20 = 0..(1 shl 20) - 1;
|
||||||
|
UBit21 = 0..(1 shl 21) - 1;
|
||||||
UBit22 = 0..(1 shl 22) - 1;
|
UBit22 = 0..(1 shl 22) - 1;
|
||||||
|
UBit23 = 0..(1 shl 23) - 1;
|
||||||
|
UBit24 = 0..(1 shl 24) - 1;
|
||||||
UBit25 = 0..(1 shl 25) - 1;
|
UBit25 = 0..(1 shl 25) - 1;
|
||||||
|
UBit26 = 0..(1 shl 26) - 1;
|
||||||
|
UBit27 = 0..(1 shl 27) - 1;
|
||||||
UBit28 = 0..(1 shl 28) - 1;
|
UBit28 = 0..(1 shl 28) - 1;
|
||||||
UBit30 = 0..(1 shl 30) - 1;
|
UBit30 = 0..(1 shl 30) - 1;
|
||||||
|
UBit31 = 0..(1 shl 31) - 1;
|
||||||
|
|
||||||
TBitMask = bitpacked record
|
TBitMask = bitpacked record
|
||||||
b0,b1,b2,b3,b4,b5,b6,b7 : Boolean;
|
b0,b1,b2,b3,b4,b5,b6,b7 : Boolean;
|
||||||
|
28
src/util.pas
28
src/util.pas
@ -36,6 +36,8 @@ function inl(port : uint16) : uint32;
|
|||||||
procedure memset(location : uint32; value : uint8; size : uint32);
|
procedure memset(location : uint32; value : uint8; size : uint32);
|
||||||
procedure memcpy(source : uint32; dest : uint32; size : uint32);
|
procedure memcpy(source : uint32; dest : uint32; size : uint32);
|
||||||
|
|
||||||
|
procedure printmemory(source : uint32; length : uint32; col : uint32; delim : PChar; offset_row : boolean);
|
||||||
|
|
||||||
procedure halt_and_catch_fire();
|
procedure halt_and_catch_fire();
|
||||||
procedure halt_and_dont_catch_fire();
|
procedure halt_and_dont_catch_fire();
|
||||||
procedure BSOD(fault : pchar; info : pchar);
|
procedure BSOD(fault : pchar; info : pchar);
|
||||||
@ -50,6 +52,32 @@ implementation
|
|||||||
uses
|
uses
|
||||||
console;
|
console;
|
||||||
|
|
||||||
|
procedure printmemory(source : uint32; length : uint32; col : uint32; delim : PChar; offset_row : boolean);
|
||||||
|
var
|
||||||
|
buf : puint8;
|
||||||
|
i : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
buf:= puint8(source);
|
||||||
|
for i:=0 to length do begin
|
||||||
|
if offset_row and (i = 0) then begin
|
||||||
|
console.writehex(source + (i * col));
|
||||||
|
console.writestring(': ');
|
||||||
|
end;
|
||||||
|
console.writehexpair(buf[i]);
|
||||||
|
if ((i+1) MOD col) = 0 then begin
|
||||||
|
console.writestringln(' ');
|
||||||
|
if offset_row then begin
|
||||||
|
console.writehex(source + (i * col));
|
||||||
|
console.writestring(': ');
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
console.writestring(delim);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
console.writestringln(' ');
|
||||||
|
end;
|
||||||
|
|
||||||
function hi(b : uint8) : uint8; [public, alias: 'util_hi'];
|
function hi(b : uint8) : uint8; [public, alias: 'util_hi'];
|
||||||
begin
|
begin
|
||||||
hi:= (b AND $F0) SHR 4;
|
hi:= (b AND $F0) SHR 4;
|
||||||
|
@ -94,9 +94,9 @@ begin
|
|||||||
console.outputln('VMM','INIT BEGIN.');
|
console.outputln('VMM','INIT BEGIN.');
|
||||||
PageDirectory:= load_current_page_directory;
|
PageDirectory:= load_current_page_directory;
|
||||||
KERNEL_PAGE_DIRECTORY:= PageDirectory;
|
KERNEL_PAGE_DIRECTORY:= PageDirectory;
|
||||||
|
map_page(KERNEL_PAGE_NUMBER + 0, 0);
|
||||||
map_page(KERNEL_PAGE_NUMBER + 1, 1);
|
map_page(KERNEL_PAGE_NUMBER + 1, 1);
|
||||||
map_page(KERNEL_PAGE_NUMBER + 2, 2);
|
map_page(KERNEL_PAGE_NUMBER + 2, 2);
|
||||||
map_page(KERNEL_PAGE_NUMBER + 3, 3);
|
|
||||||
console.outputln('VMM','INIT END.');
|
console.outputln('VMM','INIT END.');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user