git-svn-id: https://spexeah.com:8443/svn/Asuro@677 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c

This commit is contained in:
kieron 2018-05-10 07:39:07 +00:00
parent 3bdba1d786
commit fabe8bd6eb
74 changed files with 135 additions and 36 deletions

BIN
Asuro.iso

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/netlog.ppu Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -5,7 +5,8 @@ interface
uses uses
tracer, tracer,
console, console,
nettypes, netutils; nettypes, netutils,
netlog;
procedure init; procedure init;
procedure registerNetworkCard(SendCallback : TNetSendCallback; _MAC : puint8); procedure registerNetworkCard(SendCallback : TNetSendCallback; _MAC : puint8);
@ -46,6 +47,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');
if getNetlogHWND <> 0 then writestringlnWND('net.send', getNetlogHWND);
if CBSend <> nil then CBSend(p_data, p_len); if CBSend <> nil then CBSend(p_data, p_len);
pop_trace; pop_trace;
end; end;
@ -56,7 +58,7 @@ var
begin begin
push_trace('net.recv'); push_trace('net.recv');
//console.outputln('net', 'RECV.'); if getNetlogHWND <> 0 then writestringlnWND('net.recv', getNetlogHWND);
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);

View File

@ -6,6 +6,7 @@ uses
tracer, tracer,
nettypes, netutils, nettypes, netutils,
net, net,
netlog,
console; console;
procedure registerType(eType : uint16; RecvCB : TRecvCallback); procedure registerType(eType : uint16; RecvCB : TRecvCallback);
@ -34,6 +35,7 @@ var
begin begin
push_trace('eth2.recv'); push_trace('eth2.recv');
if getNetlogHWND <> 0 then writestringlnWND('eth2.recv', getNetlogHWND);
//console.outputln('net.eth2', 'RECV.'); //console.outputln('net.eth2', 'RECV.');
buf:= puint8(p_data); buf:= puint8(p_data);

View File

@ -6,6 +6,7 @@ uses
tracer, tracer,
util, lists, console, util, lists, console,
nettypes, netutils, nettypes, netutils,
netlog,
eth2; eth2;
type type
@ -69,6 +70,7 @@ var
begin begin
push_trace('arp.recv'); push_trace('arp.recv');
if getNetlogHWND <> 0 then writestringlnWND('arp.recv', getNetlogHWND);
{ Get our converted Header } { Get our converted Header }
Header:= PARPHeader(p_data); Header:= PARPHeader(p_data);
AHeader.Hardware_Type:= (Header^.Hardware_Type_Hi SHL 8) + Header^.Hardware_Type_Lo; AHeader.Hardware_Type:= (Header^.Hardware_Type_Hi SHL 8) + Header^.Hardware_Type_Lo;
@ -80,34 +82,33 @@ begin
copyIPv4(@Header^.Source_Protocol[0], @AHeader.Source_Protocol[0]); copyIPv4(@Header^.Source_Protocol[0], @AHeader.Source_Protocol[0]);
copyMAC(@Header^.Destination_Hardware[0], @AHeader.Destination_Hardware[0]); copyMAC(@Header^.Destination_Hardware[0], @AHeader.Destination_Hardware[0]);
copyIPv4(@Header^.Destination_Protocol[0], @AHeader.Destination_Protocol[0]); copyIPv4(@Header^.Destination_Protocol[0], @AHeader.Destination_Protocol[0]);
case AHeader.Operation of case AHeader.Operation of
$1:begin { ARP Request } $1:begin { ARP Request }
//console.writestringln('ARP Request.'); if getNetlogHWND <> 0 then writestringlnWND('arp.recv.arp.req', getNetlogHWND);
end; end;
$2:begin { ARP Reply } $2:begin { ARP Reply }
//console.writestringln('ARP Reply.'); if getNetlogHWND <> 0 then writestringlnWND('arp.recv.arp.rep', getNetlogHWND);
end; end;
$3:begin { RARP Request } $3:begin { RARP Request }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.rarp.req', getNetlogHWND);
end; end;
$4:begin { RARP Reply } $4:begin { RARP Reply }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.rarp.rep', getNetlogHWND);
end; end;
$5:begin { DRARP Request } $5:begin { DRARP Request }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.drarp.req', getNetlogHWND);
end; end;
$6:begin { DRARP Reply } $6:begin { DRARP Reply }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.drarp.rep', getNetlogHWND);
end; end;
$7:begin { DRARP Error } $7:begin { DRARP Error }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.drarp.err', getNetlogHWND);
end; end;
$8:begin { InARP Request } $8:begin { InARP Request }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.inarp.req', getNetlogHWND);
end; end;
$9:begin { InARP Reply } $9:begin { InARP Reply }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.inarp.rep', getNetlogHWND);
end; end;
end; end;
pop_trace; pop_trace;

View File

@ -6,6 +6,7 @@ uses
tracer, tracer,
util, console, terminal, util, console, terminal,
net, nettypes, netutils, net, nettypes, netutils,
netlog,
eth2; eth2;
procedure registerProtocol(Protocol_ID : uint8; recv_callback : TRecvCallback); procedure registerProtocol(Protocol_ID : uint8; recv_callback : TRecvCallback);
@ -28,7 +29,7 @@ var
begin begin
push_trace('ipv4.recv'); push_trace('ipv4.recv');
//console.outputln('net.ipv4', 'RECV.'); if getNetlogHWND <> 0 then writestringlnWND('ipv4.recv', getNetlogHWND);
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;

View File

@ -3,20 +3,20 @@ unit asuro;
interface interface
const const
VERSION = '1.0.1-672ia'; VERSION = '1.0.1-674ia';
VERSION_MAJOR = '1'; VERSION_MAJOR = '1';
VERSION_MINOR = '0'; VERSION_MINOR = '0';
VERSION_SUB = '1'; VERSION_SUB = '1';
REVISION = '672'; REVISION = '674';
RELEASE = 'ia'; RELEASE = 'ia';
LINE_COUNT = 28180; LINE_COUNT = 27628;
FILE_COUNT = 90; FILE_COUNT = 89;
DRIVER_COUNT = 34; 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 = '08/05/18'; COMPILE_DATE = '10/05/18';
COMPILE_TIME = '10:05:48'; COMPILE_TIME = '08:36:31';
implementation implementation

View File

@ -58,6 +58,8 @@ function HexCharToDecimal(hex : char) : uint8;
procedure resetSystem(); procedure resetSystem();
function getESP : uint32;
var var
endptr : uint32; external name '__end'; endptr : uint32; external name '__end';
stack : uint32; external name 'KERNEL_STACK'; stack : uint32; external name 'KERNEL_STACK';
@ -67,6 +69,13 @@ implementation
uses uses
console, RTC, cpu; console, RTC, cpu;
function getESP : uint32;
begin
asm
MOV getESP, ESP
end;
end;
function HexCharToDecimal(hex : char) : uint8; function HexCharToDecimal(hex : char) : uint8;
begin begin
case hex of case hex of

View File

@ -42,7 +42,8 @@ uses
memview, memview,
splash, splash,
cpu, cpu,
themer; themer,
netlog;
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
@ -202,6 +203,7 @@ begin
shell.init(); shell.init();
memview.init(); memview.init();
themer.init(); themer.init();
netlog.init();
{ Init Splash } { Init Splash }
splash.init(); splash.init();

View File

@ -3,17 +3,14 @@ unit memview;
interface interface
uses uses
console, terminal, keyboard; console, terminal, keyboard, util, strings, tracer;
procedure init(); procedure init();
implementation implementation
uses
strings, tracer;
type type
TMode = (tmHex, tmChar); TMode = (tmHex, tmChar, tmStackHex, tmStackChar);
var var
Handle : HWND = 0; Handle : HWND = 0;
@ -39,7 +36,12 @@ begin
end; end;
end; end;
console.writestringlnExWND(' ', Colors, Handle); console.writestringlnExWND(' ', Colors, Handle);
console.writestringlnExWND(' ', Colors, Handle); //console.writestringlnExWND(' ', Colors, Handle);
console.writestringExWND(' Mode: ', Colors, Handle);
case mode of
tmChar:console.writestringlnExWND('Memory', Colors, Handle);
tmStackChar:console.writestringlnExWND('Stack', Colors, Handle);
end;
for i:=0 to length-1 do begin for i:=0 to length-1 do begin
if offset_row and (i = 0) then begin if offset_row and (i = 0) then begin
console.writestringExWND(' ', Colors, Handle); console.writestringExWND(' ', Colors, Handle);
@ -61,7 +63,10 @@ begin
end; end;
end; end;
end; end;
//console.writestringlnExWND(' ', Colors, Handle);
console.writestringlnExWND(' ', Colors, Handle); console.writestringlnExWND(' ', Colors, Handle);
console.writestringExWND(' Display: ', Colors, Handle);
console.writestringExWND('ASCII', Colors, Handle);
end; end;
procedure printmemoryashex(source : uint32; length : uint32; col : uint32; delim : PChar; offset_row : boolean); procedure printmemoryashex(source : uint32; length : uint32; col : uint32; delim : PChar; offset_row : boolean);
@ -79,7 +84,12 @@ begin
end; end;
end; end;
console.writestringlnExWND(' ', Colors, Handle); console.writestringlnExWND(' ', Colors, Handle);
console.writestringlnExWND(' ', Colors, Handle); //console.writestringlnExWND(' ', Colors, Handle);
console.writestringExWND(' Mode: ', Colors, Handle);
case mode of
tmHex:console.writestringlnExWND('Memory', Colors, Handle);
tmStackHex:console.writestringlnExWND('Stack', Colors, Handle);
end;
for i:=0 to length-1 do begin for i:=0 to length-1 do begin
if offset_row and (i = 0) then begin if offset_row and (i = 0) then begin
console.writestringExWND(' ', Colors, Handle); console.writestringExWND(' ', Colors, Handle);
@ -101,6 +111,9 @@ begin
end; end;
end; end;
console.writestringlnExWND(' ', Colors, Handle); console.writestringlnExWND(' ', Colors, Handle);
console.writestringExWND(' Display: ', Colors, Handle);
console.writestringExWND('Hex', Colors, Handle);
//console.writestringlnExWND(' ', Colors, Handle);
end; end;
procedure OnClose(); procedure OnClose();
@ -116,36 +129,66 @@ begin
case mode of case mode of
tmHex:printmemoryashex(MEM_LOC, 176, 16, ' ', true); tmHex:printmemoryashex(MEM_LOC, 176, 16, ' ', true);
tmChar:printmemoryaschar(MEM_LOC, 176, 16, ' ', true); tmChar:printmemoryaschar(MEM_LOC, 176, 16, ' ', true);
tmStackHex:printmemoryashex(MEM_LOC, 44, 4, ' ', true);
tmStackChar:printmemoryaschar(MEM_LOC, 44, 4, ' ', true);
end; end;
end; end;
end; end;
procedure OnKeyPressed(info : TKeyInfo); procedure OnKeyPressed(info : TKeyInfo);
var
line : uint32;
window : uint32;
begin begin
if (Mode = tmStackHex) or (Mode = tmStackChar) then begin
line:= 4;
window:= 44;
end else begin
line:= 16;
window:= 176;
end;
if info.CTRL_DOWN then begin if info.CTRL_DOWN then begin
if info.key_code = 16 then begin if info.key_code = 16 then begin
dec(MEM_LOC, 176); dec(MEM_LOC, window);
NEW_LOC:= true; NEW_LOC:= true;
end; end;
if info.key_code = 18 then begin if info.key_code = 18 then begin
inc(MEM_LOC, 176); inc(MEM_LOC, window);
NEW_LOC:= true; NEW_LOC:= true;
end; end;
end else begin end else begin
if info.key_code = 16 then begin if info.key_code = 16 then begin
dec(MEM_LOC, 16); dec(MEM_LOC, line);
NEW_LOC:= true; NEW_LOC:= true;
end; end;
if info.key_code = 18 then begin if info.key_code = 18 then begin
inc(MEM_LOC, 16); inc(MEM_LOC, line);
NEW_LOC:= true; NEW_LOC:= true;
end; end;
end; end;
if info.key_code = uint8('c') then begin if info.key_code = uint8('c') then begin
if (Mode <> tmStackHex) and (Mode <> tmStackChar) then begin
Mode:= tmChar; Mode:= tmChar;
end else begin
Mode:= tmStackChar;
end;
end; end;
if info.key_code = uint8('h') then begin if info.key_code = uint8('h') then begin
if (Mode <> tmStackHex) and (Mode <> tmStackChar) then begin
Mode:= tmHex; Mode:= tmHex;
end else begin
Mode:= tmStackHex;
end;
end;
if info.key_code = uint8('s') then begin
if (Mode <> tmStackHex) and (Mode <> tmStackChar) then begin
Mode:= tmStackHex;
end else begin
Mode:= tmHex;
end;
MEM_LOC:= getESP;
NEW_LOC:= true;
end; end;
end; end;

39
src/prog/netlog.pas Normal file
View File

@ -0,0 +1,39 @@
unit netlog;
interface
uses
console, terminal, keyboard, util, strings, tracer;
procedure init();
function getNetlogHWND : HWND;
implementation
var
Handle : HWND = 0;
function getNetlogHWND : HWND;
begin
getNetlogHWND:= Handle;
end;
procedure OnClose();
begin
Handle:= 0;
end;
procedure run(Params : PParamList);
begin
if Handle = 0 then begin
Handle:= newWindow(20, 40, 63, 14, 'NETLOG');
end;
end;
procedure init();
begin
tracer.push_trace('netlog.init');
terminal.registerCommand('NETLOG', @Run, 'View network event log.');
end;
end.