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

View File

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

View File

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

View File

@ -6,6 +6,7 @@ uses
tracer,
util, console, terminal,
net, nettypes, netutils,
netlog,
eth2;
procedure registerProtocol(Protocol_ID : uint8; recv_callback : TRecvCallback);
@ -28,7 +29,7 @@ var
begin
push_trace('ipv4.recv');
//console.outputln('net.ipv4', 'RECV.');
if getNetlogHWND <> 0 then writestringlnWND('ipv4.recv', getNetlogHWND);
Header:= PIPV4Header(p_data);
AHeader.version:= Header^.version;
AHeader.header_len:= Header^.header_len;

View File

@ -3,20 +3,20 @@ unit asuro;
interface
const
VERSION = '1.0.1-672ia';
VERSION = '1.0.1-674ia';
VERSION_MAJOR = '1';
VERSION_MINOR = '0';
VERSION_SUB = '1';
REVISION = '672';
REVISION = '674';
RELEASE = 'ia';
LINE_COUNT = 28180;
FILE_COUNT = 90;
DRIVER_COUNT = 34;
LINE_COUNT = 27628;
FILE_COUNT = 89;
DRIVER_COUNT = 32;
FPC_VERSION = '2.6.4';
NASM_VERSION = '2.10.09';
MAKE_VERSION = '3.81';
COMPILE_DATE = '08/05/18';
COMPILE_TIME = '10:05:48';
COMPILE_DATE = '10/05/18';
COMPILE_TIME = '08:36:31';
implementation

View File

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

View File

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

View File

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

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.