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
|
uses
|
||||||
tracer,
|
tracer,
|
||||||
Console,
|
syslog,
|
||||||
PCI,
|
PCI,
|
||||||
drivertypes,
|
drivertypes,
|
||||||
pmemorymanager,
|
pmemorymanager,
|
||||||
@@ -44,19 +44,19 @@ var
|
|||||||
begin
|
begin
|
||||||
tracer.push_trace('EHCI.load');
|
tracer.push_trace('EHCI.load');
|
||||||
devices:= PCI.getDeviceInfo($0C, $03, $20, count);
|
devices:= PCI.getDeviceInfo($0C, $03, $20, count);
|
||||||
console.output('USB-EHCI Driver', 'Found ');
|
syslog.log('USB-EHCI Driver', 'Found ');
|
||||||
console.writeint(count);
|
syslog.writeint(count);
|
||||||
console.writestringln(' USB Controller(s).');
|
syslog.writestringln(' USB Controller(s).');
|
||||||
if count > 0 then begin
|
if count > 0 then begin
|
||||||
for i:=0 to count-1 do begin
|
for i:=0 to count-1 do begin
|
||||||
console.output('USB-EHCI Driver', 'Controller[');
|
syslog.log('USB-EHCI Driver', 'Controller[');
|
||||||
console.writeint(i);
|
syslog.writeint(i);
|
||||||
console.writestring(']: ');
|
syslog.writestring(']: ');
|
||||||
console.writehex(devices[i].device_id);
|
syslog.writehex(devices[i].device_id);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehex(devices[i].vendor_id);
|
syslog.writehex(devices[i].vendor_id);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehexln(devices[i].prog_if);
|
syslog.writehexln(devices[i].prog_if);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
load:= true;
|
load:= true;
|
||||||
|
|||||||
+12
-12
@@ -23,7 +23,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
tracer,
|
tracer,
|
||||||
Console,
|
syslog,
|
||||||
PCI,
|
PCI,
|
||||||
drivertypes,
|
drivertypes,
|
||||||
pmemorymanager,
|
pmemorymanager,
|
||||||
@@ -71,19 +71,19 @@ var
|
|||||||
begin
|
begin
|
||||||
tracer.push_trace('OHCI.load');
|
tracer.push_trace('OHCI.load');
|
||||||
devices:= PCI.getDeviceInfo($0C, $03, $10, count);
|
devices:= PCI.getDeviceInfo($0C, $03, $10, count);
|
||||||
console.output('USB-OHCI Driver', 'Found ');
|
syslog.log('USB-OHCI Driver', 'Found ');
|
||||||
console.writeint(count);
|
syslog.writeint(count);
|
||||||
console.writestringln(' USB Controller(s).');
|
syslog.writestringln(' USB Controller(s).');
|
||||||
if count > 0 then begin
|
if count > 0 then begin
|
||||||
for i:=0 to count-1 do begin
|
for i:=0 to count-1 do begin
|
||||||
console.output('USB-OHCI Driver', 'Controller[');
|
syslog.log('USB-OHCI Driver', 'Controller[');
|
||||||
console.writeint(i);
|
syslog.writeint(i);
|
||||||
console.writestring(']: ');
|
syslog.writestring(']: ');
|
||||||
console.writehex(devices[i].device_id);
|
syslog.writehex(devices[i].device_id);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehex(devices[i].vendor_id);
|
syslog.writehex(devices[i].vendor_id);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehexln(devices[i].prog_if);
|
syslog.writehexln(devices[i].prog_if);
|
||||||
block:= devices[i].address0 SHR 22;
|
block:= devices[i].address0 SHR 22;
|
||||||
force_alloc_block(block, 0);
|
force_alloc_block(block, 0);
|
||||||
map_page(block, block);
|
map_page(block, block);
|
||||||
|
|||||||
+16
-16
@@ -25,7 +25,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
tracer,
|
tracer,
|
||||||
util,
|
util,
|
||||||
console,
|
syslog,
|
||||||
drivertypes,
|
drivertypes,
|
||||||
lmemorymanager,
|
lmemorymanager,
|
||||||
vmemorymanager,
|
vmemorymanager,
|
||||||
@@ -100,14 +100,14 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('PCI.load');
|
push_trace('PCI.load');
|
||||||
console.outputln('PCI', 'Scanning Bus: 0');
|
syslog.logln('PCI', 'Scanning Bus: 0');
|
||||||
scanBus(0);
|
scanBus(0);
|
||||||
//while unscanned busses scan busses
|
//while unscanned busses scan busses
|
||||||
current_bus := 1;
|
current_bus := 1;
|
||||||
while true do begin
|
while true do begin
|
||||||
if current_bus < bus_count then begin
|
if current_bus < bus_count then begin
|
||||||
console.output('PCI', 'Scanning Bus: ');
|
syslog.log('PCI', 'Scanning Bus: ');
|
||||||
console.writeintln(bus_count);
|
syslog.writeintln(bus_count);
|
||||||
scanBus(current_bus);
|
scanBus(current_bus);
|
||||||
current_bus := current_bus + 1;
|
current_bus := current_bus + 1;
|
||||||
end else break;
|
end else break;
|
||||||
@@ -122,7 +122,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('PCI.init');
|
push_trace('PCI.init');
|
||||||
console.outputln('PCI','INIT BEGIN.');
|
syslog.logln('PCI','INIT BEGIN.');
|
||||||
DevID.Bus:= biUnknown;
|
DevID.Bus:= biUnknown;
|
||||||
DevID.id0:= 0;
|
DevID.id0:= 0;
|
||||||
DevID.id1:= 0;
|
DevID.id1:= 0;
|
||||||
@@ -130,7 +130,7 @@ begin
|
|||||||
DevID.id3:= 0;
|
DevID.id3:= 0;
|
||||||
DevID.ex:= nil;
|
DevID.ex:= nil;
|
||||||
drivermanagement.register_driver_ex('PCI Driver', @DevID, @load, true);
|
drivermanagement.register_driver_ex('PCI Driver', @DevID, @load, true);
|
||||||
console.outputln('PCI', 'INIT END.');
|
syslog.logln('PCI', 'INIT END.');
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -388,16 +388,16 @@ begin
|
|||||||
DevID^.id4:= device.vendor_id;
|
DevID^.id4:= device.vendor_id;
|
||||||
DevID^.ex:= nil;
|
DevID^.ex:= nil;
|
||||||
|
|
||||||
console.output('PCI', 'Found Device: ');
|
syslog.log('PCI', 'Found Device: ');
|
||||||
console.writehex(device.header_type);
|
syslog.writehex(device.header_type);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehex(device.device_id);
|
syslog.writehex(device.device_id);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehex(device.class_code);
|
syslog.writehex(device.class_code);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehex(device.subclass_class);
|
syslog.writehex(device.subclass_class);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehexln(device.prog_if);
|
syslog.writehexln(device.prog_if);
|
||||||
|
|
||||||
devices[device_count] := device;
|
devices[device_count] := device;
|
||||||
device_count := device_count + 1;
|
device_count := device_count + 1;
|
||||||
|
|||||||
+12
-12
@@ -23,7 +23,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
tracer,
|
tracer,
|
||||||
Console,
|
syslog,
|
||||||
PCI,
|
PCI,
|
||||||
drivertypes,
|
drivertypes,
|
||||||
pmemorymanager,
|
pmemorymanager,
|
||||||
@@ -44,19 +44,19 @@ var
|
|||||||
begin
|
begin
|
||||||
tracer.push_trace('UHCI.load');
|
tracer.push_trace('UHCI.load');
|
||||||
devices:= PCI.getDeviceInfo($0C, $03, $00, count);
|
devices:= PCI.getDeviceInfo($0C, $03, $00, count);
|
||||||
console.output('USB-UHCI Driver','Found ');
|
syslog.log('USB-UHCI Driver','Found ');
|
||||||
console.writeint(count);
|
syslog.writeint(count);
|
||||||
console.writestringln(' USB Controller(s).');
|
syslog.writestringln(' USB Controller(s).');
|
||||||
if count > 0 then begin
|
if count > 0 then begin
|
||||||
for i:=0 to count-1 do begin
|
for i:=0 to count-1 do begin
|
||||||
console.output('USB-UHCI Driver','Controller[');
|
syslog.log('USB-UHCI Driver','Controller[');
|
||||||
console.writeint(i);
|
syslog.writeint(i);
|
||||||
console.writestring(']: ');
|
syslog.writestring(']: ');
|
||||||
console.writehex(devices[i].device_id);
|
syslog.writehex(devices[i].device_id);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehex(devices[i].vendor_id);
|
syslog.writehex(devices[i].vendor_id);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehexln(devices[i].prog_if);
|
syslog.writehexln(devices[i].prog_if);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
load:= true;
|
load:= true;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
tracer,
|
tracer,
|
||||||
Console,
|
syslog,
|
||||||
PCI,
|
PCI,
|
||||||
drivertypes,
|
drivertypes,
|
||||||
pmemorymanager,
|
pmemorymanager,
|
||||||
@@ -69,7 +69,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('USB.init');
|
push_trace('USB.init');
|
||||||
console.outputln('USB Driver', 'INIT BEGIN.');
|
syslog.logln('USB Driver', 'INIT BEGIN.');
|
||||||
|
|
||||||
UHCI_ID.Bus:= biPCI;
|
UHCI_ID.Bus:= biPCI;
|
||||||
UHCI_ID.id0:= idANY;
|
UHCI_ID.id0:= idANY;
|
||||||
@@ -108,7 +108,7 @@ begin
|
|||||||
drivermanagement.register_driver('USB-EHCI Driver', @EHCI_ID, @loadEHCI);
|
drivermanagement.register_driver('USB-EHCI Driver', @EHCI_ID, @loadEHCI);
|
||||||
drivermanagement.register_driver('USB-XHCI Driver', @XHCI_ID, @loadXHCI);
|
drivermanagement.register_driver('USB-XHCI Driver', @XHCI_ID, @loadXHCI);
|
||||||
|
|
||||||
console.outputln('USB Driver', 'INIT END.');
|
syslog.logln('USB Driver', 'INIT END.');
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -23,7 +23,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
tracer,
|
tracer,
|
||||||
Console,
|
syslog,
|
||||||
PCI,
|
PCI,
|
||||||
drivertypes,
|
drivertypes,
|
||||||
pmemorymanager,
|
pmemorymanager,
|
||||||
@@ -44,19 +44,19 @@ var
|
|||||||
begin
|
begin
|
||||||
tracer.push_trace('XHCI.load');
|
tracer.push_trace('XHCI.load');
|
||||||
devices:= PCI.getDeviceInfo($0C, $03, $30, count);
|
devices:= PCI.getDeviceInfo($0C, $03, $30, count);
|
||||||
console.output('USB-XHCI Driver', 'Found ');
|
syslog.log('USB-XHCI Driver', 'Found ');
|
||||||
console.writeint(count);
|
syslog.writeint(count);
|
||||||
console.writestringln(' USB Controller(s).');
|
syslog.writestringln(' USB Controller(s).');
|
||||||
if count > 0 then begin
|
if count > 0 then begin
|
||||||
for i:=0 to count-1 do begin
|
for i:=0 to count-1 do begin
|
||||||
console.output('USB-XHCI Driver', 'Controller[');
|
syslog.log('USB-XHCI Driver', 'Controller[');
|
||||||
console.writeint(i);
|
syslog.writeint(i);
|
||||||
console.writestring(']: ');
|
syslog.writestring(']: ');
|
||||||
console.writehex(devices[i].device_id);
|
syslog.writehex(devices[i].device_id);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehex(devices[i].vendor_id);
|
syslog.writehex(devices[i].vendor_id);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehexln(devices[i].prog_if);
|
syslog.writehexln(devices[i].prog_if);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
load:= true;
|
load:= true;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ unit testdriver;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
tracer, console, drivermanagement;
|
tracer, syslog, drivermanagement;
|
||||||
|
|
||||||
procedure init;
|
procedure init;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ implementation
|
|||||||
function load(ptr : void) : boolean;
|
function load(ptr : void) : boolean;
|
||||||
begin
|
begin
|
||||||
push_trace('testdriver.load');
|
push_trace('testdriver.load');
|
||||||
console.outputln('DUMMY DRIVER', 'LOADED.');
|
syslog.logln('DUMMY DRIVER', 'LOADED.');
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
util,
|
util,
|
||||||
console,
|
|
||||||
isr_types,
|
isr_types,
|
||||||
isrmanager,
|
isrmanager,
|
||||||
IDT;
|
IDT;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ unit keyboard;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
console,
|
syslog,
|
||||||
util,
|
util,
|
||||||
PS2_KEYBOARD_ISR;
|
PS2_KEYBOARD_ISR;
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ function load(ptr : void) : boolean;
|
|||||||
begin
|
begin
|
||||||
PS2_KEYBOARD_ISR.register();
|
PS2_KEYBOARD_ISR.register();
|
||||||
PS2_KEYBOARD_ISR.hook(uint32(@callback));
|
PS2_KEYBOARD_ISR.hook(uint32(@callback));
|
||||||
console.outputln('PS/2 KEYBOARD', 'LOADED.');
|
syslog.logln('PS/2 KEYBOARD', 'LOADED.');
|
||||||
load:= true;
|
load:= true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ var
|
|||||||
devid : TDeviceIdentifier;
|
devid : TDeviceIdentifier;
|
||||||
|
|
||||||
begin
|
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();
|
if keyboard_layout[1].key_code = 0 then lang_USA();
|
||||||
devid.bus:= biUnknown;
|
devid.bus:= biUnknown;
|
||||||
devid.id0:= 0;
|
devid.id0:= 0;
|
||||||
@@ -113,7 +113,7 @@ begin
|
|||||||
devid.id4:= 0;
|
devid.id4:= 0;
|
||||||
devid.ex:= nil;
|
devid.ex:= nil;
|
||||||
drivermanagement.register_driver_ex('PS/2 Keyboard', @devid, @load, true);
|
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;
|
end;
|
||||||
//2A AA
|
//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
|
implementation
|
||||||
|
|
||||||
uses
|
{ no implementation uses }
|
||||||
console;
|
|
||||||
|
|
||||||
procedure soutb(port : uint16; val : uint8);
|
procedure soutb(port : uint16; val : uint8);
|
||||||
begin
|
begin
|
||||||
|
|||||||
@@ -22,16 +22,16 @@ unit netutils;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
tracer, util, nettypes, console, lmemorymanager, lists, strings;
|
tracer, util, nettypes, stdio, lmemorymanager, lists, strings;
|
||||||
|
|
||||||
procedure copyMAC(src : puint8; dst : puint8);
|
procedure copyMAC(src : puint8; dst : puint8);
|
||||||
procedure copyIPv4(src : puint8; dst : puint8);
|
procedure copyIPv4(src : puint8; dst : puint8);
|
||||||
function stringToMAC(str : pchar) : puint8;
|
function stringToMAC(str : pchar) : puint8;
|
||||||
function stringToIPv4(str : pchar) : puint8;
|
function stringToIPv4(str : pchar) : puint8;
|
||||||
procedure writeMACAddress(mac : puint8; WND : HWND);
|
procedure writeMACAddress(mac : puint8; outbuf : POutBuf);
|
||||||
procedure writeIPv4Address(ip : puint8; WND : HWND);
|
procedure writeIPv4Address(ip : puint8; outbuf : POutBuf);
|
||||||
procedure writeMACAddressEx(mac : puint8; WND : HWND);
|
procedure writeMACAddressEx(mac : puint8; outbuf : POutBuf);
|
||||||
procedure writeIPv4AddressEx(ip : puint8; WND : HWND);
|
procedure writeIPv4AddressEx(ip : puint8; outbuf : POutBuf);
|
||||||
function MACEqual(mac1 : puint8; mac2 : puint8) : boolean;
|
function MACEqual(mac1 : puint8; mac2 : puint8) : boolean;
|
||||||
function IPEqual(ip1 : puint8; ip2 : puint8) : boolean;
|
function IPEqual(ip1 : puint8; ip2 : puint8) : boolean;
|
||||||
function newPacketContext : PPacketContext;
|
function newPacketContext : PPacketContext;
|
||||||
@@ -172,59 +172,59 @@ begin
|
|||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure writeIPv4AddressEx(ip : puint8; WND : HWND);
|
procedure writeIPv4AddressEx(ip : puint8; outbuf : POutBuf);
|
||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('netutils.writeIPv4Address');
|
push_trace('netutils.writeIPv4Address');
|
||||||
console.writeintWND(ip[0], WND);
|
stdio.bufWriteInt(outbuf, ip[0]);
|
||||||
for i:=1 to 3 do begin
|
for i:=1 to 3 do begin
|
||||||
console.writestringWND('.', WND);
|
stdio.bufWriteStr(outbuf, '.');
|
||||||
console.writeintWND(ip[i], WND);
|
stdio.bufWriteInt(outbuf, ip[i]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure writeMACAddressEx(mac : puint8; WND : HWND);
|
procedure writeMACAddressEx(mac : puint8; outbuf : POutBuf);
|
||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('netutils.writeMACAddress');
|
push_trace('netutils.writeMACAddress');
|
||||||
console.writehexpairWND(mac[0], WND);
|
stdio.bufWriteHexPair(outbuf, mac[0]);
|
||||||
for i:=1 to 5 do begin
|
for i:=1 to 5 do begin
|
||||||
console.writestringWND(':', WND);
|
stdio.bufWriteStr(outbuf, ':');
|
||||||
console.writehexpairWND(mac[i], WND);
|
stdio.bufWriteHexPair(outbuf, mac[i]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure writeIPv4Address(ip : puint8; WND : HWND);
|
procedure writeIPv4Address(ip : puint8; outbuf : POutBuf);
|
||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('netutils.writeIPv4Address');
|
push_trace('netutils.writeIPv4Address');
|
||||||
console.writeintWND(ip[0], WND);
|
stdio.bufWriteInt(outbuf, ip[0]);
|
||||||
for i:=1 to 3 do begin
|
for i:=1 to 3 do begin
|
||||||
console.writestringWND('.', WND);
|
stdio.bufWriteStr(outbuf, '.');
|
||||||
console.writeintWND(ip[i], WND);
|
stdio.bufWriteInt(outbuf, ip[i]);
|
||||||
end;
|
end;
|
||||||
console.writestringlnWND(' ', WND);
|
stdio.bufWriteStrLn(outbuf, ' ');
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure writeMACAddress(mac : puint8; WND : HWND);
|
procedure writeMACAddress(mac : puint8; outbuf : POutBuf);
|
||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('netutils.writeMACAddress');
|
push_trace('netutils.writeMACAddress');
|
||||||
console.writehexpairWND(mac[0], WND);
|
stdio.bufWriteHexPair(outbuf, mac[0]);
|
||||||
for i:=1 to 5 do begin
|
for i:=1 to 5 do begin
|
||||||
console.writestringWND(':', WND);
|
stdio.bufWriteStr(outbuf, ':');
|
||||||
console.writehexpairWND(mac[i], WND);
|
stdio.bufWriteHexPair(outbuf, mac[i]);
|
||||||
end;
|
end;
|
||||||
console.writestringlnWND(' ', WND);
|
stdio.bufWriteStrLn(outbuf, ' ');
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
+16
-22
@@ -23,9 +23,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
tracer,
|
tracer,
|
||||||
console,
|
|
||||||
nettypes, netutils,
|
nettypes, netutils,
|
||||||
netlog,
|
syslog,
|
||||||
RTC;
|
RTC;
|
||||||
|
|
||||||
procedure init;
|
procedure init;
|
||||||
@@ -39,8 +38,7 @@ procedure writeToLogLn(str : pchar);
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
terminal,
|
|
||||||
e1000, //dev
|
e1000, //dev
|
||||||
eth2, //L2
|
eth2, //L2
|
||||||
arp, ipv4, //L3
|
arp, ipv4, //L3
|
||||||
@@ -57,32 +55,28 @@ var
|
|||||||
DateTime : TDateTime;
|
DateTime : TDateTime;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if getNetlogHWND <> 0 then begin
|
DateTime:= getDateTime;
|
||||||
DateTime:= getDateTime;
|
syslog.writestring('[');
|
||||||
writeStringWND('[', getNetlogHWND);
|
|
||||||
|
|
||||||
if DateTime.Hours < 10 then writeIntWND(0, getNetlogHWND);
|
if DateTime.Hours < 10 then syslog.writeint(0);
|
||||||
writeIntWND(DateTime.Hours, getNetlogHWND);
|
syslog.writeint(DateTime.Hours);
|
||||||
writeStringWND(':', getNetlogHWND);
|
syslog.writestring(':');
|
||||||
|
|
||||||
if DateTime.Minutes < 10 then writeIntWND(0, getNetlogHWND);
|
if DateTime.Minutes < 10 then syslog.writeint(0);
|
||||||
writeIntWND(DateTime.Minutes, getNetlogHWND);
|
syslog.writeint(DateTime.Minutes);
|
||||||
writeStringWND(':', getNetlogHWND);
|
syslog.writestring(':');
|
||||||
|
|
||||||
if DateTime.Seconds < 10 then writeIntWND(0, getNetlogHWND);
|
if DateTime.Seconds < 10 then syslog.writeint(0);
|
||||||
writeIntWND(DateTime.Seconds, getNetlogHWND);
|
syslog.writeint(DateTime.Seconds);
|
||||||
writeStringWND('] ', getNetlogHWND);
|
syslog.writestring('] ');
|
||||||
|
|
||||||
writeStringWND(str, getNetlogHWND);
|
syslog.writestring(str);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure writeToLogLn(str : pchar);
|
procedure writeToLogLn(str : pchar);
|
||||||
begin
|
begin
|
||||||
writeToLog(str);
|
writeToLog(str);
|
||||||
if getNetlogHWND <> 0 then begin
|
syslog.writestringln(' ');
|
||||||
writestringlnWND(' ', getNetlogHWND);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure registerNetworkCard(SendCallback : TNetSendCallback; _MAC : puint8);
|
procedure registerNetworkCard(SendCallback : TNetSendCallback; _MAC : puint8);
|
||||||
|
|||||||
@@ -24,10 +24,8 @@ interface
|
|||||||
uses
|
uses
|
||||||
lmemorymanager, util,
|
lmemorymanager, util,
|
||||||
tracer,
|
tracer,
|
||||||
nettypes, netutils, terminal,
|
nettypes, netutils,
|
||||||
net,
|
net,
|
||||||
netlog,
|
|
||||||
console,
|
|
||||||
crc;
|
crc;
|
||||||
|
|
||||||
procedure send(p_data : void; p_len : uint16; eth_type : uint16; p_context : PPacketContext);
|
procedure send(p_data : void; p_len : uint16; eth_type : uint16; p_context : PPacketContext);
|
||||||
|
|||||||
+13
-11
@@ -23,9 +23,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
tracer, lmemorymanager,
|
tracer, lmemorymanager,
|
||||||
util, lists, console, terminal,
|
util, lists,
|
||||||
net, nettypes, netutils,
|
net, nettypes, netutils,
|
||||||
netlog,
|
|
||||||
eth2, ipv4;
|
eth2, ipv4;
|
||||||
|
|
||||||
type
|
type
|
||||||
@@ -45,6 +44,9 @@ function resolveIP(ip : puint8) : puint8;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
stdio, strings;
|
||||||
|
|
||||||
var
|
var
|
||||||
Registered : Boolean = false;
|
Registered : Boolean = false;
|
||||||
Cache : PLinkedListBase;
|
Cache : PLinkedListBase;
|
||||||
@@ -263,7 +265,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure terminal_command_arp(Params : PParamList);
|
procedure terminal_command_arp(Params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
|
||||||
var
|
var
|
||||||
i : uint32;
|
i : uint32;
|
||||||
elm : PARPCacheRecord;
|
elm : PARPCacheRecord;
|
||||||
@@ -275,19 +277,19 @@ begin
|
|||||||
sIP:= getParam(0, Params);
|
sIP:= getParam(0, Params);
|
||||||
_IP:= stringToIPv4(sIP);
|
_IP:= stringToIPv4(sIP);
|
||||||
sendRequest(_IP);
|
sendRequest(_IP);
|
||||||
writestringlnWND('ARP Request Sent.', getTerminalHWND);
|
stdio.bufWriteStrLn(stdout_buf, 'ARP Request Sent.');
|
||||||
end else begin
|
end else begin
|
||||||
if LL_Size(Cache) > 0 then 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
|
For i:=0 to LL_Size(Cache)-1 do begin
|
||||||
elm:= PARPCacheRecord(LL_Get(Cache, i));
|
elm:= PARPCacheRecord(LL_Get(Cache, i));
|
||||||
writeMACAddressEx(@elm^.MAC[0], getTerminalHWND);
|
writeMACAddressEx(@elm^.MAC[0], stdout_buf);
|
||||||
writestringWND(' ', getTerminalHWND);
|
stdio.bufWriteStr(stdout_buf, ' ');
|
||||||
writeIPv4AddressEx(@elm^.IP[0], getTerminalHWND);
|
writeIPv4AddressEx(@elm^.IP[0], stdout_buf);
|
||||||
writestringlnWND(' ', getTerminalHWND);
|
stdio.bufWriteStrLn(stdout_buf, ' ');
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
writestringlnWND('No entries in ARP table.', getTerminalHWND);
|
stdio.bufWriteStrLn(stdout_buf, 'No entries in ARP table.');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -298,7 +300,7 @@ begin
|
|||||||
if not Registered then begin
|
if not Registered then begin
|
||||||
Cache:= LL_New(sizeof(TARPCacheRecord));
|
Cache:= LL_New(sizeof(TARPCacheRecord));
|
||||||
eth2.registerTypePromisc($0806, @recv);
|
eth2.registerTypePromisc($0806, @recv);
|
||||||
terminal.registerCommand('ARP', @terminal_command_arp, 'Get ARP Table.');
|
stdio.registerCommand('ARP', @terminal_command_arp, 'Get ARP Table.');
|
||||||
Registered:= true;
|
Registered:= true;
|
||||||
end;
|
end;
|
||||||
pop_trace;
|
pop_trace;
|
||||||
|
|||||||
+15
-16
@@ -23,9 +23,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
tracer, lmemorymanager,
|
tracer, lmemorymanager,
|
||||||
util, console, terminal, strings,
|
util, strings,
|
||||||
net, nettypes, netutils,
|
net, nettypes, netutils,
|
||||||
netlog,
|
|
||||||
lists,
|
lists,
|
||||||
eth2;
|
eth2;
|
||||||
|
|
||||||
@@ -37,7 +36,7 @@ procedure register;
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
arp;
|
arp, stdio;
|
||||||
|
|
||||||
var
|
var
|
||||||
Registered : Boolean = false;
|
Registered : Boolean = false;
|
||||||
@@ -132,7 +131,7 @@ begin
|
|||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure terminal_command_ifconfig(params : PParamList);
|
procedure terminal_command_ifconfig(params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
|
||||||
var
|
var
|
||||||
Command, Sub, Address, Gateway, Netmask : pchar;
|
Command, Sub, Address, Gateway, Netmask : pchar;
|
||||||
_Address, _Gateway, _Netmask : puint8;
|
_Address, _Gateway, _Netmask : puint8;
|
||||||
@@ -158,7 +157,7 @@ begin
|
|||||||
kfree(void(_Gateway));
|
kfree(void(_Gateway));
|
||||||
kfree(void(_Netmask));
|
kfree(void(_Netmask));
|
||||||
end else begin
|
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;
|
||||||
end;
|
end;
|
||||||
if StringEquals(Command, 'net') then begin
|
if StringEquals(Command, 'net') then begin
|
||||||
@@ -174,18 +173,18 @@ begin
|
|||||||
CopyIPv4(@Config.Gateway[0], @Target[0]);
|
CopyIPv4(@Config.Gateway[0], @Target[0]);
|
||||||
arp.sendRequest(@Target[0]);
|
arp.sendRequest(@Target[0]);
|
||||||
end else begin
|
end else begin
|
||||||
writestringWND(' MAC: ', getTerminalHWND);
|
stdio.bufWriteStr(stdout_buf, ' MAC: ');
|
||||||
writeMACAddress(net.GetMAC, getTerminalHWND);
|
writeMACAddress(net.GetMAC, stdout_buf);
|
||||||
writestringWND(' IPv4: ', getTerminalHWND);
|
stdio.bufWriteStr(stdout_buf, ' IPv4: ');
|
||||||
writeIPv4Address(@Config.Address[0], getTerminalHWND);
|
writeIPv4Address(@Config.Address[0], stdout_buf);
|
||||||
writestringWND(' Gateway: ', getTerminalHWND);
|
stdio.bufWriteStr(stdout_buf, ' Gateway: ');
|
||||||
writeIPv4Address(@Config.Gateway[0], getTerminalHWND);
|
writeIPv4Address(@Config.Gateway[0], stdout_buf);
|
||||||
writestringWND(' Netmask: ', getTerminalHWND);
|
stdio.bufWriteStr(stdout_buf, ' Netmask: ');
|
||||||
writeIPv4Address(@Config.Netmask[0], getTerminalHWND);
|
writeIPv4Address(@Config.Netmask[0], stdout_buf);
|
||||||
if Config.UP then
|
if Config.UP then
|
||||||
writestringlnWND(' NetUP: true', getTerminalHWND)
|
stdio.bufWriteStrLn(stdout_buf, ' NetUP: true')
|
||||||
else
|
else
|
||||||
writestringlnWND(' NetUP: false', getTerminalHWND);
|
stdio.bufWriteStrLn(stdout_buf, ' NetUP: false');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -206,7 +205,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
Config.UP:= false;
|
Config.UP:= false;
|
||||||
eth2.registerType($0800, @recv);
|
eth2.registerType($0800, @recv);
|
||||||
terminal.registerCommand('IFCONFIG', @terminal_command_ifconfig, 'Configure Network Settings.');
|
stdio.registerCommand('IFCONFIG', @terminal_command_ifconfig, 'Configure Network Settings.');
|
||||||
Registered:= true;
|
Registered:= true;
|
||||||
end;
|
end;
|
||||||
pop_trace;
|
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