refactor/feature/fix: Major refactor of codebase
refactor(stdio): replace console/terminal command system with buffer-based stdio - Introduced stdio.pas as the unified command I/O layer. - All 31 command procedures across 15 files now receive stdin_buf, stdout_buf, and stderr_buf (POutBuf) instead of a single outbuf. - vterminal.pas creates all three buffers per command invocation and displays both stdout and stderr. - Deleted console.pas, terminal.pas, and 9 obsolete windowing programs (shell, splash, edit, memview, themer, netlog, vmlog, vmstate, udpcat). - Migrated all registerCommand calls to stdio, rewrote vterminal processCommand to use stdio.findCommand, and added proper error routing to stderr for invalid params, bad paths, and system errors. refactor(syslog): replace console logging with serial-backed syslog - Introduced syslog.pas for kernel-level logging over serial/dev. - Migrated all boot logging in kernel.pas from console.outputln/ writestringln to syslog.logln/writestringln. - Converted 19 fault handlers, hashmap, lists, scheduler, tracer, net, udp, and all driver init paths to use syslog. - Rewrote BSOD in util.pas (50+ calls) from console to syslog. - Removed CONSOLE_SLOW_REDRAW, TRGB565, TRGB565Pair, and HWND from system.pas. fix(keyboard): add ring buffer and proper press/release cycling for LVGL input - Replaced the single last_key/key_pressed slot in lvgl.pas with a 16-entry ring buffer (kb_buf, kb_head, kb_tail) to prevent ISR overwrites when typing fast. - Added a kb_pending_release flag so each keystroke gets a full PRESSED->RELEASED cycle before the next key is consumed — LVGL requires this pairing and was silently dropping intermediate keys when receiving consecutive PRESSED events without intervening releases. feat(vterminal): use Hack monospace font for terminal output - Added Hack Regular 14px (hack_14.c) as a custom LVGL font. - Removed the .static_bitmap field from the generated font file (not present in LVGL 9.2 lv_font_t struct). - Declared the hack_14 external symbol in lvgl.pas and switched vterminal's text label from lv_font_montserrat_14 to hack_14 for proper monospace terminal rendering.
This commit is contained in:
+12886
File diff suppressed because it is too large
Load Diff
-2710
File diff suppressed because it is too large
Load Diff
+72
-69
File diff suppressed because it is too large
Load Diff
+12
-12
@@ -23,7 +23,7 @@ interface
|
||||
|
||||
uses
|
||||
tracer,
|
||||
Console,
|
||||
syslog,
|
||||
PCI,
|
||||
drivertypes,
|
||||
pmemorymanager,
|
||||
@@ -44,19 +44,19 @@ var
|
||||
begin
|
||||
tracer.push_trace('EHCI.load');
|
||||
devices:= PCI.getDeviceInfo($0C, $03, $20, count);
|
||||
console.output('USB-EHCI Driver', 'Found ');
|
||||
console.writeint(count);
|
||||
console.writestringln(' USB Controller(s).');
|
||||
syslog.log('USB-EHCI Driver', 'Found ');
|
||||
syslog.writeint(count);
|
||||
syslog.writestringln(' USB Controller(s).');
|
||||
if count > 0 then begin
|
||||
for i:=0 to count-1 do begin
|
||||
console.output('USB-EHCI Driver', 'Controller[');
|
||||
console.writeint(i);
|
||||
console.writestring(']: ');
|
||||
console.writehex(devices[i].device_id);
|
||||
console.writestring(' ');
|
||||
console.writehex(devices[i].vendor_id);
|
||||
console.writestring(' ');
|
||||
console.writehexln(devices[i].prog_if);
|
||||
syslog.log('USB-EHCI Driver', 'Controller[');
|
||||
syslog.writeint(i);
|
||||
syslog.writestring(']: ');
|
||||
syslog.writehex(devices[i].device_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehex(devices[i].vendor_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehexln(devices[i].prog_if);
|
||||
end;
|
||||
end;
|
||||
load:= true;
|
||||
|
||||
+12
-12
@@ -23,7 +23,7 @@ interface
|
||||
|
||||
uses
|
||||
tracer,
|
||||
Console,
|
||||
syslog,
|
||||
PCI,
|
||||
drivertypes,
|
||||
pmemorymanager,
|
||||
@@ -71,19 +71,19 @@ var
|
||||
begin
|
||||
tracer.push_trace('OHCI.load');
|
||||
devices:= PCI.getDeviceInfo($0C, $03, $10, count);
|
||||
console.output('USB-OHCI Driver', 'Found ');
|
||||
console.writeint(count);
|
||||
console.writestringln(' USB Controller(s).');
|
||||
syslog.log('USB-OHCI Driver', 'Found ');
|
||||
syslog.writeint(count);
|
||||
syslog.writestringln(' USB Controller(s).');
|
||||
if count > 0 then begin
|
||||
for i:=0 to count-1 do begin
|
||||
console.output('USB-OHCI Driver', 'Controller[');
|
||||
console.writeint(i);
|
||||
console.writestring(']: ');
|
||||
console.writehex(devices[i].device_id);
|
||||
console.writestring(' ');
|
||||
console.writehex(devices[i].vendor_id);
|
||||
console.writestring(' ');
|
||||
console.writehexln(devices[i].prog_if);
|
||||
syslog.log('USB-OHCI Driver', 'Controller[');
|
||||
syslog.writeint(i);
|
||||
syslog.writestring(']: ');
|
||||
syslog.writehex(devices[i].device_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehex(devices[i].vendor_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehexln(devices[i].prog_if);
|
||||
block:= devices[i].address0 SHR 22;
|
||||
force_alloc_block(block, 0);
|
||||
map_page(block, block);
|
||||
|
||||
+16
-16
@@ -25,7 +25,7 @@ interface
|
||||
uses
|
||||
tracer,
|
||||
util,
|
||||
console,
|
||||
syslog,
|
||||
drivertypes,
|
||||
lmemorymanager,
|
||||
vmemorymanager,
|
||||
@@ -100,14 +100,14 @@ var
|
||||
|
||||
begin
|
||||
push_trace('PCI.load');
|
||||
console.outputln('PCI', 'Scanning Bus: 0');
|
||||
syslog.logln('PCI', 'Scanning Bus: 0');
|
||||
scanBus(0);
|
||||
//while unscanned busses scan busses
|
||||
current_bus := 1;
|
||||
while true do begin
|
||||
if current_bus < bus_count then begin
|
||||
console.output('PCI', 'Scanning Bus: ');
|
||||
console.writeintln(bus_count);
|
||||
syslog.log('PCI', 'Scanning Bus: ');
|
||||
syslog.writeintln(bus_count);
|
||||
scanBus(current_bus);
|
||||
current_bus := current_bus + 1;
|
||||
end else break;
|
||||
@@ -122,7 +122,7 @@ var
|
||||
|
||||
begin
|
||||
push_trace('PCI.init');
|
||||
console.outputln('PCI','INIT BEGIN.');
|
||||
syslog.logln('PCI','INIT BEGIN.');
|
||||
DevID.Bus:= biUnknown;
|
||||
DevID.id0:= 0;
|
||||
DevID.id1:= 0;
|
||||
@@ -130,7 +130,7 @@ begin
|
||||
DevID.id3:= 0;
|
||||
DevID.ex:= nil;
|
||||
drivermanagement.register_driver_ex('PCI Driver', @DevID, @load, true);
|
||||
console.outputln('PCI', 'INIT END.');
|
||||
syslog.logln('PCI', 'INIT END.');
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
@@ -388,16 +388,16 @@ begin
|
||||
DevID^.id4:= device.vendor_id;
|
||||
DevID^.ex:= nil;
|
||||
|
||||
console.output('PCI', 'Found Device: ');
|
||||
console.writehex(device.header_type);
|
||||
console.writestring(' ');
|
||||
console.writehex(device.device_id);
|
||||
console.writestring(' ');
|
||||
console.writehex(device.class_code);
|
||||
console.writestring(' ');
|
||||
console.writehex(device.subclass_class);
|
||||
console.writestring(' ');
|
||||
console.writehexln(device.prog_if);
|
||||
syslog.log('PCI', 'Found Device: ');
|
||||
syslog.writehex(device.header_type);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehex(device.device_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehex(device.class_code);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehex(device.subclass_class);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehexln(device.prog_if);
|
||||
|
||||
devices[device_count] := device;
|
||||
device_count := device_count + 1;
|
||||
|
||||
+12
-12
@@ -23,7 +23,7 @@ interface
|
||||
|
||||
uses
|
||||
tracer,
|
||||
Console,
|
||||
syslog,
|
||||
PCI,
|
||||
drivertypes,
|
||||
pmemorymanager,
|
||||
@@ -44,19 +44,19 @@ var
|
||||
begin
|
||||
tracer.push_trace('UHCI.load');
|
||||
devices:= PCI.getDeviceInfo($0C, $03, $00, count);
|
||||
console.output('USB-UHCI Driver','Found ');
|
||||
console.writeint(count);
|
||||
console.writestringln(' USB Controller(s).');
|
||||
syslog.log('USB-UHCI Driver','Found ');
|
||||
syslog.writeint(count);
|
||||
syslog.writestringln(' USB Controller(s).');
|
||||
if count > 0 then begin
|
||||
for i:=0 to count-1 do begin
|
||||
console.output('USB-UHCI Driver','Controller[');
|
||||
console.writeint(i);
|
||||
console.writestring(']: ');
|
||||
console.writehex(devices[i].device_id);
|
||||
console.writestring(' ');
|
||||
console.writehex(devices[i].vendor_id);
|
||||
console.writestring(' ');
|
||||
console.writehexln(devices[i].prog_if);
|
||||
syslog.log('USB-UHCI Driver','Controller[');
|
||||
syslog.writeint(i);
|
||||
syslog.writestring(']: ');
|
||||
syslog.writehex(devices[i].device_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehex(devices[i].vendor_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehexln(devices[i].prog_if);
|
||||
end;
|
||||
end;
|
||||
load:= true;
|
||||
|
||||
@@ -23,7 +23,7 @@ interface
|
||||
|
||||
uses
|
||||
tracer,
|
||||
Console,
|
||||
syslog,
|
||||
PCI,
|
||||
drivertypes,
|
||||
pmemorymanager,
|
||||
@@ -69,7 +69,7 @@ var
|
||||
|
||||
begin
|
||||
push_trace('USB.init');
|
||||
console.outputln('USB Driver', 'INIT BEGIN.');
|
||||
syslog.logln('USB Driver', 'INIT BEGIN.');
|
||||
|
||||
UHCI_ID.Bus:= biPCI;
|
||||
UHCI_ID.id0:= idANY;
|
||||
@@ -108,7 +108,7 @@ begin
|
||||
drivermanagement.register_driver('USB-EHCI Driver', @EHCI_ID, @loadEHCI);
|
||||
drivermanagement.register_driver('USB-XHCI Driver', @XHCI_ID, @loadXHCI);
|
||||
|
||||
console.outputln('USB Driver', 'INIT END.');
|
||||
syslog.logln('USB Driver', 'INIT END.');
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
|
||||
+12
-12
@@ -23,7 +23,7 @@ interface
|
||||
|
||||
uses
|
||||
tracer,
|
||||
Console,
|
||||
syslog,
|
||||
PCI,
|
||||
drivertypes,
|
||||
pmemorymanager,
|
||||
@@ -44,19 +44,19 @@ var
|
||||
begin
|
||||
tracer.push_trace('XHCI.load');
|
||||
devices:= PCI.getDeviceInfo($0C, $03, $30, count);
|
||||
console.output('USB-XHCI Driver', 'Found ');
|
||||
console.writeint(count);
|
||||
console.writestringln(' USB Controller(s).');
|
||||
syslog.log('USB-XHCI Driver', 'Found ');
|
||||
syslog.writeint(count);
|
||||
syslog.writestringln(' USB Controller(s).');
|
||||
if count > 0 then begin
|
||||
for i:=0 to count-1 do begin
|
||||
console.output('USB-XHCI Driver', 'Controller[');
|
||||
console.writeint(i);
|
||||
console.writestring(']: ');
|
||||
console.writehex(devices[i].device_id);
|
||||
console.writestring(' ');
|
||||
console.writehex(devices[i].vendor_id);
|
||||
console.writestring(' ');
|
||||
console.writehexln(devices[i].prog_if);
|
||||
syslog.log('USB-XHCI Driver', 'Controller[');
|
||||
syslog.writeint(i);
|
||||
syslog.writestring(']: ');
|
||||
syslog.writehex(devices[i].device_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehex(devices[i].vendor_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehexln(devices[i].prog_if);
|
||||
end;
|
||||
end;
|
||||
load:= true;
|
||||
|
||||
@@ -22,7 +22,7 @@ unit testdriver;
|
||||
interface
|
||||
|
||||
uses
|
||||
tracer, console, drivermanagement;
|
||||
tracer, syslog, drivermanagement;
|
||||
|
||||
procedure init;
|
||||
|
||||
@@ -31,7 +31,7 @@ implementation
|
||||
function load(ptr : void) : boolean;
|
||||
begin
|
||||
push_trace('testdriver.load');
|
||||
console.outputln('DUMMY DRIVER', 'LOADED.');
|
||||
syslog.logln('DUMMY DRIVER', 'LOADED.');
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ interface
|
||||
|
||||
uses
|
||||
util,
|
||||
console,
|
||||
isr_types,
|
||||
isrmanager,
|
||||
IDT;
|
||||
|
||||
@@ -22,7 +22,7 @@ unit keyboard;
|
||||
interface
|
||||
|
||||
uses
|
||||
console,
|
||||
syslog,
|
||||
util,
|
||||
PS2_KEYBOARD_ISR;
|
||||
|
||||
@@ -94,7 +94,7 @@ function load(ptr : void) : boolean;
|
||||
begin
|
||||
PS2_KEYBOARD_ISR.register();
|
||||
PS2_KEYBOARD_ISR.hook(uint32(@callback));
|
||||
console.outputln('PS/2 KEYBOARD', 'LOADED.');
|
||||
syslog.logln('PS/2 KEYBOARD', 'LOADED.');
|
||||
load:= true;
|
||||
end;
|
||||
|
||||
@@ -103,7 +103,7 @@ var
|
||||
devid : TDeviceIdentifier;
|
||||
|
||||
begin
|
||||
console.outputln('PS/2 KEYBOARD', 'INIT BEGIN.');
|
||||
syslog.logln('PS/2 KEYBOARD', 'INIT BEGIN.');
|
||||
if keyboard_layout[1].key_code = 0 then lang_USA();
|
||||
devid.bus:= biUnknown;
|
||||
devid.id0:= 0;
|
||||
@@ -113,7 +113,7 @@ begin
|
||||
devid.id4:= 0;
|
||||
devid.ex:= nil;
|
||||
drivermanagement.register_driver_ex('PS/2 Keyboard', @devid, @load, true);
|
||||
console.outputln('PS/2 KEYBOARD', 'INIT END.');
|
||||
syslog.logln('PS/2 KEYBOARD', 'INIT END.');
|
||||
end;
|
||||
//2A AA
|
||||
|
||||
|
||||
+27
-55
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -40,8 +40,7 @@ function sinb(port : uint16) : uint8;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
console;
|
||||
{ no implementation uses }
|
||||
|
||||
procedure soutb(port : uint16; val : uint8);
|
||||
begin
|
||||
|
||||
@@ -22,16 +22,16 @@ unit netutils;
|
||||
interface
|
||||
|
||||
uses
|
||||
tracer, util, nettypes, console, lmemorymanager, lists, strings;
|
||||
tracer, util, nettypes, stdio, lmemorymanager, lists, strings;
|
||||
|
||||
procedure copyMAC(src : puint8; dst : puint8);
|
||||
procedure copyIPv4(src : puint8; dst : puint8);
|
||||
function stringToMAC(str : pchar) : puint8;
|
||||
function stringToIPv4(str : pchar) : puint8;
|
||||
procedure writeMACAddress(mac : puint8; WND : HWND);
|
||||
procedure writeIPv4Address(ip : puint8; WND : HWND);
|
||||
procedure writeMACAddressEx(mac : puint8; WND : HWND);
|
||||
procedure writeIPv4AddressEx(ip : puint8; WND : HWND);
|
||||
procedure writeMACAddress(mac : puint8; outbuf : POutBuf);
|
||||
procedure writeIPv4Address(ip : puint8; outbuf : POutBuf);
|
||||
procedure writeMACAddressEx(mac : puint8; outbuf : POutBuf);
|
||||
procedure writeIPv4AddressEx(ip : puint8; outbuf : POutBuf);
|
||||
function MACEqual(mac1 : puint8; mac2 : puint8) : boolean;
|
||||
function IPEqual(ip1 : puint8; ip2 : puint8) : boolean;
|
||||
function newPacketContext : PPacketContext;
|
||||
@@ -172,59 +172,59 @@ begin
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
procedure writeIPv4AddressEx(ip : puint8; WND : HWND);
|
||||
procedure writeIPv4AddressEx(ip : puint8; outbuf : POutBuf);
|
||||
var
|
||||
i : integer;
|
||||
|
||||
begin
|
||||
push_trace('netutils.writeIPv4Address');
|
||||
console.writeintWND(ip[0], WND);
|
||||
stdio.bufWriteInt(outbuf, ip[0]);
|
||||
for i:=1 to 3 do begin
|
||||
console.writestringWND('.', WND);
|
||||
console.writeintWND(ip[i], WND);
|
||||
stdio.bufWriteStr(outbuf, '.');
|
||||
stdio.bufWriteInt(outbuf, ip[i]);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure writeMACAddressEx(mac : puint8; WND : HWND);
|
||||
procedure writeMACAddressEx(mac : puint8; outbuf : POutBuf);
|
||||
var
|
||||
i : integer;
|
||||
|
||||
begin
|
||||
push_trace('netutils.writeMACAddress');
|
||||
console.writehexpairWND(mac[0], WND);
|
||||
stdio.bufWriteHexPair(outbuf, mac[0]);
|
||||
for i:=1 to 5 do begin
|
||||
console.writestringWND(':', WND);
|
||||
console.writehexpairWND(mac[i], WND);
|
||||
stdio.bufWriteStr(outbuf, ':');
|
||||
stdio.bufWriteHexPair(outbuf, mac[i]);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure writeIPv4Address(ip : puint8; WND : HWND);
|
||||
procedure writeIPv4Address(ip : puint8; outbuf : POutBuf);
|
||||
var
|
||||
i : integer;
|
||||
|
||||
begin
|
||||
push_trace('netutils.writeIPv4Address');
|
||||
console.writeintWND(ip[0], WND);
|
||||
stdio.bufWriteInt(outbuf, ip[0]);
|
||||
for i:=1 to 3 do begin
|
||||
console.writestringWND('.', WND);
|
||||
console.writeintWND(ip[i], WND);
|
||||
stdio.bufWriteStr(outbuf, '.');
|
||||
stdio.bufWriteInt(outbuf, ip[i]);
|
||||
end;
|
||||
console.writestringlnWND(' ', WND);
|
||||
stdio.bufWriteStrLn(outbuf, ' ');
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
procedure writeMACAddress(mac : puint8; WND : HWND);
|
||||
procedure writeMACAddress(mac : puint8; outbuf : POutBuf);
|
||||
var
|
||||
i : integer;
|
||||
|
||||
begin
|
||||
push_trace('netutils.writeMACAddress');
|
||||
console.writehexpairWND(mac[0], WND);
|
||||
stdio.bufWriteHexPair(outbuf, mac[0]);
|
||||
for i:=1 to 5 do begin
|
||||
console.writestringWND(':', WND);
|
||||
console.writehexpairWND(mac[i], WND);
|
||||
stdio.bufWriteStr(outbuf, ':');
|
||||
stdio.bufWriteHexPair(outbuf, mac[i]);
|
||||
end;
|
||||
console.writestringlnWND(' ', WND);
|
||||
stdio.bufWriteStrLn(outbuf, ' ');
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
|
||||
+16
-22
@@ -23,9 +23,8 @@ interface
|
||||
|
||||
uses
|
||||
tracer,
|
||||
console,
|
||||
nettypes, netutils,
|
||||
netlog,
|
||||
syslog,
|
||||
RTC;
|
||||
|
||||
procedure init;
|
||||
@@ -39,8 +38,7 @@ procedure writeToLogLn(str : pchar);
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
terminal,
|
||||
uses
|
||||
e1000, //dev
|
||||
eth2, //L2
|
||||
arp, ipv4, //L3
|
||||
@@ -57,32 +55,28 @@ var
|
||||
DateTime : TDateTime;
|
||||
|
||||
begin
|
||||
if getNetlogHWND <> 0 then begin
|
||||
DateTime:= getDateTime;
|
||||
writeStringWND('[', getNetlogHWND);
|
||||
DateTime:= getDateTime;
|
||||
syslog.writestring('[');
|
||||
|
||||
if DateTime.Hours < 10 then writeIntWND(0, getNetlogHWND);
|
||||
writeIntWND(DateTime.Hours, getNetlogHWND);
|
||||
writeStringWND(':', getNetlogHWND);
|
||||
|
||||
if DateTime.Minutes < 10 then writeIntWND(0, getNetlogHWND);
|
||||
writeIntWND(DateTime.Minutes, getNetlogHWND);
|
||||
writeStringWND(':', getNetlogHWND);
|
||||
if DateTime.Hours < 10 then syslog.writeint(0);
|
||||
syslog.writeint(DateTime.Hours);
|
||||
syslog.writestring(':');
|
||||
|
||||
if DateTime.Minutes < 10 then syslog.writeint(0);
|
||||
syslog.writeint(DateTime.Minutes);
|
||||
syslog.writestring(':');
|
||||
|
||||
if DateTime.Seconds < 10 then writeIntWND(0, getNetlogHWND);
|
||||
writeIntWND(DateTime.Seconds, getNetlogHWND);
|
||||
writeStringWND('] ', getNetlogHWND);
|
||||
if DateTime.Seconds < 10 then syslog.writeint(0);
|
||||
syslog.writeint(DateTime.Seconds);
|
||||
syslog.writestring('] ');
|
||||
|
||||
writeStringWND(str, getNetlogHWND);
|
||||
end;
|
||||
syslog.writestring(str);
|
||||
end;
|
||||
|
||||
procedure writeToLogLn(str : pchar);
|
||||
begin
|
||||
writeToLog(str);
|
||||
if getNetlogHWND <> 0 then begin
|
||||
writestringlnWND(' ', getNetlogHWND);
|
||||
end;
|
||||
syslog.writestringln(' ');
|
||||
end;
|
||||
|
||||
procedure registerNetworkCard(SendCallback : TNetSendCallback; _MAC : puint8);
|
||||
|
||||
@@ -24,10 +24,8 @@ interface
|
||||
uses
|
||||
lmemorymanager, util,
|
||||
tracer,
|
||||
nettypes, netutils, terminal,
|
||||
nettypes, netutils,
|
||||
net,
|
||||
netlog,
|
||||
console,
|
||||
crc;
|
||||
|
||||
procedure send(p_data : void; p_len : uint16; eth_type : uint16; p_context : PPacketContext);
|
||||
|
||||
+13
-11
@@ -23,9 +23,8 @@ interface
|
||||
|
||||
uses
|
||||
tracer, lmemorymanager,
|
||||
util, lists, console, terminal,
|
||||
util, lists,
|
||||
net, nettypes, netutils,
|
||||
netlog,
|
||||
eth2, ipv4;
|
||||
|
||||
type
|
||||
@@ -45,6 +44,9 @@ function resolveIP(ip : puint8) : puint8;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
stdio, strings;
|
||||
|
||||
var
|
||||
Registered : Boolean = false;
|
||||
Cache : PLinkedListBase;
|
||||
@@ -263,7 +265,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure terminal_command_arp(Params : PParamList);
|
||||
procedure terminal_command_arp(Params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
|
||||
var
|
||||
i : uint32;
|
||||
elm : PARPCacheRecord;
|
||||
@@ -275,19 +277,19 @@ begin
|
||||
sIP:= getParam(0, Params);
|
||||
_IP:= stringToIPv4(sIP);
|
||||
sendRequest(_IP);
|
||||
writestringlnWND('ARP Request Sent.', getTerminalHWND);
|
||||
stdio.bufWriteStrLn(stdout_buf, 'ARP Request Sent.');
|
||||
end else begin
|
||||
if LL_Size(Cache) > 0 then begin
|
||||
writestringlnWND('MAC IPv4', getTerminalHWND);
|
||||
stdio.bufWriteStrLn(stdout_buf, 'MAC IPv4');
|
||||
For i:=0 to LL_Size(Cache)-1 do begin
|
||||
elm:= PARPCacheRecord(LL_Get(Cache, i));
|
||||
writeMACAddressEx(@elm^.MAC[0], getTerminalHWND);
|
||||
writestringWND(' ', getTerminalHWND);
|
||||
writeIPv4AddressEx(@elm^.IP[0], getTerminalHWND);
|
||||
writestringlnWND(' ', getTerminalHWND);
|
||||
writeMACAddressEx(@elm^.MAC[0], stdout_buf);
|
||||
stdio.bufWriteStr(stdout_buf, ' ');
|
||||
writeIPv4AddressEx(@elm^.IP[0], stdout_buf);
|
||||
stdio.bufWriteStrLn(stdout_buf, ' ');
|
||||
end;
|
||||
end else begin
|
||||
writestringlnWND('No entries in ARP table.', getTerminalHWND);
|
||||
stdio.bufWriteStrLn(stdout_buf, 'No entries in ARP table.');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@@ -298,7 +300,7 @@ begin
|
||||
if not Registered then begin
|
||||
Cache:= LL_New(sizeof(TARPCacheRecord));
|
||||
eth2.registerTypePromisc($0806, @recv);
|
||||
terminal.registerCommand('ARP', @terminal_command_arp, 'Get ARP Table.');
|
||||
stdio.registerCommand('ARP', @terminal_command_arp, 'Get ARP Table.');
|
||||
Registered:= true;
|
||||
end;
|
||||
pop_trace;
|
||||
|
||||
+15
-16
@@ -23,9 +23,8 @@ interface
|
||||
|
||||
uses
|
||||
tracer, lmemorymanager,
|
||||
util, console, terminal, strings,
|
||||
util, strings,
|
||||
net, nettypes, netutils,
|
||||
netlog,
|
||||
lists,
|
||||
eth2;
|
||||
|
||||
@@ -37,7 +36,7 @@ procedure register;
|
||||
implementation
|
||||
|
||||
uses
|
||||
arp;
|
||||
arp, stdio;
|
||||
|
||||
var
|
||||
Registered : Boolean = false;
|
||||
@@ -132,7 +131,7 @@ begin
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
procedure terminal_command_ifconfig(params : PParamList);
|
||||
procedure terminal_command_ifconfig(params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
|
||||
var
|
||||
Command, Sub, Address, Gateway, Netmask : pchar;
|
||||
_Address, _Gateway, _Netmask : puint8;
|
||||
@@ -158,7 +157,7 @@ begin
|
||||
kfree(void(_Gateway));
|
||||
kfree(void(_Netmask));
|
||||
end else begin
|
||||
writestringlnWND('Invalid number of params to call ''set''.', getTerminalHWND);
|
||||
stdio.bufWriteStrLn(stderr_buf, 'Invalid number of params to call ''set''.');
|
||||
end;
|
||||
end;
|
||||
if StringEquals(Command, 'net') then begin
|
||||
@@ -174,18 +173,18 @@ begin
|
||||
CopyIPv4(@Config.Gateway[0], @Target[0]);
|
||||
arp.sendRequest(@Target[0]);
|
||||
end else begin
|
||||
writestringWND(' MAC: ', getTerminalHWND);
|
||||
writeMACAddress(net.GetMAC, getTerminalHWND);
|
||||
writestringWND(' IPv4: ', getTerminalHWND);
|
||||
writeIPv4Address(@Config.Address[0], getTerminalHWND);
|
||||
writestringWND(' Gateway: ', getTerminalHWND);
|
||||
writeIPv4Address(@Config.Gateway[0], getTerminalHWND);
|
||||
writestringWND(' Netmask: ', getTerminalHWND);
|
||||
writeIPv4Address(@Config.Netmask[0], getTerminalHWND);
|
||||
stdio.bufWriteStr(stdout_buf, ' MAC: ');
|
||||
writeMACAddress(net.GetMAC, stdout_buf);
|
||||
stdio.bufWriteStr(stdout_buf, ' IPv4: ');
|
||||
writeIPv4Address(@Config.Address[0], stdout_buf);
|
||||
stdio.bufWriteStr(stdout_buf, ' Gateway: ');
|
||||
writeIPv4Address(@Config.Gateway[0], stdout_buf);
|
||||
stdio.bufWriteStr(stdout_buf, ' Netmask: ');
|
||||
writeIPv4Address(@Config.Netmask[0], stdout_buf);
|
||||
if Config.UP then
|
||||
writestringlnWND(' NetUP: true', getTerminalHWND)
|
||||
stdio.bufWriteStrLn(stdout_buf, ' NetUP: true')
|
||||
else
|
||||
writestringlnWND(' NetUP: false', getTerminalHWND);
|
||||
stdio.bufWriteStrLn(stdout_buf, ' NetUP: false');
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -206,7 +205,7 @@ begin
|
||||
end;
|
||||
Config.UP:= false;
|
||||
eth2.registerType($0800, @recv);
|
||||
terminal.registerCommand('IFCONFIG', @terminal_command_ifconfig, 'Configure Network Settings.');
|
||||
stdio.registerCommand('IFCONFIG', @terminal_command_ifconfig, 'Configure Network Settings.');
|
||||
Registered:= true;
|
||||
end;
|
||||
pop_trace;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user