Compare commits

..
Author SHA1 Message Date
t3hn3rd f53afc1d2d feature: Tracer O(1) ring buffer refactor
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
- Replaced O(n) shift loop + StringCopy/kalloc/kfree with O(1) ring
  buffer storing PChar pointers directly (zero allocation).
- Eliminated mod operator (causes int64 promotion + broken RTL helpers
  on i386 bare-metal); uses pure uint32 branch arithmetic.
- Removed dead code: PTracerEntry/TTracerEntry linked list types,
  head/tail PTracerEntry vars, c_lock boolean
- Dropped lmemorymanager and serial from uses clause
- pop_trace remains as no-op stub for ABI compat
- get_trace_N uses underflow-safe index: if head >= idx then
  head - idx else MAX_TRACE - (idx - head)
- Added print_traces debug helper
2026-03-01 21:26:35 +00:00
admin afdc83eaf6 Merge pull request 'Merge feature/hardening into develop' (#11) from feature/hardening into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #11
2026-03-01 02:57:23 +00:00
t3hn3rd 2239d9c848 Rebase: Fixed console -> syslog interface
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-03-01 02:46:13 +00:00
t3hn3rd beb4b253ab fix: guard against uint32 underflow in memset/memcpy and strings unit
When size=0 was passed to memset() or memcpy(), the loop bound
`0 to size-1` underflowed to $FFFFFFFF, iterating ~4 billion times
and causing an immediate page fault.

Added `if size = 0 then exit` guards to both memset() and memcpy()
in util.pas.

Also guarded all `for i:=0 to X-1` loops in strings.pas where X
could be 0 on empty string inputs:
- stringToUpper: wrap loop in `if stringSize > 0`
- stringToLower: wrap loop in `if stringSize > 0`
- stringEquals: early exit when both sizes are 0
- stringToInt: early exit when string is empty

Additionally fixed all previously identified bugs in strings.pas:
- hexStringToInt: guard against empty string underflow
- stringConcat: cache stringSize calls to avoid redundant O(n) scans
- stringTrim: clamp length to source string size
- stringSub: bounds check start/size against source length
- stringReplace: complete rewrite - was using stringEquals() for
  substring matching (only matched at string end), dropped prefix
  chars, had dangling assignment overwriting valid result with
  uninitialized pointer, and had unused variable
- stringIndexOf: rewritten to use new stringMatchAt() helper for
  correct substring matching
- stringContains: simplified to delegate to fixed stringIndexOf(),
  also fixing uint32 underflow when sub was empty
- stringToInt: removed always-true `v >= 0` check on uint32
- intToString: implemented (was a stub returning ' ')
- Added stringMatchAt() helper for prefix comparison
- Added comprehensive UnitTest procedure with 77 assertions
  including adversarial empty/nil/boundary inputs
2026-03-01 02:33:28 +00:00
admin 084130da80 Merge pull request 'feat: VESA rendering implementation & LVGL for graphics drawing' (#10) from feature/lvgl into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #10
2026-03-01 02:25:47 +00:00
t3hn3rd f752be48ce refactor/feature/fix: Major refactor of codebase
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
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.
2026-03-01 02:06:31 +00:00
t3hn3rd dbe6e958e2 fix: More changes for Hyper-V PS/2 mouse compatability
continuous-integration/drone/push Build is passing
2026-02-28 22:54:19 +00:00
t3hn3rd 201cda4c29 fix: Pipeline fixes for temporary lvgl directory
continuous-integration/drone/push Build is passing
- Fixed missing lvgl artefacts for build pipeline causing drone failures.
2026-02-28 16:48:41 +00:00
t3hn3rd e54b34aa93 fix: gate AVX enable on XSAVE support and set CR4.OSXSAVE first
continuous-integration/drone/push Build is failing
XGETBV/XSETBV require CR4 bit 18 (OSXSAVE) to be set before execution,
otherwise the CPU raises #UD (invalid opcode). Hyper-V enforces this
strictly; VirtualBox was silently tolerating it.

- Check both AVX and XSAVE CPUID flags before attempting AVX enable
- Set CR4.OSXSAVE (bit 18) before issuing XGETBV/XSETBV
- If XSAVE is not exposed by the hypervisor, AVX enable is skipped
  gracefully instead of faulting
2026-02-28 16:31:57 +00:00
t3hn3rd fcfe7c3204 fix: Mouse driver Hyper-V compatibility + resolution-independent bounds clamping
- Add mouse_wait_long() with 100,000 iteration timeout for init-time
  i8042 controller commands (mouse_write/mouse_read/load). The original
  mouse_wait() stays at 100 iterations for ISR-safe use in main().

- In load(): use mouse_wait_long() for all direct port I/O ($64/$60)
  and clear CCB bit 5 (AND NOT $20) to ensure the mouse clock is not
  disabled — required for Hyper-V which enforces this strictly.

- Replace Console.getConsoleProperties^.Width/Height with
  video.frontBufferWidth/Height for mouse bounds clamping. The old
  console properties are zero when console.init() is not called,
  which locked the cursor to (0,0). Add 'video' to uses clause.
2026-02-28 16:31:26 +00:00
admin 924305a1ab Merge pull request 'Migration from FPC 2.6.4 to FPC 3.2.2' (#9) from feature/fpc-3.2.2 into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #9
2026-02-26 12:51:09 +00:00
94 changed files with 15448 additions and 5943 deletions

No files matched your search

+4 -3
View File
@@ -107,9 +107,10 @@ fi
# Copy source + objects to /lvgl host mount for debugging # Copy source + objects to /lvgl host mount for debugging
echo "Copying LVGL source and objects to host mount..." echo "Copying LVGL source and objects to host mount..."
rm -rf /lvgl/* /lvgl/.[!.]* /lvgl/..?* 2>/dev/null || true mkdir /code/lvgl 2>/dev/null || true
cp -a "$LVGL_DIR/src" /lvgl/src rm -rf /code/lvgl/* /code/lvgl/.[!.]* /code/lvgl/..?* 2>/dev/null || true
cp -a "$OBJ_DIR" /lvgl/obj cp -a "$LVGL_DIR/src" /code/lvgl/src
cp -a "$OBJ_DIR" /code/lvgl/obj
echo "Done." echo "Done."
echo " " echo " "
-1
View File
@@ -3,4 +3,3 @@ services:
build: . build: .
volumes: volumes:
- .:/code - .:/code
- ./lvgl:/lvgl
+12886
View File
File diff suppressed because it is too large. Load diff
-2710
View File
File diff suppressed because it is too large. Load diff
+80 -70
View File
File diff suppressed because it is too large. Load diff
+12 -12
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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;
+3 -3
View File
@@ -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
View File
@@ -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;
+2 -2
View File
@@ -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;
-1
View File
@@ -24,7 +24,6 @@ interface
uses uses
util, util,
console,
isr_types, isr_types,
isrmanager, isrmanager,
IDT; IDT;
+4 -4
View File
@@ -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
+103 -67
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+1 -2
View File
@@ -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
+23 -23
View File
@@ -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;
+14 -20
View File
@@ -23,9 +23,8 @@ interface
uses uses
tracer, tracer,
console,
nettypes, netutils, nettypes, netutils,
netlog, syslog,
RTC; RTC;
procedure init; procedure init;
@@ -40,7 +39,6 @@ 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);
+1 -3
View File
@@ -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);
Loaded 20 of 94 files, more files were not shown because too many files have changed in this diff. Show more