git-svn-id: https://spexeah.com:8443/svn/Asuro@744 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
a7c568b06a
commit
17f41d9794
BIN
bin/kernel.bin
BIN
bin/kernel.bin
Binary file not shown.
@ -94,3 +94,5 @@ fi
|
|||||||
echo " "
|
echo " "
|
||||||
echo "======================="
|
echo "======================="
|
||||||
echo " "
|
echo " "
|
||||||
|
|
||||||
|
cp Asuro.iso ~/host/Asuro.iso
|
||||||
|
Binary file not shown.
BIN
lib/E1000.ppu
BIN
lib/E1000.ppu
Binary file not shown.
BIN
lib/arp.ppu
BIN
lib/arp.ppu
Binary file not shown.
BIN
lib/asuro.ppu
BIN
lib/asuro.ppu
Binary file not shown.
BIN
lib/eth2.ppu
BIN
lib/eth2.ppu
Binary file not shown.
BIN
lib/ipv4.ppu
BIN
lib/ipv4.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.
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
BIN
lib/netutils.ppu
Binary file not shown.
BIN
lib/shell.ppu
BIN
lib/shell.ppu
Binary file not shown.
BIN
lib/terminal.ppu
BIN
lib/terminal.ppu
Binary file not shown.
@ -102,8 +102,8 @@ type
|
|||||||
|
|
||||||
PIPV4Header = ^TIPV4Header;
|
PIPV4Header = ^TIPV4Header;
|
||||||
TIPV4Header = bitpacked record
|
TIPV4Header = bitpacked record
|
||||||
version : ubit4;
|
|
||||||
header_len : ubit4;
|
header_len : ubit4;
|
||||||
|
version : ubit4;
|
||||||
ToS : uint8;
|
ToS : uint8;
|
||||||
total_len_Hi : uint8;
|
total_len_Hi : uint8;
|
||||||
total_len_Lo : uint8;
|
total_len_Lo : uint8;
|
||||||
|
@ -70,17 +70,20 @@ var
|
|||||||
begin
|
begin
|
||||||
dat:= p_data;
|
dat:= p_data;
|
||||||
sum:= 0;
|
sum:= 0;
|
||||||
l:= p_len div 2;
|
l:= p_len;
|
||||||
for i:=1 to l do begin
|
|
||||||
sum:= sum + p_data^;
|
while l > 1 do begin
|
||||||
inc(p_data);
|
sum:= sum + dat^;
|
||||||
|
inc(dat);
|
||||||
|
l:= l - 2;
|
||||||
end;
|
end;
|
||||||
while (sum > $FFFF) do begin
|
if l > 0 then sum:= sum + puint8(dat)^;
|
||||||
carry:= (sum AND $FFFF0000) SHR 16;
|
|
||||||
sum:= (sum AND $FFFF);
|
while (sum AND $FFFF0000) > 0 do begin
|
||||||
sum:= sum + carry;
|
sum:= (sum AND $FFFF) + (sum SHR 16);
|
||||||
end;
|
end;
|
||||||
calculateChecksum:= not (sum AND $FFFF);
|
|
||||||
|
calculateChecksum:= not(sum);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function verifyChecksum(p_data : puint16; p_len : uint16) : boolean;
|
function verifyChecksum(p_data : puint16; p_len : uint16) : boolean;
|
||||||
|
@ -83,7 +83,7 @@ end;
|
|||||||
procedure send(p_data : void; p_len : uint16);
|
procedure send(p_data : void; p_len : uint16);
|
||||||
begin
|
begin
|
||||||
push_trace('net.send');
|
push_trace('net.send');
|
||||||
//writeToLogLn('L1: net.send');
|
writeToLogLn('L1: net.send');
|
||||||
if CBSend <> nil then CBSend(p_data, p_len);
|
if CBSend <> nil then CBSend(p_data, p_len);
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
@ -94,7 +94,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('net.recv');
|
push_trace('net.recv');
|
||||||
//writeToLogLn('L1: net.recv');
|
writeToLogLn('L1: net.recv');
|
||||||
context:= newPacketContext;
|
context:= newPacketContext;
|
||||||
if CBNext <> nil then CBNext(p_data, p_len, context);
|
if CBNext <> nil then CBNext(p_data, p_len, context);
|
||||||
freePacketContext(context);
|
freePacketContext(context);
|
||||||
|
@ -54,7 +54,7 @@ begin
|
|||||||
pad:= 46 - p_len;
|
pad:= 46 - p_len;
|
||||||
if pad < 0 then pad:= 0;
|
if pad < 0 then pad:= 0;
|
||||||
push_trace('eth2.send');
|
push_trace('eth2.send');
|
||||||
//writeToLogLn(' L2: eth2.send');
|
writeToLogLn(' L2: eth2.send');
|
||||||
if p_context <> nil then begin
|
if p_context <> nil then begin
|
||||||
size:= sizeof(TEthernetHeader) + p_len + pad;// + 4;
|
size:= sizeof(TEthernetHeader) + p_len + pad;// + 4;
|
||||||
buffer:= kalloc(size);
|
buffer:= kalloc(size);
|
||||||
@ -79,7 +79,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('eth2.recv');
|
push_trace('eth2.recv');
|
||||||
//writeToLogLn(' L2: eth2.recv');
|
writeToLogLn(' L2: eth2.recv');
|
||||||
buf:= puint8(p_data);
|
buf:= puint8(p_data);
|
||||||
|
|
||||||
Header:= PEthernetHeader(buf);
|
Header:= PEthernetHeader(buf);
|
||||||
|
@ -181,7 +181,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('arp.recv');
|
push_trace('arp.recv');
|
||||||
//writeToLogLn(' L3: arp.recv');
|
writeToLogLn(' L3: arp.recv');
|
||||||
console.redrawWindows;
|
console.redrawWindows;
|
||||||
|
|
||||||
{ Get our converted Header }
|
{ Get our converted Header }
|
||||||
@ -210,7 +210,7 @@ begin
|
|||||||
if IPEqual(@AHeader.Destination_Protocol[0], @getIPv4Config^.Address[0]) then begin
|
if IPEqual(@AHeader.Destination_Protocol[0], @getIPv4Config^.Address[0]) then begin
|
||||||
case AHeader.Operation of
|
case AHeader.Operation of
|
||||||
$1:begin { ARP Request }
|
$1:begin { ARP Request }
|
||||||
//writeToLogLn(' arp.recv.arp.req');
|
writeToLogLn(' arp.recv.arp.req');
|
||||||
context:= newPacketContext;
|
context:= newPacketContext;
|
||||||
copyMAC(@AHeader.Source_Hardware[0], @context^.MAC.Destination[0]);
|
copyMAC(@AHeader.Source_Hardware[0], @context^.MAC.Destination[0]);
|
||||||
copyIPv4(@AHeader.Source_Protocol[0], @context^.IP.Destination[0]);
|
copyIPv4(@AHeader.Source_Protocol[0], @context^.IP.Destination[0]);
|
||||||
@ -220,28 +220,28 @@ begin
|
|||||||
freePacketContext(context);
|
freePacketContext(context);
|
||||||
end;
|
end;
|
||||||
$2:begin { ARP Reply }
|
$2:begin { ARP Reply }
|
||||||
//writeToLogLn(' arp.recv.arp.rep');
|
writeToLogLn(' arp.recv.arp.rep');
|
||||||
end;
|
end;
|
||||||
$3:begin { RARP Request }
|
$3:begin { RARP Request }
|
||||||
//writeToLogLn(' arp.recv.rarp.req');
|
writeToLogLn(' arp.recv.rarp.req');
|
||||||
end;
|
end;
|
||||||
$4:begin { RARP Reply }
|
$4:begin { RARP Reply }
|
||||||
//writeToLogLn(' arp.recv.rarp.rep');
|
writeToLogLn(' arp.recv.rarp.rep');
|
||||||
end;
|
end;
|
||||||
$5:begin { DRARP Request }
|
$5:begin { DRARP Request }
|
||||||
//writeToLogLn(' arp.recv.drarp.req');
|
writeToLogLn(' arp.recv.drarp.req');
|
||||||
end;
|
end;
|
||||||
$6:begin { DRARP Reply }
|
$6:begin { DRARP Reply }
|
||||||
//writeToLogLn(' arp.recv.drarp.rep');
|
writeToLogLn(' arp.recv.drarp.rep');
|
||||||
end;
|
end;
|
||||||
$7:begin { DRARP Error }
|
$7:begin { DRARP Error }
|
||||||
//writeToLogLn(' arp.recv.drarp.err');
|
writeToLogLn(' arp.recv.drarp.err');
|
||||||
end;
|
end;
|
||||||
$8:begin { InARP Request }
|
$8:begin { InARP Request }
|
||||||
//writeToLogLn(' arp.recv.inarp.req');
|
writeToLogLn(' arp.recv.inarp.req');
|
||||||
end;
|
end;
|
||||||
$9:begin { InARP Reply }
|
$9:begin { InARP Reply }
|
||||||
//writeToLogLn(' arp.recv.inarp.rep');
|
writeToLogLn(' arp.recv.inarp.rep');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -39,7 +39,7 @@ var
|
|||||||
buffer : void;
|
buffer : void;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
//writeToLogLn(' L3: ipv4.send');
|
writeToLogLn(' L3: ipv4.send');
|
||||||
inc(CurrentID);
|
inc(CurrentID);
|
||||||
Header.version:= 4;
|
Header.version:= 4;
|
||||||
Header.header_len:= 5;
|
Header.header_len:= 5;
|
||||||
@ -60,8 +60,8 @@ begin
|
|||||||
Header.Options:= 0;
|
Header.Options:= 0;
|
||||||
Header.Padding:= 0;
|
Header.Padding:= 0;
|
||||||
CHK:= calculateChecksum(puint16(@Header), sizeof(TIPV4Header));
|
CHK:= calculateChecksum(puint16(@Header), sizeof(TIPV4Header));
|
||||||
Header.HDR_CHK_Hi:= CHK SHR 8;
|
Header.HDR_CHK_Hi:= CHK AND $FF;//CHK SHR 8;
|
||||||
Header.HDR_CHK_Lo:= CHK AND $FF;
|
Header.HDR_CHK_Lo:= CHK SHR 8;//CHK AND $FF;
|
||||||
Buffer:= kalloc(Len);
|
Buffer:= kalloc(Len);
|
||||||
memcpy(uint32(@Header), uint32(Buffer), Header.header_len * 4);
|
memcpy(uint32(@Header), uint32(Buffer), Header.header_len * 4);
|
||||||
memcpy(uint32(p_data), uint32(Buffer) + (Header.header_len * 4), p_len);
|
memcpy(uint32(p_data), uint32(Buffer) + (Header.header_len * 4), p_len);
|
||||||
@ -79,7 +79,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('ipv4.recv');
|
push_trace('ipv4.recv');
|
||||||
//writeToLogLn(' L3: ipv4.recv');
|
writeToLogLn(' L3: ipv4.recv');
|
||||||
Header:= PIPV4Header(p_data);
|
Header:= PIPV4Header(p_data);
|
||||||
AHeader.version:= Header^.version;
|
AHeader.version:= Header^.version;
|
||||||
AHeader.header_len:= Header^.header_len;
|
AHeader.header_len:= Header^.header_len;
|
||||||
@ -108,7 +108,9 @@ begin
|
|||||||
|
|
||||||
if Config.UP then begin
|
if Config.UP then begin
|
||||||
if (IPEqual(@Config.Address[0], @AHeader.Dst[0])) OR (AHeader.Dst[3] = 255) then begin
|
if (IPEqual(@Config.Address[0], @AHeader.Dst[0])) OR (AHeader.Dst[3] = 255) then begin
|
||||||
if Protocols[AHeader.Protocol] <> nil then Protocols[AHeader.Protocol](void(buf), len, p_context);
|
if Protocols[AHeader.Protocol] <> nil then begin
|
||||||
|
Protocols[AHeader.Protocol](void(buf), len, p_context);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
pop_trace;
|
pop_trace;
|
||||||
|
@ -3,7 +3,7 @@ unit icmp;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
net, nettypes, netutils, ipv4, console;
|
net, nettypes, netutils, ipv4, console, terminal;
|
||||||
|
|
||||||
procedure register;
|
procedure register;
|
||||||
|
|
||||||
@ -27,21 +27,24 @@ var
|
|||||||
begin
|
begin
|
||||||
writeToLogLn(' L4: icmp.recv');
|
writeToLogLn(' L4: icmp.recv');
|
||||||
Header:= PICMPHeader(p_data);
|
Header:= PICMPHeader(p_data);
|
||||||
|
//writehexlnWND(Header^.ICMP_Type, getTerminalHWND);
|
||||||
case Header^.ICMP_Type of
|
case Header^.ICMP_Type of
|
||||||
$08:Begin //Request
|
$08:Begin //Request
|
||||||
|
writeToLogLn(' L4: icmp.request');
|
||||||
contextMACSwitch(p_context);
|
contextMACSwitch(p_context);
|
||||||
contextIPv4Switch(p_context);
|
contextIPv4Switch(p_context);
|
||||||
Header^.ICMP_Type:= 0;
|
Header^.ICMP_Type:= 0;
|
||||||
Header^.ICMP_CHK_Hi:= 0;
|
Header^.ICMP_CHK_Hi:= 0;
|
||||||
Header^.ICMP_CHK_Lo:= 0;
|
Header^.ICMP_CHK_Lo:= 0;
|
||||||
CHK:= calculateChecksum(puint16(p_data), sizeof(TICMPHeader));
|
CHK:= calculateChecksum(puint16(p_data), p_len);
|
||||||
Header^.ICMP_CHK_Hi:= CHK SHR 8;
|
Header^.ICMP_CHK_Hi:= CHK AND $FF;
|
||||||
Header^.ICMP_CHK_Lo:= CHK AND $FF;
|
Header^.ICMP_CHK_Lo:= CHK SHR 8;
|
||||||
p_context^.Protocol.L4:= $01;
|
p_context^.Protocol.L4:= $01;
|
||||||
|
p_context^.TTL:= 128;
|
||||||
ipv4.send(p_data, p_len, p_context);
|
ipv4.send(p_data, p_len, p_context);
|
||||||
end;
|
end;
|
||||||
$00:begin //Reply
|
$00:begin //Reply
|
||||||
|
writeToLogLn(' L4: icmp.reply');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -417,7 +417,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('E1000.fire');
|
push_trace('E1000.fire');
|
||||||
//writeToLogLn('L0: E1000 Fire');
|
writeToLogLn('L0: E1000 Fire');
|
||||||
status:= readCommand($C0);
|
status:= readCommand($C0);
|
||||||
if (status AND $04) > 0 then begin
|
if (status AND $04) > 0 then begin
|
||||||
startLink();
|
startLink();
|
||||||
|
@ -9,14 +9,14 @@ const
|
|||||||
VERSION_SUB = '1';
|
VERSION_SUB = '1';
|
||||||
REVISION = '728';
|
REVISION = '728';
|
||||||
RELEASE = 'ia';
|
RELEASE = 'ia';
|
||||||
LINE_COUNT = 28519;
|
LINE_COUNT = 28522;
|
||||||
FILE_COUNT = 90;
|
FILE_COUNT = 90;
|
||||||
DRIVER_COUNT = 32;
|
DRIVER_COUNT = 32;
|
||||||
FPC_VERSION = '2.6.4';
|
FPC_VERSION = '2.6.4';
|
||||||
NASM_VERSION = '2.10.09';
|
NASM_VERSION = '2.10.09';
|
||||||
MAKE_VERSION = '3.81';
|
MAKE_VERSION = '3.81';
|
||||||
COMPILE_DATE = '13/05/18';
|
COMPILE_DATE = '13/05/18';
|
||||||
COMPILE_TIME = '15:24:12';
|
COMPILE_TIME = '16:34:39';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -509,19 +509,14 @@ end;
|
|||||||
|
|
||||||
procedure teapot(Params : PParamList);
|
procedure teapot(Params : PParamList);
|
||||||
var
|
var
|
||||||
ip1, ip2, ip3 : pchar;
|
packet : array[0..39] of uint8 = ( $00, $00, $00, $00, $00, $01, $00, $f3, $61, $62, $63, $64, $65, $66, $67, $68,
|
||||||
|
$69, $6a, $6b, $6c, $6d, $6e, $6f, $70, $71, $72, $73, $74, $75, $76, $77, $61,
|
||||||
|
$62, $63, $64, $65, $66, $67, $68, $69);
|
||||||
|
CHK : uint16;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if paramCount(Params) > 2 then begin
|
CHK:= calculateChecksum(puint16(@packet[0]), 40);
|
||||||
ip1:= getParam(0, Params);
|
writehexlnWND(CHK, getTerminalHWND);
|
||||||
ip2:= getParam(1, Params);
|
|
||||||
ip3:= getParam(2, Params);
|
|
||||||
if sameSubnetIPv4(stringToIPv4(ip1), stringToIPv4(ip2), stringToIPv4(ip3)) then begin
|
|
||||||
console.writeStringlnWND('Same.', getTerminalHWND);
|
|
||||||
end else begin
|
|
||||||
console.writeStringlnWND('Different', getTerminalHWND);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
terminal.halt(555, @teapot_halt);
|
terminal.halt(555, @teapot_halt);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user