Namespace Restructure #54
@@ -18,3 +18,4 @@ lessons_learnt.md
|
|||||||
*.log
|
*.log
|
||||||
/doc/*.md
|
/doc/*.md
|
||||||
wasuro
|
wasuro
|
||||||
|
src/core/core.version.pas
|
||||||
|
|||||||
+28
-26
@@ -39,7 +39,6 @@ src/
|
|||||||
│ ├── arch.x86.irq.pas
|
│ ├── arch.x86.irq.pas
|
||||||
│ ├── arch.x86.isr.pas
|
│ ├── arch.x86.isr.pas
|
||||||
│ ├── arch.x86.cpu.pas
|
│ ├── arch.x86.cpu.pas
|
||||||
│ ├── arch.x86.faults.pas
|
|
||||||
│ ├── arch.x86.util.pas # x86 I/O: outb/inb, CLI/STI, TSC, BSOD
|
│ ├── arch.x86.util.pas # x86 I/O: outb/inb, CLI/STI, TSC, BSOD
|
||||||
│ ├── arch.x86.multiboot.pas
|
│ ├── arch.x86.multiboot.pas
|
||||||
│ ├── arch.x86.bda.pas # BIOS Data Area
|
│ ├── arch.x86.bda.pas # BIOS Data Area
|
||||||
@@ -49,6 +48,7 @@ src/
|
|||||||
│ │ └── stub.asm # Multiboot boot stub (NASM)
|
│ │ └── stub.asm # Multiboot boot stub (NASM)
|
||||||
│ │
|
│ │
|
||||||
│ ├── fault/
|
│ ├── fault/
|
||||||
|
│ │ ├── arch.x86.fault.pas
|
||||||
│ │ ├── arch.x86.fault.ace.pas
|
│ │ ├── arch.x86.fault.ace.pas
|
||||||
│ │ ├── arch.x86.fault.bpe.pas
|
│ │ ├── arch.x86.fault.bpe.pas
|
||||||
│ │ ├── arch.x86.fault.btsse.pas
|
│ │ ├── arch.x86.fault.btsse.pas
|
||||||
@@ -171,8 +171,8 @@ src/
|
|||||||
│ │ ├── driver.hid.usb.keyboard.pas
|
│ │ ├── driver.hid.usb.keyboard.pas
|
||||||
│ │ └── driver.hid.usb.mouse.pas
|
│ │ └── driver.hid.usb.mouse.pas
|
||||||
│ │
|
│ │
|
||||||
│ ├── interface/
|
│ ├── io/
|
||||||
│ │ └── driver.interface.serial.pas
|
│ │ └── driver.io.serial.pas
|
||||||
│ │
|
│ │
|
||||||
│ ├── timer/
|
│ ├── timer/
|
||||||
│ │ └── driver.timer.rtc.pas
|
│ │ └── driver.timer.rtc.pas
|
||||||
@@ -217,16 +217,18 @@ src/
|
|||||||
│ ├── net/
|
│ ├── net/
|
||||||
│ │ ├── driver.net.types.pas
|
│ │ ├── driver.net.types.pas
|
||||||
│ │ ├── driver.net.util.pas
|
│ │ ├── driver.net.util.pas
|
||||||
│ │ ├── driver.net.eth2.pas
|
│ │ │
|
||||||
│ │ ├── driver.net.arp.pas
|
│ │ ├── proto/
|
||||||
│ │ ├── driver.net.ipv4.pas
|
│ │ │ ├── driver.net.proto.eth2.pas
|
||||||
│ │ ├── driver.net.icmp.pas
|
│ │ │ ├── driver.net.proto.arp.pas
|
||||||
│ │ ├── driver.net.tcp.pas
|
│ │ │ ├── driver.net.proto.ipv4.pas
|
||||||
│ │ ├── driver.net.udp.pas
|
│ │ │ ├── driver.net.proto.icmp.pas
|
||||||
│ │ └── driver.net.dhcp.pas
|
│ │ │ ├── driver.net.proto.tcp.pas
|
||||||
│ │
|
│ │ │ ├── driver.net.proto.udp.pas
|
||||||
│ ├── netdev/
|
│ │ │ └── driver.net.proto.dhcp.pas
|
||||||
│ │ └── driver.netdev.e1000.pas
|
│ │ │
|
||||||
|
│ │ └── dev/
|
||||||
|
│ │ └── driver.net.dev.e1000.pas
|
||||||
│ │
|
│ │
|
||||||
│ ├── video/
|
│ ├── video/
|
||||||
│ │ ├── driver.video.types.pas
|
│ │ ├── driver.video.types.pas
|
||||||
@@ -293,7 +295,7 @@ src/
|
|||||||
| `irq.pas` | `arch/x86/arch.x86.irq.pas` | `irq` | `arch.x86.irq` |
|
| `irq.pas` | `arch/x86/arch.x86.irq.pas` | `irq` | `arch.x86.irq` |
|
||||||
| `isr.pas` | `arch/x86/arch.x86.isr.pas` | `isr` | `arch.x86.isr` |
|
| `isr.pas` | `arch/x86/arch.x86.isr.pas` | `isr` | `arch.x86.isr` |
|
||||||
| `cpu.pas` | `arch/x86/arch.x86.cpu.pas` | `cpu` | `arch.x86.cpu` |
|
| `cpu.pas` | `arch/x86/arch.x86.cpu.pas` | `cpu` | `arch.x86.cpu` |
|
||||||
| `faults.pas` | `arch/x86/arch.x86.faults.pas` | `faults` | `arch.x86.faults` |
|
| `faults.pas` | `arch/x86/fault/arch.x86.fault.pas` | `faults` | `arch.x86.fault` |
|
||||||
| `contextswitcher.pas` | `arch/x86/proc/arch.x86.proc.sched.pas` | `contextswitcher` | `arch.x86.proc.sched` |
|
| `contextswitcher.pas` | `arch/x86/proc/arch.x86.proc.sched.pas` | `contextswitcher` | `arch.x86.proc.sched` |
|
||||||
| `processloader.pas` | `arch/x86/proc/arch.x86.proc.loader.pas` | `processloader` | `arch.x86.proc.loader` |
|
| `processloader.pas` | `arch/x86/proc/arch.x86.proc.loader.pas` | `processloader` | `arch.x86.proc.loader` |
|
||||||
| `v86.pas` | `arch/x86/arch.x86.v86.pas` | `v86` | `arch.x86.v86` |
|
| `v86.pas` | `arch/x86/arch.x86.v86.pas` | `v86` | `arch.x86.v86` |
|
||||||
@@ -462,11 +464,11 @@ src/
|
|||||||
| `driver/hid/usb/usb_keyboard.pas` | `driver/hid/usb/driver.hid.usb.keyboard.pas` | `usb_keyboard` | `driver.hid.usb.keyboard` |
|
| `driver/hid/usb/usb_keyboard.pas` | `driver/hid/usb/driver.hid.usb.keyboard.pas` | `usb_keyboard` | `driver.hid.usb.keyboard` |
|
||||||
| `driver/hid/usb/usb_mouse.pas` | `driver/hid/usb/driver.hid.usb.mouse.pas` | `usb_mouse` | `driver.hid.usb.mouse` |
|
| `driver/hid/usb/usb_mouse.pas` | `driver/hid/usb/driver.hid.usb.mouse.pas` | `usb_mouse` | `driver.hid.usb.mouse` |
|
||||||
|
|
||||||
### Driver — Interface (`driver/interface/`)
|
### Driver — IO (`driver/io/`)
|
||||||
|
|
||||||
| Old path | New path | Old unit | New unit |
|
| Old path | New path | Old unit | New unit |
|
||||||
|----------|----------|----------|----------|
|
|----------|----------|----------|----------|
|
||||||
| `driver/interface/serial.pas` | `driver/interface/driver.interface.serial.pas` | `serial` | `driver.interface.serial` |
|
| `driver/io/serial.pas` | `driver/io/driver.io.serial.pas` | `serial` | `driver.io.serial` |
|
||||||
|
|
||||||
### Driver — Timer (`driver/timer/`)
|
### Driver — Timer (`driver/timer/`)
|
||||||
|
|
||||||
@@ -536,21 +538,21 @@ src/
|
|||||||
| `driver/net/l1/net.pas` | `driver/driver.net.pas` | `net` | `driver.net` |
|
| `driver/net/l1/net.pas` | `driver/driver.net.pas` | `net` | `driver.net` |
|
||||||
| `driver/net/include/nettypes.pas` | `driver/net/driver.net.types.pas` | `nettypes` | `driver.net.types` |
|
| `driver/net/include/nettypes.pas` | `driver/net/driver.net.types.pas` | `nettypes` | `driver.net.types` |
|
||||||
| `driver/net/include/netutils.pas` | `driver/net/driver.net.util.pas` | `netutils` | `driver.net.util` |
|
| `driver/net/include/netutils.pas` | `driver/net/driver.net.util.pas` | `netutils` | `driver.net.util` |
|
||||||
| `driver/net/l2/eth2.pas` | `driver/net/driver.net.eth2.pas` | `eth2` | `driver.net.eth2` |
|
| `driver/net/l2/eth2.pas` | `driver/net/proto/driver.net.proto.eth2.pas` | `eth2` | `driver.net.proto.eth2` |
|
||||||
| `driver/net/l3/arp.pas` | `driver/net/driver.net.arp.pas` | `arp` | `driver.net.arp` |
|
| `driver/net/l3/arp.pas` | `driver/net/proto/driver.net.proto.arp.pas` | `arp` | `driver.net.proto.arp` |
|
||||||
| `driver/net/l3/ipv4.pas` | `driver/net/driver.net.ipv4.pas` | `ipv4` | `driver.net.ipv4` |
|
| `driver/net/l3/ipv4.pas` | `driver/net/proto/driver.net.proto.ipv4.pas` | `ipv4` | `driver.net.proto.ipv4` |
|
||||||
| `driver/net/l4/icmp.pas` | `driver/net/driver.net.icmp.pas` | `icmp` | `driver.net.icmp` |
|
| `driver/net/l4/icmp.pas` | `driver/net/proto/driver.net.proto.icmp.pas` | `icmp` | `driver.net.proto.icmp` |
|
||||||
| `driver/net/l4/tcp.pas` | `driver/net/driver.net.tcp.pas` | `tcp` | `driver.net.tcp` |
|
| `driver/net/l4/tcp.pas` | `driver/net/proto/driver.net.proto.tcp.pas` | `tcp` | `driver.net.proto.tcp` |
|
||||||
| `driver/net/l4/udp.pas` | `driver/net/driver.net.udp.pas` | `udp` | `driver.net.udp` |
|
| `driver/net/l4/udp.pas` | `driver/net/proto/driver.net.proto.udp.pas` | `udp` | `driver.net.proto.udp` |
|
||||||
| `driver/net/l5/dhcp.pas` | `driver/net/driver.net.dhcp.pas` | `dhcp` | `driver.net.dhcp` |
|
| `driver/net/l5/dhcp.pas` | `driver/net/proto/driver.net.proto.dhcp.pas` | `dhcp` | `driver.net.proto.dhcp` |
|
||||||
|
|
||||||
> **Note:** The old layer folders (`l1/`, `l2/`, `l3/`, `l4/`, `l5/`, `include/`) are flattened — protocol names are self-descriptive.
|
> **Note:** The old layer folders (`l1/`, `l2/`, `l3/`, `l4/`, `l5/`, `include/`) are now grouped under `proto/` — protocol names are self-descriptive.
|
||||||
|
|
||||||
### Driver — Network Device (`driver/netdev/`)
|
### Driver — Network Device (`driver/net/dev/`)
|
||||||
|
|
||||||
| Old path | New path | Old unit | New unit |
|
| Old path | New path | Old unit | New unit |
|
||||||
|----------|----------|----------|----------|
|
|----------|----------|----------|----------|
|
||||||
| `driver/netdev/E1000.pas` | `driver/netdev/driver.netdev.e1000.pas` | `E1000` | `driver.netdev.e1000` |
|
| `driver/netdev/E1000.pas` | `driver/net/dev/driver.net.dev.e1000.pas` | `E1000` | `driver.net.dev.e1000` |
|
||||||
|
|
||||||
### Driver — Video (`driver/video/`)
|
### Driver — Video (`driver/video/`)
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ unit app.dhclient;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
io.stdio, core.util, arch.x86.util, core.strings, debug.tracer, driver.net.dhcp;
|
io.stdio, core.util, arch.x86.util, core.strings, debug.tracer, driver.net.proto.dhcp;
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -29,7 +29,7 @@ uses
|
|||||||
//drivers
|
//drivers
|
||||||
driver.storage.ctl.ram, driver.mgr,
|
driver.storage.ctl.ram, driver.mgr,
|
||||||
//network
|
//network
|
||||||
driver.net.ipv4, driver.net.arp, driver.net.tcp,
|
driver.net.proto.ipv4, driver.net.proto.arp, driver.net.proto.tcp,
|
||||||
//dispatch
|
//dispatch
|
||||||
driver.storage.filedispatch,
|
driver.storage.filedispatch,
|
||||||
//wasm
|
//wasm
|
||||||
@@ -56,11 +56,11 @@ begin
|
|||||||
io.stdio.registerCommand('PS', @proc.mgr.terminal_command_ps, 'List running processes.');
|
io.stdio.registerCommand('PS', @proc.mgr.terminal_command_ps, 'List running processes.');
|
||||||
io.stdio.registerCommand('KILL', @proc.mgr.terminal_command_kill, 'Force-kill a process by PID.');
|
io.stdio.registerCommand('KILL', @proc.mgr.terminal_command_kill, 'Force-kill a process by PID.');
|
||||||
io.stdio.registerCommand('TERMINATE', @proc.mgr.terminal_command_terminate, 'Gracefully terminate a process by PID.');
|
io.stdio.registerCommand('TERMINATE', @proc.mgr.terminal_command_terminate, 'Gracefully terminate a process by PID.');
|
||||||
io.stdio.registerCommand('ARP', @driver.net.arp.terminal_command_arp, 'Get ARP Table.');
|
io.stdio.registerCommand('ARP', @driver.net.proto.arp.terminal_command_arp, 'Get ARP Table.');
|
||||||
io.stdio.registerCommand('IFCONFIG', @driver.net.ipv4.terminal_command_ifconfig, 'Configure Network Settings.');
|
io.stdio.registerCommand('IFCONFIG', @driver.net.proto.ipv4.terminal_command_ifconfig, 'Configure Network Settings.');
|
||||||
io.stdio.registerCommand('TCPCONNECT', @driver.net.tcp.terminal_command_tcpconnect, 'Connect to a TCP host and send Hello World.');
|
io.stdio.registerCommand('TCPCONNECT', @driver.net.proto.tcp.terminal_command_tcpconnect, 'Connect to a TCP host and send Hello World.');
|
||||||
io.stdio.registerCommand('TCPLISTEN', @driver.net.tcp.terminal_command_tcplisten, 'Listen on a TCP port and log received data.');
|
io.stdio.registerCommand('TCPLISTEN', @driver.net.proto.tcp.terminal_command_tcplisten, 'Listen on a TCP port and log received data.');
|
||||||
io.stdio.registerCommand('TCPHTTP', @driver.net.tcp.terminal_command_tcphttp, 'Send HTTP GET to a host IP (port 80 default).');
|
io.stdio.registerCommand('TCPHTTP', @driver.net.proto.tcp.terminal_command_tcphttp, 'Send HTTP GET to a host IP (port 80 default).');
|
||||||
io.stdio.registerCommand('USB', @driver.bus.usb.core.terminal_command_usb, 'driver.bus.usb subsystem information.');
|
io.stdio.registerCommand('USB', @driver.bus.usb.core.terminal_command_usb, 'driver.bus.usb subsystem information.');
|
||||||
|
|
||||||
{ Initialize baked-in programs }
|
{ Initialize baked-in programs }
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ procedure init();
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
arch.x86.bda, driver.net.types, driver.net.icmp, driver.net.util, core.strings,
|
arch.x86.bda, driver.net.types, driver.net.proto.icmp, driver.net.util, core.strings,
|
||||||
proc.mgr, core.util, arch.x86.util, memory.heap;
|
proc.mgr, core.util, arch.x86.util, memory.heap;
|
||||||
|
|
||||||
const
|
const
|
||||||
@@ -93,7 +93,7 @@ begin
|
|||||||
{ Send ICMP echo request }
|
{ Send ICMP echo request }
|
||||||
st^.Result := prWaiting;
|
st^.Result := prWaiting;
|
||||||
st^.SendTime := Counters.c64;
|
st^.SendTime := Counters.c64;
|
||||||
driver.net.icmp.sendICMPRequest(ip, i, 128, @on_reply, @on_error, void(st));
|
driver.net.proto.icmp.sendICMPRequest(ip, i, 128, @on_reply, @on_error, void(st));
|
||||||
|
|
||||||
{ Spin-yield until callback fires or timeout }
|
{ Spin-yield until callback fires or timeout }
|
||||||
tStart := Counters.c32;
|
tStart := Counters.c32;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ uses
|
|||||||
arch.x86.cpu,
|
arch.x86.cpu,
|
||||||
arch.x86.isr.types,
|
arch.x86.isr.types,
|
||||||
driver.timer.rtc,
|
driver.timer.rtc,
|
||||||
driver.intf.serial,
|
driver.io.serial,
|
||||||
io.syslog;
|
io.syslog;
|
||||||
|
|
||||||
function MsSinceSystemBoot : uint64;
|
function MsSinceSystemBoot : uint64;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
@author(Kieron Morris <kjm@kieronmorris.me>)
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
}
|
}
|
||||||
unit arch.x86.faults;
|
unit arch.x86.fault;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ function Round(d: Double): int64;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ ---- Raw driver.intf.serial debug helpers (COM1 $3F8, no dependencies) ---- }
|
{ ---- Raw driver.io.serial debug helpers (COM1 $3F8, no dependencies) ---- }
|
||||||
|
|
||||||
procedure serial_putch(ch: char); assembler;
|
procedure serial_putch(ch: char); assembler;
|
||||||
asm
|
asm
|
||||||
|
|||||||
+7
-7
@@ -36,10 +36,10 @@ uses
|
|||||||
driver.video.desktop,
|
driver.video.desktop,
|
||||||
driver.video.doublebuffer,
|
driver.video.doublebuffer,
|
||||||
driver.mgr,
|
driver.mgr,
|
||||||
driver.netdev.e1000,
|
driver.net.dev.e1000,
|
||||||
driver.bus.usb.ehci,
|
driver.bus.usb.ehci,
|
||||||
driver.storage.fs.fat32,
|
driver.storage.fs.fat32,
|
||||||
arch.x86.faults,
|
arch.x86.fault,
|
||||||
core.ds.fifo,
|
core.ds.fifo,
|
||||||
driver.storage.fs.mgr,
|
driver.storage.fs.mgr,
|
||||||
driver.storage.fs.flatfs,
|
driver.storage.fs.flatfs,
|
||||||
@@ -76,7 +76,7 @@ uses
|
|||||||
driver.hid.ps2.mouse,
|
driver.hid.ps2.mouse,
|
||||||
core.rand,
|
core.rand,
|
||||||
driver.timer.rtc,
|
driver.timer.rtc,
|
||||||
driver.intf.serial,
|
driver.io.serial,
|
||||||
boot.splash,
|
boot.splash,
|
||||||
io.stdio,
|
io.stdio,
|
||||||
driver.storage.mgr,
|
driver.storage.mgr,
|
||||||
@@ -153,9 +153,9 @@ begin
|
|||||||
System.init();
|
System.init();
|
||||||
|
|
||||||
{ Serial Init }
|
{ Serial Init }
|
||||||
driver.intf.serial.init();
|
driver.io.serial.init();
|
||||||
|
|
||||||
{ Syslog Init — right after driver.intf.serial so log hooks work }
|
{ Syslog Init — right after driver.io.serial so log hooks work }
|
||||||
io.syslog.init();
|
io.syslog.init();
|
||||||
io.syslog.writestringln('Booting Asuro...');
|
io.syslog.writestringln('Booting Asuro...');
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ begin
|
|||||||
arch.x86.idt.init();
|
arch.x86.idt.init();
|
||||||
arch.x86.irq.init();
|
arch.x86.irq.init();
|
||||||
arch.x86.isr.mgr.init();
|
arch.x86.isr.mgr.init();
|
||||||
arch.x86.faults.init();
|
arch.x86.fault.init();
|
||||||
driver.timer.rtc.init();
|
driver.timer.rtc.init();
|
||||||
|
|
||||||
arch.x86.memory.physical.init();
|
arch.x86.memory.physical.init();
|
||||||
@@ -281,7 +281,7 @@ begin
|
|||||||
driver.hid.ps2.keyboard.init(keyboard_layout);
|
driver.hid.ps2.keyboard.init(keyboard_layout);
|
||||||
driver.hid.ps2.mouse.init();
|
driver.hid.ps2.mouse.init();
|
||||||
driver.exp.testdriver.init();
|
driver.exp.testdriver.init();
|
||||||
driver.netdev.e1000.init();
|
driver.net.dev.e1000.init();
|
||||||
driver.storage.ctl.ahci.init();
|
driver.storage.ctl.ahci.init();
|
||||||
io.syslog.logln('KERNEL', 'DEVICE DRIVERS: INIT END.');
|
io.syslog.logln('KERNEL', 'DEVICE DRIVERS: INIT END.');
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ unit core.version;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
const
|
const
|
||||||
VERSION = '1.1.3-alpha-166-ge922f086';
|
VERSION = '1.1.3-alpha-167-g6fa008ed';
|
||||||
VERSION_MAJOR = '1';
|
VERSION_MAJOR = '1';
|
||||||
VERSION_MINOR = '1';
|
VERSION_MINOR = '1';
|
||||||
VERSION_SUB = '3';
|
VERSION_SUB = '3';
|
||||||
REVISION = 'e922f086';
|
REVISION = '6fa008ed';
|
||||||
RELEASE = 'alpha-166-ge922f086';
|
RELEASE = 'alpha-167-g6fa008ed';
|
||||||
LINE_COUNT = 98036;
|
LINE_COUNT = 98036;
|
||||||
FILE_COUNT = 170;
|
FILE_COUNT = 170;
|
||||||
DRIVER_COUNT = 69;
|
DRIVER_COUNT = 69;
|
||||||
@@ -16,8 +16,8 @@ const
|
|||||||
NASM_VERSION = '2.16.01';
|
NASM_VERSION = '2.16.01';
|
||||||
MAKE_VERSION = '4.3';
|
MAKE_VERSION = '4.3';
|
||||||
COMPILE_DATE = '08/03/26';
|
COMPILE_DATE = '08/03/26';
|
||||||
COMPILE_TIME = '01:23:57';
|
COMPILE_TIME = '09:59:10';
|
||||||
CHECKSUM = 'cf6e92836483838a6c23a5993ede9b1c';
|
CHECKSUM = '73cd0068c4c908d288a4ac5b480dc00f';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
@author(Kieron Morris <kjm@kieronmorris.me>)
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
}
|
}
|
||||||
unit driver.intf.serial;
|
unit driver.io.serial;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
+18
-18
@@ -13,11 +13,11 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
{
|
{
|
||||||
Driver->NetDev->driver.netdev.e1000 - Intel driver.netdev.e1000/I217/82577LM Network Card Driver.
|
Driver->NetDev->driver.net.dev.e1000 - Intel driver.net.dev.e1000/I217/82577LM Network Card Driver.
|
||||||
|
|
||||||
@author(Kieron Morris <kjm@kieronmorris.me>)
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
}
|
}
|
||||||
unit driver.netdev.e1000;
|
unit driver.net.dev.e1000;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ var
|
|||||||
i : uint32;
|
i : uint32;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.netdev.e1000.readMACAddress');
|
push_trace('driver.net.dev.e1000.readMACAddress');
|
||||||
res:= true;
|
res:= true;
|
||||||
if (eeprom_exists) then begin
|
if (eeprom_exists) then begin
|
||||||
temp:= EEPROMRead(0);
|
temp:= EEPROMRead(0);
|
||||||
@@ -307,9 +307,9 @@ begin
|
|||||||
|
|
||||||
outptr:= puint8(vtop(uint32(ptr)));//puint8(uint32(ptr) - KERNEL_VIRTUAL_BASE);
|
outptr:= puint8(vtop(uint32(ptr)));//puint8(uint32(ptr) - KERNEL_VIRTUAL_BASE);
|
||||||
|
|
||||||
io.syslog.log('driver.netdev.e1000 Driver', 'RX VMem: ');
|
io.syslog.log('driver.net.dev.e1000 Driver', 'RX VMem: ');
|
||||||
io.syslog.writehexln(uint32(ptr));
|
io.syslog.writehexln(uint32(ptr));
|
||||||
io.syslog.log('driver.netdev.e1000 Driver', 'RX Mem: ');
|
io.syslog.log('driver.net.dev.e1000 Driver', 'RX Mem: ');
|
||||||
io.syslog.writehexln(uint32(outptr));
|
io.syslog.writehexln(uint32(outptr));
|
||||||
|
|
||||||
writeCommand(REG_TXDESCLO, uint32(uint64(outptr) SHR 32));
|
writeCommand(REG_TXDESCLO, uint32(uint64(outptr) SHR 32));
|
||||||
@@ -399,11 +399,11 @@ end;
|
|||||||
|
|
||||||
procedure writeCardType();
|
procedure writeCardType();
|
||||||
begin
|
begin
|
||||||
io.syslog.log('driver.netdev.e1000 Driver', 'Card Type: ');
|
io.syslog.log('driver.net.dev.e1000 Driver', 'Card Type: ');
|
||||||
case card_type of
|
case card_type of
|
||||||
ctUnknown:io.syslog.writestringln('Unknown');
|
ctUnknown:io.syslog.writestringln('Unknown');
|
||||||
ct82577LM:io.syslog.writestringln('82577LM');
|
ct82577LM:io.syslog.writestringln('82577LM');
|
||||||
ctE1000:io.syslog.writestringln('Generic driver.netdev.e1000');
|
ctE1000:io.syslog.writestringln('Generic driver.net.dev.e1000');
|
||||||
ctI217:io.syslog.writestringln('I217');
|
ctI217:io.syslog.writestringln('I217');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -464,7 +464,7 @@ begin
|
|||||||
TestPacket[26]:= mac[4];
|
TestPacket[26]:= mac[4];
|
||||||
TestPacket[27]:= mac[5];
|
TestPacket[27]:= mac[5];
|
||||||
sendPacket(void(@TestPacket[0]), 42);
|
sendPacket(void(@TestPacket[0]), 42);
|
||||||
io.stdio.bufWriteStrLn(stdout_buf, 'driver.netdev.e1000 ARP Testpacket Sent.');
|
io.stdio.bufWriteStrLn(stdout_buf, 'driver.net.dev.e1000 ARP Testpacket Sent.');
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -473,7 +473,7 @@ begin
|
|||||||
io.stdio.bufWriteStr(stdout_buf, 'Card: ');
|
io.stdio.bufWriteStr(stdout_buf, 'Card: ');
|
||||||
case card_type of
|
case card_type of
|
||||||
ctUnknown:io.stdio.bufWriteStrLn(stdout_buf, 'Unknown');
|
ctUnknown:io.stdio.bufWriteStrLn(stdout_buf, 'Unknown');
|
||||||
ctE1000:io.stdio.bufWriteStrLn(stdout_buf, 'driver.netdev.e1000 Generic');
|
ctE1000:io.stdio.bufWriteStrLn(stdout_buf, 'driver.net.dev.e1000 Generic');
|
||||||
ct82577LM:io.stdio.bufWriteStrLn(stdout_buf, '82577LM');
|
ct82577LM:io.stdio.bufWriteStrLn(stdout_buf, '82577LM');
|
||||||
ctI217:io.stdio.bufWriteStrLn(stdout_buf, 'I217');
|
ctI217:io.stdio.bufWriteStrLn(stdout_buf, 'I217');
|
||||||
else io.stdio.bufWriteStrLn(stdout_buf, 'UNIDENTIFIED!!!');
|
else io.stdio.bufWriteStrLn(stdout_buf, 'UNIDENTIFIED!!!');
|
||||||
@@ -510,9 +510,9 @@ var
|
|||||||
iline : uint8;
|
iline : uint8;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.netdev.e1000.load');
|
push_trace('driver.net.dev.e1000.load');
|
||||||
|
|
||||||
io.syslog.logln('driver.netdev.e1000 Driver', 'Load Start.');
|
io.syslog.logln('driver.net.dev.e1000 Driver', 'Load Start.');
|
||||||
|
|
||||||
writeCardType();
|
writeCardType();
|
||||||
|
|
||||||
@@ -532,12 +532,12 @@ begin
|
|||||||
eeprom_exists:= false;
|
eeprom_exists:= false;
|
||||||
|
|
||||||
detectEEPROM();
|
detectEEPROM();
|
||||||
if eeprom_exists then io.syslog.logln('driver.netdev.e1000 Driver', 'EEPROM Exists: YES.') else io.syslog.logln('driver.netdev.e1000 Driver', 'EEPROM Exists: NO.');
|
if eeprom_exists then io.syslog.logln('driver.net.dev.e1000 Driver', 'EEPROM Exists: YES.') else io.syslog.logln('driver.net.dev.e1000 Driver', 'EEPROM Exists: NO.');
|
||||||
if not readMACAddress() then begin
|
if not readMACAddress() then begin
|
||||||
io.syslog.logln('driver.netdev.e1000 Driver', 'MAC Read Failed.');
|
io.syslog.logln('driver.net.dev.e1000 Driver', 'MAC Read Failed.');
|
||||||
load:= false;
|
load:= false;
|
||||||
end else begin
|
end else begin
|
||||||
io.syslog.log('driver.netdev.e1000 Driver', 'MAC Address: ');
|
io.syslog.log('driver.net.dev.e1000 Driver', 'MAC Address: ');
|
||||||
io.syslog.writehexpair(mac[0]); io.syslog.writestring(':');
|
io.syslog.writehexpair(mac[0]); io.syslog.writestring(':');
|
||||||
io.syslog.writehexpair(mac[1]); io.syslog.writestring(':');
|
io.syslog.writehexpair(mac[1]); io.syslog.writestring(':');
|
||||||
io.syslog.writehexpair(mac[2]); io.syslog.writestring(':');
|
io.syslog.writehexpair(mac[2]); io.syslog.writestring(':');
|
||||||
@@ -561,11 +561,11 @@ begin
|
|||||||
|
|
||||||
load:= true;
|
load:= true;
|
||||||
|
|
||||||
if load then registercommand('driver.netdev.e1000', @terminal_command_e1000status, 'driver.netdev.e1000 Information.');
|
if load then registercommand('driver.net.dev.e1000', @terminal_command_e1000status, 'driver.net.dev.e1000 Information.');
|
||||||
if load then registercommand('MAC', @console_command_mac, 'Print MAC Address.');
|
if load then registercommand('MAC', @console_command_mac, 'Print MAC Address.');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
io.syslog.logln('driver.netdev.e1000 Driver', 'Load Finish.');
|
io.syslog.logln('driver.net.dev.e1000 Driver', 'Load Finish.');
|
||||||
|
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
@@ -602,7 +602,7 @@ var
|
|||||||
dev : TDeviceIdentifier;
|
dev : TDeviceIdentifier;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.netdev.e1000.init');
|
push_trace('driver.net.dev.e1000.init');
|
||||||
card_type:= ctUnknown;
|
card_type:= ctUnknown;
|
||||||
dev.Bus:= biPCI;
|
dev.Bus:= biPCI;
|
||||||
dev.id0:= INTEL_VEND;
|
dev.id0:= INTEL_VEND;
|
||||||
@@ -611,7 +611,7 @@ begin
|
|||||||
dev.id3:= idANY;
|
dev.id3:= idANY;
|
||||||
dev.id4:= E1000_DEV;
|
dev.id4:= E1000_DEV;
|
||||||
dev.ex:= nil;
|
dev.ex:= nil;
|
||||||
driver.mgr.register_driver('driver.netdev.e1000 Ethernet Driver', @dev, @loadE1000);
|
driver.mgr.register_driver('driver.net.dev.e1000 Ethernet Driver', @dev, @loadE1000);
|
||||||
dev.id4:= I217_DEV;
|
dev.id4:= I217_DEV;
|
||||||
driver.mgr.register_driver('I217 Ethernet Driver', @dev, @loadI217);
|
driver.mgr.register_driver('I217 Ethernet Driver', @dev, @loadI217);
|
||||||
dev.id4:= LM82577_DEV;
|
dev.id4:= LM82577_DEV;
|
||||||
@@ -39,11 +39,11 @@ procedure writeToLogLn(str : pchar);
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
driver.netdev.e1000, //dev
|
driver.net.dev.e1000, //dev
|
||||||
driver.net.eth2, //L2
|
driver.net.proto.eth2, //L2
|
||||||
driver.net.arp, driver.net.ipv4, //L3
|
driver.net.proto.arp, driver.net.proto.ipv4, //L3
|
||||||
driver.net.icmp, driver.net.tcp, driver.net.udp, //L4
|
driver.net.proto.icmp, driver.net.proto.tcp, driver.net.proto.udp, //L4
|
||||||
driver.net.dhcp; //L5
|
driver.net.proto.dhcp; //L5
|
||||||
|
|
||||||
var
|
var
|
||||||
CBSend : TNetSendCallback = nil;
|
CBSend : TNetSendCallback = nil;
|
||||||
@@ -130,16 +130,16 @@ begin
|
|||||||
push_trace('driver.net.init');
|
push_trace('driver.net.init');
|
||||||
writeToLogLn('L1/NET: init');
|
writeToLogLn('L1/NET: init');
|
||||||
//l2
|
//l2
|
||||||
driver.net.eth2.register;
|
driver.net.proto.eth2.register;
|
||||||
//l3
|
//l3
|
||||||
driver.net.arp.register;
|
driver.net.proto.arp.register;
|
||||||
driver.net.ipv4.register;
|
driver.net.proto.ipv4.register;
|
||||||
//l4
|
//l4
|
||||||
driver.net.icmp.register;
|
driver.net.proto.icmp.register;
|
||||||
driver.net.tcp.register;
|
driver.net.proto.tcp.register;
|
||||||
driver.net.udp.register;
|
driver.net.proto.udp.register;
|
||||||
//l5
|
//l5
|
||||||
driver.net.dhcp.register;
|
driver.net.proto.dhcp.register;
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
@author(Kieron Morris <kjm@kieronmorris.me>)
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
}
|
}
|
||||||
unit driver.net.arp;
|
unit driver.net.proto.arp;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ uses
|
|||||||
debug.tracer, memory.heap,
|
debug.tracer, memory.heap,
|
||||||
core.util, arch.x86.util, core.ds.lists,
|
core.util, arch.x86.util, core.ds.lists,
|
||||||
driver.net, driver.net.types, driver.net.util,
|
driver.net, driver.net.types, driver.net.util,
|
||||||
driver.net.eth2, driver.net.ipv4, io.stdio;
|
driver.net.proto.eth2, driver.net.proto.ipv4, io.stdio;
|
||||||
|
|
||||||
type
|
type
|
||||||
PARPCacheRecord = ^TARPCacheRecord;
|
PARPCacheRecord = ^TARPCacheRecord;
|
||||||
@@ -58,7 +58,7 @@ var
|
|||||||
r : PARPCacheRecord;
|
r : PARPCacheRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.arp.findCacheRecordByMAC');
|
push_trace('driver.net.proto.arp.findCacheRecordByMAC');
|
||||||
findCacheRecordByMAC:= nil;
|
findCacheRecordByMAC:= nil;
|
||||||
if LL_Size(Cache) > 0 then begin
|
if LL_Size(Cache) > 0 then begin
|
||||||
for i:=0 to LL_Size(Cache)-1 do begin
|
for i:=0 to LL_Size(Cache)-1 do begin
|
||||||
@@ -77,7 +77,7 @@ var
|
|||||||
r : PARPCacheRecord;
|
r : PARPCacheRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.arp.findCacheRecordByIP');
|
push_trace('driver.net.proto.arp.findCacheRecordByIP');
|
||||||
findCacheRecordByIP:= nil;
|
findCacheRecordByIP:= nil;
|
||||||
if LL_Size(Cache) > 0 then begin
|
if LL_Size(Cache) > 0 then begin
|
||||||
for i:=0 to LL_Size(Cache)-1 do begin
|
for i:=0 to LL_Size(Cache)-1 do begin
|
||||||
@@ -97,7 +97,7 @@ var
|
|||||||
hSize, pSize : uint8;
|
hSize, pSize : uint8;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.arp.send');
|
push_trace('driver.net.proto.arp.send');
|
||||||
if p_context <> nil then begin
|
if p_context <> nil then begin
|
||||||
buf:= kalloc(sizeof(TARPHeader));
|
buf:= kalloc(sizeof(TARPHeader));
|
||||||
hdr:= PARPHeader(buf);
|
hdr:= PARPHeader(buf);
|
||||||
@@ -126,7 +126,7 @@ begin
|
|||||||
if MACEqual(@p_context^.MAC.Destination[0], @NULL_MAC[0]) then begin
|
if MACEqual(@p_context^.MAC.Destination[0], @NULL_MAC[0]) then begin
|
||||||
CopyMAC(@BROADCAST_MAC[0], @p_context^.MAC.Destination[0]);
|
CopyMAC(@BROADCAST_MAC[0], @p_context^.MAC.Destination[0]);
|
||||||
end;
|
end;
|
||||||
driver.net.eth2.send(buf, sizeof(TARPHeader), $0806, p_context);
|
driver.net.proto.eth2.send(buf, sizeof(TARPHeader), $0806, p_context);
|
||||||
end;
|
end;
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
end;
|
end;
|
||||||
@@ -137,14 +137,14 @@ var
|
|||||||
context : PPacketContext;
|
context : PPacketContext;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.arp.sendGratuitous');
|
push_trace('driver.net.proto.arp.sendGratuitous');
|
||||||
writeToLogLn(' L3/ARP: sendGratuitous');
|
writeToLogLn(' L3/ARP: sendGratuitous');
|
||||||
context:= newPacketContext;
|
context:= newPacketContext;
|
||||||
CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Destination[0]);
|
CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Destination[0]);
|
||||||
CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]);
|
CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]);
|
||||||
CopyMAC(GetMAC, @context^.MAC.Source[0]);
|
CopyMAC(GetMAC, @context^.MAC.Source[0]);
|
||||||
CopyMAC(@NULL_MAC[0], @context^.MAC.Destination[0]);
|
CopyMAC(@NULL_MAC[0], @context^.MAC.Destination[0]);
|
||||||
driver.net.arp.send($1, $0800, $1, context);
|
driver.net.proto.arp.send($1, $0800, $1, context);
|
||||||
freePacketContext(context);
|
freePacketContext(context);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ var
|
|||||||
CacheRecord : PARPCacheRecord;
|
CacheRecord : PARPCacheRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.arp.sendRequestGateway');
|
push_trace('driver.net.proto.arp.sendRequestGateway');
|
||||||
context:= newPacketContext;
|
context:= newPacketContext;
|
||||||
CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]);
|
CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]);
|
||||||
if CacheRecord <> nil then begin
|
if CacheRecord <> nil then begin
|
||||||
@@ -162,7 +162,7 @@ begin
|
|||||||
CopyIPv4(ip, @context^.IP.Destination[0]);
|
CopyIPv4(ip, @context^.IP.Destination[0]);
|
||||||
CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]);
|
CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]);
|
||||||
CopyMAC(GetMAC, @context^.MAC.Source[0]);
|
CopyMAC(GetMAC, @context^.MAC.Source[0]);
|
||||||
driver.net.arp.send($1, $0800, $1, context);
|
driver.net.proto.arp.send($1, $0800, $1, context);
|
||||||
end;
|
end;
|
||||||
freePacketContext(context);
|
freePacketContext(context);
|
||||||
end;
|
end;
|
||||||
@@ -173,7 +173,7 @@ var
|
|||||||
CacheRecord : PARPCacheRecord;
|
CacheRecord : PARPCacheRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.arp.sendRequest');
|
push_trace('driver.net.proto.arp.sendRequest');
|
||||||
writeToLogLn(' L3/ARP: sendRequest');
|
writeToLogLn(' L3/ARP: sendRequest');
|
||||||
context:= newPacketContext;
|
context:= newPacketContext;
|
||||||
CopyIPv4(ip, @context^.IP.Destination[0]);
|
CopyIPv4(ip, @context^.IP.Destination[0]);
|
||||||
@@ -181,7 +181,7 @@ begin
|
|||||||
CopyMAC(GetMAC, @context^.MAC.Source[0]);
|
CopyMAC(GetMAC, @context^.MAC.Source[0]);
|
||||||
CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]);
|
CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]);
|
||||||
CopyMAC(@NULL_MAC[0], @context^.MAC.Destination[0]);
|
CopyMAC(@NULL_MAC[0], @context^.MAC.Destination[0]);
|
||||||
driver.net.arp.send($1, $0800, $1, context);
|
driver.net.proto.arp.send($1, $0800, $1, context);
|
||||||
freePacketContext(context);
|
freePacketContext(context);
|
||||||
sendRequestGateway(ip);
|
sendRequestGateway(ip);
|
||||||
end;
|
end;
|
||||||
@@ -191,7 +191,7 @@ var
|
|||||||
CacheRecord : PARPCacheRecord;
|
CacheRecord : PARPCacheRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.arp.resolveIP');
|
push_trace('driver.net.proto.arp.resolveIP');
|
||||||
CacheRecord:= findCacheRecordByIP(ip);
|
CacheRecord:= findCacheRecordByIP(ip);
|
||||||
resolveIP:= nil;
|
resolveIP:= nil;
|
||||||
if CacheRecord = nil then begin
|
if CacheRecord = nil then begin
|
||||||
@@ -211,7 +211,7 @@ var
|
|||||||
context : PPacketContext;
|
context : PPacketContext;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.arp.recv');
|
push_trace('driver.net.proto.arp.recv');
|
||||||
{ 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;
|
||||||
@@ -305,11 +305,11 @@ end;
|
|||||||
|
|
||||||
procedure register;
|
procedure register;
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.arp.register');
|
push_trace('driver.net.proto.arp.register');
|
||||||
if not Registered then begin
|
if not Registered then begin
|
||||||
writeToLogLn(' L3/ARP: register');
|
writeToLogLn(' L3/ARP: register');
|
||||||
Cache:= LL_New(sizeof(TARPCacheRecord));
|
Cache:= LL_New(sizeof(TARPCacheRecord));
|
||||||
driver.net.eth2.registerTypePromisc($0806, @recv);
|
driver.net.proto.eth2.registerTypePromisc($0806, @recv);
|
||||||
Registered:= true;
|
Registered:= true;
|
||||||
end;
|
end;
|
||||||
pop_trace;
|
pop_trace;
|
||||||
@@ -320,7 +320,7 @@ var
|
|||||||
r : PARPCacheRecord;
|
r : PARPCacheRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.arp.IPv4ToMAC');
|
push_trace('driver.net.proto.arp.IPv4ToMAC');
|
||||||
register;
|
register;
|
||||||
IPv4ToMAC:= nil;
|
IPv4ToMAC:= nil;
|
||||||
r:= findCacheRecordByIP(ip);
|
r:= findCacheRecordByIP(ip);
|
||||||
@@ -335,7 +335,7 @@ var
|
|||||||
r : PARPCacheRecord;
|
r : PARPCacheRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.arp.MACToIPv4');
|
push_trace('driver.net.proto.arp.MACToIPv4');
|
||||||
register;
|
register;
|
||||||
MACToIIPv4:= nil;
|
MACToIIPv4:= nil;
|
||||||
r:= findCacheRecordByMAC(mac);
|
r:= findCacheRecordByMAC(mac);
|
||||||
+25
-25
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
@author(Kieron Morris <kjm@kieronmorris.me>)
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
}
|
}
|
||||||
unit driver.net.eth2;
|
unit driver.net.proto.eth2;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ procedure register;
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
driver.net.arp;
|
driver.net.proto.arp;
|
||||||
|
|
||||||
var
|
var
|
||||||
Registered : Boolean = false;
|
Registered : Boolean = false;
|
||||||
@@ -46,7 +46,7 @@ var
|
|||||||
|
|
||||||
procedure registerTypePromisc(eType : uint16; RecvCB : TRecvCallback);
|
procedure registerTypePromisc(eType : uint16; RecvCB : TRecvCallback);
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.eth2.registerTypePromisc');
|
push_trace('driver.net.proto.eth2.registerTypePromisc');
|
||||||
register;
|
register;
|
||||||
if EthTypes[eType] = nil then EthTypes[eType]:= RecvCB;
|
if EthTypes[eType] = nil then EthTypes[eType]:= RecvCB;
|
||||||
Promisc[eType]:= true;
|
Promisc[eType]:= true;
|
||||||
@@ -54,7 +54,7 @@ end;
|
|||||||
|
|
||||||
procedure registerType(eType : uint16; RecvCB : TRecvCallback);
|
procedure registerType(eType : uint16; RecvCB : TRecvCallback);
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.eth2.registerType');
|
push_trace('driver.net.proto.eth2.registerType');
|
||||||
register;
|
register;
|
||||||
if EthTypes[eType] = nil then EthTypes[eType]:= RecvCB;
|
if EthTypes[eType] = nil then EthTypes[eType]:= RecvCB;
|
||||||
end;
|
end;
|
||||||
@@ -70,8 +70,8 @@ var
|
|||||||
begin
|
begin
|
||||||
pad:= 46 - p_len;
|
pad:= 46 - p_len;
|
||||||
if pad < 0 then pad:= 0;
|
if pad < 0 then pad:= 0;
|
||||||
push_trace('driver.net.eth2.send');
|
push_trace('driver.net.proto.eth2.send');
|
||||||
writeToLogLn(' L2: driver.net.eth2.send');
|
writeToLogLn(' L2: driver.net.proto.eth2.send');
|
||||||
if p_context <> nil then begin
|
if p_context <> nil then begin
|
||||||
size:= sizeof(TEthernetHeader) + p_len + pad;// + 4;
|
size:= sizeof(TEthernetHeader) + p_len + pad;// + 4;
|
||||||
buffer:= kalloc(size);
|
buffer:= kalloc(size);
|
||||||
@@ -95,7 +95,7 @@ var
|
|||||||
buf : puint8;
|
buf : puint8;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.eth2.recv');
|
push_trace('driver.net.proto.eth2.recv');
|
||||||
buf:= puint8(p_data);
|
buf:= puint8(p_data);
|
||||||
|
|
||||||
Header:= PEthernetHeader(buf);
|
Header:= PEthernetHeader(buf);
|
||||||
@@ -120,7 +120,7 @@ var
|
|||||||
i : uint16;
|
i : uint16;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.eth2.register');
|
push_trace('driver.net.proto.eth2.register');
|
||||||
if not Registered then begin
|
if not Registered then begin
|
||||||
writeToLogLn(' L2/ETH: register');
|
writeToLogLn(' L2/ETH: register');
|
||||||
for i:=0 to 65535 do begin
|
for i:=0 to 65535 do begin
|
||||||
+11
-11
@@ -17,14 +17,14 @@
|
|||||||
|
|
||||||
@author(Kieron Morris <kjm@kieronmorris.me>)
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
}
|
}
|
||||||
unit driver.net.icmp;
|
unit driver.net.proto.icmp;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
arch.x86.bda,
|
arch.x86.bda,
|
||||||
memory.heap, debug.tracer,
|
memory.heap, debug.tracer,
|
||||||
driver.net, driver.net.types, driver.net.util, driver.net.ipv4, driver.net.arp, core.util, arch.x86.util;
|
driver.net, driver.net.types, driver.net.util, driver.net.proto.ipv4, driver.net.proto.arp, core.util, arch.x86.util;
|
||||||
|
|
||||||
type
|
type
|
||||||
TARPErrorCode = (aecFailedToResolveHost, aecNoRouteToHost, aecTimeout, aecTTLExpired);
|
TARPErrorCode = (aecFailedToResolveHost, aecNoRouteToHost, aecTimeout, aecTTLExpired);
|
||||||
@@ -50,7 +50,7 @@ var
|
|||||||
i : uint8;
|
i : uint8;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.icmp.nextInactiveHandler');
|
push_trace('driver.net.proto.icmp.nextInactiveHandler');
|
||||||
nextInactiveHandler:= 0;
|
nextInactiveHandler:= 0;
|
||||||
for i:=1 to 255 do begin
|
for i:=1 to 255 do begin
|
||||||
if not Handlers[i].Active then begin
|
if not Handlers[i].Active then begin
|
||||||
@@ -76,7 +76,7 @@ var
|
|||||||
Size : uint32;
|
Size : uint32;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.icmp.sendICMPRequest');
|
push_trace('driver.net.proto.icmp.sendICMPRequest');
|
||||||
writeToLogLn(' L4/ICMP: sendICMPRequest');
|
writeToLogLn(' L4/ICMP: sendICMPRequest');
|
||||||
handle:= nextInactiveHandler;
|
handle:= nextInactiveHandler;
|
||||||
Handlers[handle].Active:= true;
|
Handlers[handle].Active:= true;
|
||||||
@@ -84,9 +84,9 @@ begin
|
|||||||
Handlers[handle].OnError:= OnErr;
|
Handlers[handle].OnError:= OnErr;
|
||||||
Handlers[handle].UserData:= userData;
|
Handlers[handle].UserData:= userData;
|
||||||
if SameSubnetIPv4(ip, @getIPv4Config^.Address[0], @getIPv4Config^.Netmask[0]) then begin
|
if SameSubnetIPv4(ip, @getIPv4Config^.Address[0], @getIPv4Config^.Netmask[0]) then begin
|
||||||
dest_mac:= driver.net.arp.resolveIP(ip);
|
dest_mac:= driver.net.proto.arp.resolveIP(ip);
|
||||||
end else begin
|
end else begin
|
||||||
dest_mac:= driver.net.arp.resolveIP(@getIPv4Config^.Gateway[0]);
|
dest_mac:= driver.net.proto.arp.resolveIP(@getIPv4Config^.Gateway[0]);
|
||||||
end;
|
end;
|
||||||
if dest_mac = nil then begin
|
if dest_mac = nil then begin
|
||||||
if Handlers[handle].OnError <> nil then Handlers[handle].OnError(nil, aecFailedToResolveHost, Handlers[handle].UserData);
|
if Handlers[handle].OnError <> nil then Handlers[handle].OnError(nil, aecFailedToResolveHost, Handlers[handle].UserData);
|
||||||
@@ -116,7 +116,7 @@ begin
|
|||||||
Header^.ICMP_CHK_Hi:= CHK AND $FF;
|
Header^.ICMP_CHK_Hi:= CHK AND $FF;
|
||||||
Header^.ICMP_CHK_Lo:= CHK SHR 8;
|
Header^.ICMP_CHK_Lo:= CHK SHR 8;
|
||||||
|
|
||||||
driver.net.ipv4.send(Buffer, size, context);
|
driver.net.proto.ipv4.send(Buffer, size, context);
|
||||||
|
|
||||||
freePacketContext(context);
|
freePacketContext(context);
|
||||||
end;
|
end;
|
||||||
@@ -134,7 +134,7 @@ var
|
|||||||
Handle : uint8;
|
Handle : uint8;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.icmp.recv');
|
push_trace('driver.net.proto.icmp.recv');
|
||||||
writeToLogLn(' L4/ICMP: recv');
|
writeToLogLn(' L4/ICMP: recv');
|
||||||
Header:= PICMPHeader(p_data);
|
Header:= PICMPHeader(p_data);
|
||||||
//writehexlnWND(Header^.ICMP_Type, getTerminalHWND);
|
//writehexlnWND(Header^.ICMP_Type, getTerminalHWND);
|
||||||
@@ -150,7 +150,7 @@ begin
|
|||||||
Header^.ICMP_CHK_Lo:= CHK SHR 8;
|
Header^.ICMP_CHK_Lo:= CHK SHR 8;
|
||||||
p_context^.Protocol.L4:= $01;
|
p_context^.Protocol.L4:= $01;
|
||||||
p_context^.TTL:= 128;
|
p_context^.TTL:= 128;
|
||||||
driver.net.ipv4.send(p_data, p_len, p_context);
|
driver.net.proto.ipv4.send(p_data, p_len, p_context);
|
||||||
end;
|
end;
|
||||||
$00:begin //Reply
|
$00:begin //Reply
|
||||||
Handle:= Header^.Identifier;
|
Handle:= Header^.Identifier;
|
||||||
@@ -172,7 +172,7 @@ var
|
|||||||
i : uint32;
|
i : uint32;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.icmp.register');
|
push_trace('driver.net.proto.icmp.register');
|
||||||
writeToLogLn(' L4/ICMP: register');
|
writeToLogLn(' L4/ICMP: register');
|
||||||
for i:=0 to 255 do begin
|
for i:=0 to 255 do begin
|
||||||
Handlers[i].Active:= false;
|
Handlers[i].Active:= false;
|
||||||
@@ -180,7 +180,7 @@ begin
|
|||||||
Handlers[i].OnReply:= nil;
|
Handlers[i].OnReply:= nil;
|
||||||
Handlers[i].UserData:= nil;
|
Handlers[i].UserData:= nil;
|
||||||
end;
|
end;
|
||||||
driver.net.ipv4.registerProtocol($01, @recv);
|
driver.net.proto.ipv4.registerProtocol($01, @recv);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
+12
-12
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
@author(Kieron Morris <kjm@kieronmorris.me>)
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
}
|
}
|
||||||
unit driver.net.ipv4;
|
unit driver.net.proto.ipv4;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ uses
|
|||||||
core.util, arch.x86.util, core.strings,
|
core.util, arch.x86.util, core.strings,
|
||||||
driver.net, driver.net.types, driver.net.util,
|
driver.net, driver.net.types, driver.net.util,
|
||||||
core.ds.lists,
|
core.ds.lists,
|
||||||
driver.net.eth2, io.stdio;
|
driver.net.proto.eth2, io.stdio;
|
||||||
|
|
||||||
procedure send(p_data : void; p_len : uint16; p_context : PPacketContext);
|
procedure send(p_data : void; p_len : uint16; p_context : PPacketContext);
|
||||||
procedure registerProtocol(Protocol_ID : uint8; recv_callback : TRecvCallback);
|
procedure registerProtocol(Protocol_ID : uint8; recv_callback : TRecvCallback);
|
||||||
@@ -37,7 +37,7 @@ procedure terminal_command_ifconfig(params : PParamList; stdin_buf, stdout_buf,
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
driver.net.arp;
|
driver.net.proto.arp;
|
||||||
|
|
||||||
var
|
var
|
||||||
Registered : Boolean = false;
|
Registered : Boolean = false;
|
||||||
@@ -47,7 +47,7 @@ var
|
|||||||
|
|
||||||
function getIPv4Config : PIPv4Configuration;
|
function getIPv4Config : PIPv4Configuration;
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.ipv4.getIPv4Config');
|
push_trace('driver.net.proto.ipv4.getIPv4Config');
|
||||||
getIPv4Config:= @Config;
|
getIPv4Config:= @Config;
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
@@ -60,7 +60,7 @@ var
|
|||||||
buffer : void;
|
buffer : void;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.ipv4.send');
|
push_trace('driver.net.proto.ipv4.send');
|
||||||
inc(CurrentID);
|
inc(CurrentID);
|
||||||
Header.version:= 4;
|
Header.version:= 4;
|
||||||
Header.header_len:= 5;
|
Header.header_len:= 5;
|
||||||
@@ -86,7 +86,7 @@ begin
|
|||||||
Buffer:= kalloc(Len);
|
Buffer:= kalloc(Len);
|
||||||
memcpy(uint32(@Header), uint32(Buffer), Header.header_len * 4);
|
memcpy(uint32(@Header), uint32(Buffer), Header.header_len * 4);
|
||||||
memcpy(uint32(p_data), uint32(Buffer) + (Header.header_len * 4), p_len);
|
memcpy(uint32(p_data), uint32(Buffer) + (Header.header_len * 4), p_len);
|
||||||
driver.net.eth2.send(Buffer, (Header.header_len * 4) + p_len, $0800, p_context);
|
driver.net.proto.eth2.send(Buffer, (Header.header_len * 4) + p_len, $0800, p_context);
|
||||||
kfree(Buffer);
|
kfree(Buffer);
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
@@ -100,7 +100,7 @@ var
|
|||||||
len : uint16;
|
len : uint16;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.ipv4.recv');
|
push_trace('driver.net.proto.ipv4.recv');
|
||||||
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;
|
||||||
@@ -175,9 +175,9 @@ begin
|
|||||||
Config.UP:= false;
|
Config.UP:= false;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
driver.net.arp.sendGratuitous;
|
driver.net.proto.arp.sendGratuitous;
|
||||||
CopyIPv4(@Config.Gateway[0], @Target[0]);
|
CopyIPv4(@Config.Gateway[0], @Target[0]);
|
||||||
driver.net.arp.sendRequest(@Target[0]);
|
driver.net.proto.arp.sendRequest(@Target[0]);
|
||||||
end else begin
|
end else begin
|
||||||
io.stdio.bufWriteStr(stdout_buf, ' MAC: ');
|
io.stdio.bufWriteStr(stdout_buf, ' MAC: ');
|
||||||
writeMACAddress(driver.net.GetMAC, stdout_buf);
|
writeMACAddress(driver.net.GetMAC, stdout_buf);
|
||||||
@@ -199,7 +199,7 @@ var
|
|||||||
i : uint8;
|
i : uint8;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.ipv4.register');
|
push_trace('driver.net.proto.ipv4.register');
|
||||||
if not Registered then begin
|
if not Registered then begin
|
||||||
writeToLogLn(' L3/IPv4: register');
|
writeToLogLn(' L3/IPv4: register');
|
||||||
for i:=0 to 255 do begin
|
for i:=0 to 255 do begin
|
||||||
@@ -211,7 +211,7 @@ begin
|
|||||||
Config.Netmask[i]:= 0;
|
Config.Netmask[i]:= 0;
|
||||||
end;
|
end;
|
||||||
Config.UP:= false;
|
Config.UP:= false;
|
||||||
driver.net.eth2.registerType($0800, @recv);
|
driver.net.proto.eth2.registerType($0800, @recv);
|
||||||
Registered:= true;
|
Registered:= true;
|
||||||
end;
|
end;
|
||||||
pop_trace;
|
pop_trace;
|
||||||
@@ -219,7 +219,7 @@ end;
|
|||||||
|
|
||||||
procedure registerProtocol(Protocol_ID : uint8; recv_callback : TRecvCallback);
|
procedure registerProtocol(Protocol_ID : uint8; recv_callback : TRecvCallback);
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.ipv4.registerProtocol');
|
push_trace('driver.net.proto.ipv4.registerProtocol');
|
||||||
register;
|
register;
|
||||||
if Protocols[Protocol_ID] = nil then Protocols[Protocol_ID]:= recv_callback;
|
if Protocols[Protocol_ID] = nil then Protocols[Protocol_ID]:= recv_callback;
|
||||||
pop_trace;
|
pop_trace;
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -17,14 +17,14 @@
|
|||||||
|
|
||||||
@author(Kieron Morris <kjm@kieronmorris.me>)
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
}
|
}
|
||||||
unit driver.net.udp;
|
unit driver.net.proto.udp;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
memory.heap,
|
memory.heap,
|
||||||
driver.net.types, driver.net.util,
|
driver.net.types, driver.net.util,
|
||||||
driver.net.ipv4, driver.net,
|
driver.net.proto.ipv4, driver.net,
|
||||||
debug.tracer, core.util, arch.x86.util;
|
debug.tracer, core.util, arch.x86.util;
|
||||||
|
|
||||||
procedure register();
|
procedure register();
|
||||||
@@ -71,7 +71,7 @@ begin
|
|||||||
nullend:= true;
|
nullend:= true;
|
||||||
end;
|
end;
|
||||||
pseudoBuffer:= kalloc(sizeof(TUDPPseudoHeader) + pseudoSize);
|
pseudoBuffer:= kalloc(sizeof(TUDPPseudoHeader) + pseudoSize);
|
||||||
push_trace('driver.net.udp.CalculateChecksum');
|
push_trace('driver.net.proto.udp.CalculateChecksum');
|
||||||
pseudoBuffer8:= puint8(pseudoBuffer);
|
pseudoBuffer8:= puint8(pseudoBuffer);
|
||||||
pseudoBuffer16:= puint16(pseudoBuffer);
|
pseudoBuffer16:= puint16(pseudoBuffer);
|
||||||
pseudoBuffer32:= puint32(pseudoBuffer);
|
pseudoBuffer32:= puint32(pseudoBuffer);
|
||||||
@@ -119,7 +119,7 @@ var
|
|||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.udp.send');
|
push_trace('driver.net.proto.udp.send');
|
||||||
if udpContext <> nil then begin
|
if udpContext <> nil then begin
|
||||||
size:= p_len + sizeof(TUDPHeader);
|
size:= p_len + sizeof(TUDPHeader);
|
||||||
buffer:= kalloc(size);
|
buffer:= kalloc(size);
|
||||||
@@ -141,7 +141,7 @@ begin
|
|||||||
|
|
||||||
udpContext^.context^.Protocol.L4:= $11;
|
udpContext^.context^.Protocol.L4:= $11;
|
||||||
|
|
||||||
driver.net.ipv4.send(buffer, size, udpContext^.context);
|
driver.net.proto.ipv4.send(buffer, size, udpContext^.context);
|
||||||
|
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
kfree(void(hdr));
|
kfree(void(hdr));
|
||||||
@@ -154,7 +154,7 @@ var
|
|||||||
context : PUDPBindContext;
|
context : PUDPBindContext;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.udp.bind');
|
push_trace('driver.net.proto.udp.bind');
|
||||||
result:= tueGenericError;
|
result:= tueGenericError;
|
||||||
if bindContext <> nil then begin
|
if bindContext <> nil then begin
|
||||||
if Ports[bindContext^.port] = nil then begin
|
if Ports[bindContext^.port] = nil then begin
|
||||||
@@ -177,7 +177,7 @@ var
|
|||||||
context : PUDPBindContext;
|
context : PUDPBindContext;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.udp.unbind');
|
push_trace('driver.net.proto.udp.unbind');
|
||||||
result:= tueGenericError;
|
result:= tueGenericError;
|
||||||
if bindContext <> nil then begin
|
if bindContext <> nil then begin
|
||||||
context:= Ports[bindContext^.port];
|
context:= Ports[bindContext^.port];
|
||||||
@@ -207,7 +207,7 @@ var
|
|||||||
size : uint16;
|
size : uint16;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.udp.ProcessPacket');
|
push_trace('driver.net.proto.udp.ProcessPacket');
|
||||||
header:= PUDPHeader(p_data);
|
header:= PUDPHeader(p_data);
|
||||||
if Ports[switchendian16(header^.DstPort)] <> nil then begin
|
if Ports[switchendian16(header^.DstPort)] <> nil then begin
|
||||||
context:= PUDPPacketContext(kalloc(sizeof(TUDPPacketContext)));
|
context:= PUDPPacketContext(kalloc(sizeof(TUDPPacketContext)));
|
||||||
@@ -250,7 +250,7 @@ var
|
|||||||
Checksum : uint32;
|
Checksum : uint32;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('driver.net.udp.register');
|
push_trace('driver.net.proto.udp.register');
|
||||||
writeToLogLn(' L4/UDP: register');
|
writeToLogLn(' L4/UDP: register');
|
||||||
for i:=0 to 65535 do begin
|
for i:=0 to 65535 do begin
|
||||||
Ports[i]:= nil;
|
Ports[i]:= nil;
|
||||||
@@ -269,7 +269,7 @@ begin
|
|||||||
//writehexln(Checksum);
|
//writehexln(Checksum);
|
||||||
//while true do begin end;
|
//while true do begin end;
|
||||||
|
|
||||||
driver.net.ipv4.registerProtocol($11, @ProcessPacket);
|
driver.net.proto.ipv4.registerProtocol($11, @ProcessPacket);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user