Compare commits
16
Commits
9218ba0a71
...
aa0f537b5b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa0f537b5b | ||
|
|
00a9da42f1 | ||
|
|
9fa1c859ac | ||
|
|
d01b534a3d | ||
|
|
491b0ea5c3 | ||
|
|
de6fde05cc | ||
|
|
fb675a2299 | ||
|
|
aa374b6816 | ||
|
|
f427b7bcc7 | ||
|
|
4ba3c5b524 | ||
|
|
7180ad39d8 | ||
|
|
6c7bcc1911 | ||
|
|
e09c9b5595 | ||
|
|
9476bb0c8a | ||
|
|
8f7db8507b | ||
|
|
188b1aebb0 |
No files matched your search
+9
-10
@@ -1,13 +1,12 @@
|
|||||||
/lib/*.ppu
|
*.o
|
||||||
/lib/*.a
|
*.ppu
|
||||||
/lib/*.o
|
*.s
|
||||||
/release/*.svg
|
*.iso
|
||||||
/release/*.iso
|
*.elf
|
||||||
/bin/*.bin
|
lib/
|
||||||
/iso/boot/asuro.bin
|
release/
|
||||||
/*.iso
|
doc/
|
||||||
/*.md5
|
bin/
|
||||||
/*.sh~
|
|
||||||
/*.img
|
/*.img
|
||||||
src/include/asuro.pas
|
src/include/asuro.pas
|
||||||
localenv.json
|
localenv.json
|
||||||
|
|||||||
+135
@@ -0,0 +1,135 @@
|
|||||||
|
|
||||||
|
c1e267c6b88cab4d1e3c86fa7f2f8ab1 src//contextswitcher.pas
|
||||||
|
0be0d543ea50325c0dee1693c5854c48 src//cpu.pas
|
||||||
|
ac76654ddebbeb1d3cc16ca4c85e77ff src//drivermanagement.pas
|
||||||
|
693ca299a852a25d3d8820bb0d76dfeb src//faults.pas
|
||||||
|
eff5f36e129bc22770d643173c426cbd src//gdt.pas
|
||||||
|
42d014445ddc0fd4d01c59e690795532 src//idt.pas
|
||||||
|
b40f0c2f3ec166a0bf2ebcf8f11f5614 src//irq.pas
|
||||||
|
160ca7f01eb779595a5c90174f8d545e src//isr.pas
|
||||||
|
03963c1b5cf5f661df5598de9af51458 src//kernel.pas
|
||||||
|
71a3e1a6c21a76ff71e06e0743c0c57f src//lmemorymanager.pas
|
||||||
|
8e6a6f36c53ecd90e4669189aa9312b4 src//pmemorymanager.pas
|
||||||
|
4a5f5bf0f2ca7fff89074ad02813091c src//processloader.pas
|
||||||
|
e600e339593a8bb35964e7531c074e7b src//progmanager.pas
|
||||||
|
81d4b5c4a25a1a855d75a88c725b77fe src//scheduler.pas
|
||||||
|
1be263e53e4838f6a06d2ece86400ef2 src//stdio.pas
|
||||||
|
940a7ed5808841c6ba344b67965ecba7 src//syslog.pas
|
||||||
|
fe1dba288d3a3ab427a9dea0a9f747ae src//tracer.pas
|
||||||
|
4598f9b19f3e3748394b6f1cb8e52043 src//tss.pas
|
||||||
|
1a0461e1028921131594edae0a01e608 src//vmemorymanager.pas
|
||||||
|
44b09f7af29af7d7fb9711ee0ea5968d src/driver/bus/PCI.pas
|
||||||
|
6e970ae957a3fbc600c8ee6b42634c78 src/driver/bus/usb/EHCI.pas
|
||||||
|
181e6c09e33ff59b3eb827085591d19f src/driver/bus/usb/OHCI.pas
|
||||||
|
820defeb214b59d2329881670cbb493f src/driver/bus/usb/UHCI.pas
|
||||||
|
6edd4a1e9c92e092aea1368d9aa2724f src/driver/bus/usb/USB.pas
|
||||||
|
8588f4da48c37646c969b7d51aa28676 src/driver/bus/usb/XHCI.pas
|
||||||
|
e064e466ca4a89b2c88df80f75ab0bdc src/driver/bus/usb/usbcore.pas
|
||||||
|
e8aabf9e1ba0c09ede43ed2844802aa0 src/driver/bus/usb/usbhub.pas
|
||||||
|
631d06f67ee6af6bfdcec3279967bca0 src/driver/bus/usb/usbtypes.pas
|
||||||
|
45f1afa1170ab00ec92e52de18f1de19 src/driver/exp/testdriver.pas
|
||||||
|
28e9e1ff635893639c4442656b763d4b src/driver/hid/keyboard.pas
|
||||||
|
25a86d7379eae581d6c69ccbcfb9d722 src/driver/hid/mouse.pas
|
||||||
|
84ceeacce04bc9659c73cba838c94cca src/driver/hid/ps2/ps2_keyboard.pas
|
||||||
|
16a706312825c01b6dd13f51aa385c5f src/driver/hid/ps2/ps2_keyboard_isr.pas
|
||||||
|
d272f2bd62399a119e93118a81a74833 src/driver/hid/ps2/ps2_mouse.pas
|
||||||
|
57615a202dd2cf26c64601d86bd5e36c src/driver/hid/usb/usb_keyboard.pas
|
||||||
|
da94fe43ff22d2050ccd8eec602aa4b5 src/driver/hid/usb/usb_mouse.pas
|
||||||
|
3f6f56b05d141194fa1e48d46d441042 src/driver/include/drivertypes.pas
|
||||||
|
8a6f0bf9d2c77d32f2ce5dede4e15d9a src/driver/interface/serial.pas
|
||||||
|
2d3bcfceef94d7e1138ca465bb32aea5 src/driver/net/include/nettypes.pas
|
||||||
|
63a3fa928b17ffd31c9ea033f3443b41 src/driver/net/include/netutils.pas
|
||||||
|
9aca959358eaa2159421434a4d1855df src/driver/net/l1/net.pas
|
||||||
|
033c08a36b2e99d573e09f1e182937e0 src/driver/net/l2/eth2.pas
|
||||||
|
418cdb2657980f11172bb0c70ff4326d src/driver/net/l3/arp.pas
|
||||||
|
e71bc0e877d736be29378ecdfb91c615 src/driver/net/l3/ipv4.pas
|
||||||
|
38facb711f1153b80011e1adee8cfba5 src/driver/net/l4/icmp.pas
|
||||||
|
fd577fe3e13389f4ffddfe7480935ae1 src/driver/net/l4/tcp.pas
|
||||||
|
0cda1d5d8c298b577b49cc8f1ae031bf src/driver/net/l4/udp.pas
|
||||||
|
004a93b3d4cc1efe1172564239eaf795 src/driver/net/l5/dhcp.pas
|
||||||
|
1cf47de6c18308e1d140ce47e74bb204 src/driver/netdev/E1000.pas
|
||||||
|
bd529497b38ce6bc7697a6dcde6f7fd7 src/driver/storage/MBR.pas
|
||||||
|
333c3bb46b3ca14746281b4921a25630 src/driver/storage/iobuffer.pas
|
||||||
|
08a8280503120f3a90a9a041bc8b67d3 src/driver/storage/partitiontable.pas
|
||||||
|
2bc09f8f54dd10717440b74017bdeb3d src/driver/storage/storagemanager.pas
|
||||||
|
91d10f7ef29d62e633968d72ceeea2b1 src/driver/storage/storagetypes.pas
|
||||||
|
76e01e83220c1882dc429129c0ad937b src/driver/storage/usb_storage.pas
|
||||||
|
e42fdff36185dd92498378ab470a4b35 src/driver/storage/vfs.pas
|
||||||
|
621d834536a649b3b483016060bbfafc src/driver/storage/volumemanager.pas
|
||||||
|
0e300d4c833bab776e8d91a348a5b60c src/driver/storage/AHCI/AHCI.pas
|
||||||
|
16304358a6278c23a751e31bb464eae5 src/driver/storage/AHCI/AHCITypes.pas
|
||||||
|
b5e3bcb914b585a95ac646cfea7d016e src/driver/storage/Filesystems/asfs.pas
|
||||||
|
cb23855b8bad502999656d3121882c74 src/driver/storage/Filesystems/fat32.pas
|
||||||
|
9bceba956d3eeffe97e07bdd45a9476f src/driver/storage/Filesystems/filesystemmanager.pas
|
||||||
|
e03d028cc2915c3cb0a8245407c99b7b src/driver/storage/Filesystems/flatfs.pas
|
||||||
|
5bd48e9a8c97ea11edc2789d2ec7902a src/driver/storage/Filesystems/iso9660.pas
|
||||||
|
753c6bbb3c5f84cdd7300330456980d7 src/driver/storage/IDE/IDE.pas
|
||||||
|
f5e13673000388c7b8fa980824139163 src/driver/storage/IDE/ata.pas
|
||||||
|
5760feea5b9a4ce3fad820b542113c56 src/driver/storage/IDE/atapi.pas
|
||||||
|
900eb584e797111c1a54ca86542e71d0 src/driver/storage/IDE/idetypes.pas
|
||||||
|
6d9508503dca0543fe932c32ef8267fc src/driver/timers/RTC.pas
|
||||||
|
c025ffabb5bba2272578d04903637d11 src/driver/timers/TMR_0_ISR.pas
|
||||||
|
4a7434e5567f738b8545d56558902d9f src/driver/timers/TMR_1_ISR.pas
|
||||||
|
a4459a13e30281d020d0a8730e243b02 src/driver/timers/graphicsrefresh.pas
|
||||||
|
4503465b3f62464f25e17e1d1a67e54d src/driver/timers/usbhotplug.pas
|
||||||
|
0434cc7b77429f971d372e89a8a6972d src/driver/video/desktop.pas
|
||||||
|
fef57dc0269caad191652df07da04466 src/driver/video/doublebuffer.pas
|
||||||
|
a2c0d973e133f2624599d12fc0ec13f6 src/driver/video/lvgl.pas
|
||||||
|
dce8755865885e41c08b062c162b06c9 src/driver/video/uidebug.pas
|
||||||
|
20dc95321989d632fa4c39a5faf74733 src/driver/video/vesa.pas
|
||||||
|
19c988cfcc36bcc78e73747662672d8f src/driver/video/vesa16.pas
|
||||||
|
f6714e6972770155cf2c72822ab76128 src/driver/video/vesa24.pas
|
||||||
|
81e2f271055c2a89dfc8b7f1d19bf509 src/driver/video/vesa32.pas
|
||||||
|
8ea870a31f4a9b11b3dcd639a65d9ca8 src/driver/video/vesa8.pas
|
||||||
|
542aa1da8f8e9d6e5cb5e0b90a3c9de5 src/driver/video/video.pas
|
||||||
|
d499b828752660e1a03272eb4f63eebb src/driver/video/videotypes.pas
|
||||||
|
b9f4c8f07d26c77cb49bd032202775c0 src/driver/video/windows.pas
|
||||||
|
aadcb02abac658feec02042bf5ea4ad0 src/fault/ACE.pas
|
||||||
|
d530d3094d335ce5ab78475de5b5a39a src/fault/BPE.pas
|
||||||
|
84c5c4e3981b9718403e7fdeb9ef9f7f src/fault/BTSSE.pas
|
||||||
|
01acde61a8f3f27592e9c6d15349348d src/fault/CFE.pas
|
||||||
|
0f5db45e5979949114dba7d9ba205103 src/fault/CSOE.pas
|
||||||
|
a7565ac9d1dadc801c16758d2c4e84fe src/fault/DBGE.pas
|
||||||
|
c45fb023b19f7240a911e189c1771c41 src/fault/DBZ.pas
|
||||||
|
b5453d37dd18e375a15f50a870c6dea2 src/fault/DFE.pas
|
||||||
|
25fdec8dd1c72680acd5a6246ced55eb src/fault/GPF.pas
|
||||||
|
3c7671f86051aa727adcf547f175d338 src/fault/IDOE.pas
|
||||||
|
710aadf1e601c74a0cd8563632f35c50 src/fault/IOPE.pas
|
||||||
|
85d27bbbe7002ec3e5e73ff9e971844f src/fault/MCE.pas
|
||||||
|
3f81337468d131b0c9896a588f230772 src/fault/NCE.pas
|
||||||
|
7548539c52222f081d75841b929d439f src/fault/NMIE.pas
|
||||||
|
f6a105e5873cc14a8a5c5b05298bdfd1 src/fault/OOBE.pas
|
||||||
|
8f976f5663439e533347758cc79add39 src/fault/PF.pas
|
||||||
|
3870beacc5b322fa63f633f14b1a8320 src/fault/SFE.pas
|
||||||
|
522c6788021d8ebf966096311dd1f38d src/fault/SNPE.pas
|
||||||
|
f32ed5dffb58626b7657a24866c6af4e src/fault/UIE.pas
|
||||||
|
b6bfdc59f9962fc257e9adc7b57a3273 src/include/base64.pas
|
||||||
|
dee8388dac0ca79ee6aef73469d75f6b src/include/bios_data_area.pas
|
||||||
|
717b8c0a42983f6b8864d5deda4dd532 src/include/color.pas
|
||||||
|
1987f262a6053e02080023554d942ae1 src/include/crc.pas
|
||||||
|
7f6c812b5d7ae1a8af5ef00d42a4eb1d src/include/fonts.pas
|
||||||
|
bf9fe2883789147e08980ab4c43220f7 src/include/hashmap.pas
|
||||||
|
513d59ae08ba6d753a871e1a82b46ed4 src/include/lists.pas
|
||||||
|
c5ef14ac60dad5a32ebfa43da153d05c src/include/md5.pas
|
||||||
|
124f12d75de7ade6993ccd2f02b53ad4 src/include/multiboot.pas
|
||||||
|
d8beadde6ebb05c8a3e74aae57d61f34 src/include/rand.pas
|
||||||
|
cfa50e59e4bd9ea3a5b05c6b1275858d src/include/strings.pas
|
||||||
|
cb254f95c5e09595c90db690bf98794f src/include/system.pas
|
||||||
|
5df11e0052010580d13f1a5ce3acd60f src/include/targa.pas
|
||||||
|
833967cf14697db6da421a4be58e9044 src/include/texture.pas
|
||||||
|
635e5a8936a088a244ddfe48cd658a3f src/include/types.pas
|
||||||
|
a770014537fb6c8d70cf4bc3ec325500 src/include/util.pas
|
||||||
|
e23b0bef333262860e1f68034331e529 src/isr/ioapic.pas
|
||||||
|
63f4a330383220a5cfad0253c09afde3 src/isr/isr_types.pas
|
||||||
|
851217f90e902ca65bebb017eeb172e7 src/isr/isrmanager.pas
|
||||||
|
027f34dc6d4e67d15cf10d6db5edd514 src/prog/base64_prog.pas
|
||||||
|
2e9d0c9db496dafc3c3423deee644c83 src/prog/dhclient.pas
|
||||||
|
6c58870722f8b5fd86308123ae8c934b src/prog/diskcmd.pas
|
||||||
|
a0fa8cf89bee89802d506f2cd3a4dad7 src/prog/diskutil.pas
|
||||||
|
31c7601131e09b0dfcc427cdb14bffb6 src/prog/edit.pas
|
||||||
|
6fff6024194143a6ebbe849f9aff0326 src/prog/inio.pas
|
||||||
|
1ff556cd50088e3ee3efa3103fdc6ba0 src/prog/md5sum.pas
|
||||||
|
0f0e6dc1b2d1a6e14b2fd103826d1f12 src/prog/partcmd.pas
|
||||||
|
0c7c7f62e8bf76fc2eec7f02e7a092b7 src/prog/vbeinfo.pas
|
||||||
|
60bf159fa0a3efb34f73fa15a93acd7c src/prog/volcmd.pas
|
||||||
|
88d71b607256928831a33b363a44c006 src/prog/vterminal.pas
|
||||||
+21
-7
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# compile_lvgl.sh — Download LVGL v9.2 source and compile into lib/liblvgl.a
|
# compile_lvgl.sh — Download LVGL v9.2 source and compile into lib/liblvgl.a
|
||||||
# Clone & compile in /tmp (fast container-local fs).
|
# Clone & compile in /tmp (fast container-local fs).
|
||||||
# Copy source + objects to /lvgl (host mount) for debugging.
|
# Cache liblvgl.a on host mount (/code/lvgl/) to skip rebuild.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
LVGL_VERSION="v9.2.2"
|
LVGL_VERSION="v9.2.2"
|
||||||
@@ -10,6 +10,7 @@ LVGL_DIR="/tmp/lvgl"
|
|||||||
OBJ_DIR="/tmp/lvgl_obj"
|
OBJ_DIR="/tmp/lvgl_obj"
|
||||||
CONF_DIR="$(pwd)/lvglh"
|
CONF_DIR="$(pwd)/lvglh"
|
||||||
OUT_DIR="$(pwd)/lib"
|
OUT_DIR="$(pwd)/lib"
|
||||||
|
CACHE_DIR="/code/lvgl"
|
||||||
|
|
||||||
CC="gcc"
|
CC="gcc"
|
||||||
CFLAGS="-m32 -march=i686 -ffreestanding \
|
CFLAGS="-m32 -march=i686 -ffreestanding \
|
||||||
@@ -26,6 +27,17 @@ echo " "
|
|||||||
echo "Compiling LVGL..."
|
echo "Compiling LVGL..."
|
||||||
echo " "
|
echo " "
|
||||||
|
|
||||||
|
# If cached liblvgl.a exists on host mount, just copy it and skip everything
|
||||||
|
if [ -f "${CACHE_DIR}/liblvgl.a" ]; then
|
||||||
|
echo "Found cached liblvgl.a in ${CACHE_DIR}, copying to ${OUT_DIR}..."
|
||||||
|
cp "${CACHE_DIR}/liblvgl.a" "${OUT_DIR}/liblvgl.a"
|
||||||
|
echo "(Delete lvgl/liblvgl.a to force a full rebuild.)"
|
||||||
|
echo " "
|
||||||
|
echo "LVGL compilation complete (cached)."
|
||||||
|
echo " "
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Clone LVGL into /tmp (container-local)
|
# Clone LVGL into /tmp (container-local)
|
||||||
rm -rf "$LVGL_DIR"
|
rm -rf "$LVGL_DIR"
|
||||||
echo "Downloading LVGL ${LVGL_VERSION}..."
|
echo "Downloading LVGL ${LVGL_VERSION}..."
|
||||||
@@ -105,12 +117,14 @@ else
|
|||||||
echo "No custom LVGL files in lvglh/."
|
echo "No custom LVGL files in lvglh/."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy source + objects to /lvgl host mount for debugging
|
# Cache liblvgl.a and source to host mount for next build
|
||||||
echo "Copying LVGL source and objects to host mount..."
|
echo "Caching LVGL to host mount..."
|
||||||
mkdir /code/lvgl 2>/dev/null || true
|
mkdir -p "$CACHE_DIR"
|
||||||
rm -rf /code/lvgl/* /code/lvgl/.[!.]* /code/lvgl/..?* 2>/dev/null || true
|
rm -rf ${CACHE_DIR}/* ${CACHE_DIR}/.[!.]* ${CACHE_DIR}/..?* 2>/dev/null || true
|
||||||
cp -a "$LVGL_DIR/src" /code/lvgl/src
|
cp "${OUT_DIR}/liblvgl.a" "${CACHE_DIR}/liblvgl.a"
|
||||||
cp -a "$OBJ_DIR" /code/lvgl/obj
|
cp -a "$LVGL_DIR/src" "${CACHE_DIR}/src"
|
||||||
|
cp -a "$LVGL_DIR"/*.h "${CACHE_DIR}/" 2>/dev/null || true
|
||||||
|
cp -a "$OBJ_DIR" "${CACHE_DIR}/obj"
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
echo " "
|
echo " "
|
||||||
|
|||||||
+7
-1
@@ -4,4 +4,10 @@ echo "======================="
|
|||||||
echo " "
|
echo " "
|
||||||
echo "Compiling FPC Sources..."
|
echo "Compiling FPC Sources..."
|
||||||
echo " "
|
echo " "
|
||||||
fpc -Aelf -gw -g -gl -n -v0ew -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* -Fusrc/driver/net/* -Fusrc/driver/bus/* -Fusrc/driver/bus/usb/* -Fusrc/driver/hid/* src/kernel.pas
|
# Build -Fu flags for all directories under src/ and wasuro/
|
||||||
|
FU_PATHS="-Fusrc -Fuwasuro"
|
||||||
|
for dir in $(find src wasuro -type d 2>/dev/null); do
|
||||||
|
FU_PATHS="$FU_PATHS -Fu$dir"
|
||||||
|
done
|
||||||
|
|
||||||
|
fpc -Aelf -gw -g -gl -n -v0ew -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ $FU_PATHS src/kernel.pas
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#Flat filesystem
|
||||||
|
|
||||||
|
A super simple filesystem for asuro. Folders are emulated in filenames.
|
||||||
|
|
||||||
|
Starts with disk info sector, sector 0 of volume
|
||||||
|
|
||||||
|
---
|
||||||
|
#### disk info
|
||||||
|
|
||||||
|
jmp2boot : ubit24;
|
||||||
|
OEMName : array[0..7] of char;
|
||||||
|
version : uint16 // numerical version of filesystem
|
||||||
|
sectorCount : uint16;
|
||||||
|
fileCount : uint16
|
||||||
|
signature : uint32 = 0x0B00B1E5
|
||||||
|
|
||||||
|
|
||||||
|
the Rest of the sector is reserved
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Starting from sector 1 is the file table. Table size is determined by entry size (64) * fileCount
|
||||||
|
|
||||||
|
---
|
||||||
|
####File entry
|
||||||
|
|
||||||
|
name : array[0..59] of char //file name max 60 chars
|
||||||
|
fileStart : 16bit // start sector of data
|
||||||
|
fileSize : 16bit // data size in sectors
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
Binary file not shown.
Generated
+1
@@ -0,0 +1 @@
|
|||||||
|
Hello from the Asuro ISO!
|
||||||
+603
File diff suppressed because it is too large.
Load diff
+109
-3
@@ -13,14 +13,120 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
{
|
{
|
||||||
ContextSwitcher - Switch Process Contexts when preempted.
|
ContextSwitcher - Custom IRQ0 handler for preemptive context switching.
|
||||||
|
|
||||||
@author(Kieron Morris <[email protected]>)
|
Replaces the default ISR_32 with a naked assembly stub that saves the
|
||||||
|
interrupted context (PUSHAD + segment regs), calls a Pascal helper to
|
||||||
|
dispatch timer hooks, send EOI, and run the scheduler, then restores
|
||||||
|
the next process context (or idles) via the returned ESP.
|
||||||
|
|
||||||
|
@author(Kieron Morris <[email protected]>)
|
||||||
}
|
}
|
||||||
unit contextswitcher;
|
unit contextswitcher;
|
||||||
|
|
||||||
|
{$ASMMODE intel}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
implementation;
|
uses
|
||||||
|
idt, isrmanager, processmanager, proctypes, util, syslog, tracer;
|
||||||
|
|
||||||
|
{ Initialise: overwrite IDT gate 32 with our custom ISR. }
|
||||||
|
procedure init;
|
||||||
|
|
||||||
|
{ No idle ESP variable needed — idle is now a formal process (PID 0)
|
||||||
|
with its SavedESP managed like any other process. }
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{ -----------------------------------------------------------------------
|
||||||
|
do_context_switch_work
|
||||||
|
Pascal helper called from the assembly ISR. Receives the current ESP
|
||||||
|
(pointing to the GS..EFLAGS save area), dispatches timer hooks, sends
|
||||||
|
EOI, runs the scheduler and returns the ESP for the next context.
|
||||||
|
Uses register calling convention: saved_esp in EAX, result in EAX.
|
||||||
|
----------------------------------------------------------------------- }
|
||||||
|
function do_context_switch_work(saved_esp : uint32) : uint32;
|
||||||
|
var
|
||||||
|
next : PProcessContext;
|
||||||
|
begin
|
||||||
|
{ 1. Save ESP into the current process }
|
||||||
|
processmanager.CurrentProcess^.SavedESP := saved_esp;
|
||||||
|
|
||||||
|
{ 2. Dispatch all hooks registered on interrupt 32 (timer hooks).
|
||||||
|
This fires TMR_0_ISR.Main which in turn fires BDA tick,
|
||||||
|
graphics refresh, USB hotplug, etc. }
|
||||||
|
isrmanager.dispatchHooks(32);
|
||||||
|
|
||||||
|
{ 3. Send End-Of-Interrupt to the master PIC }
|
||||||
|
outb($20, $20);
|
||||||
|
|
||||||
|
{ 4. Pick the next process to run (always returns non-nil; idle as fallback) }
|
||||||
|
next := processmanager.scheduler_pick_next;
|
||||||
|
processmanager.CurrentProcess := next;
|
||||||
|
|
||||||
|
{ 5. Return the selected process ESP }
|
||||||
|
do_context_switch_work := next^.SavedESP;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ -----------------------------------------------------------------------
|
||||||
|
context_switch_isr
|
||||||
|
Naked assembly ISR that replaces ISR_32 (IRQ0 / PIT timer).
|
||||||
|
|
||||||
|
Stack on entry (pushed by CPU):
|
||||||
|
[ESP+8] EFLAGS
|
||||||
|
[ESP+4] CS
|
||||||
|
[ESP+0] EIP
|
||||||
|
|
||||||
|
We push general-purpose and segment registers, call the Pascal helper,
|
||||||
|
switch ESP to the returned value, pop registers and IRETD.
|
||||||
|
----------------------------------------------------------------------- }
|
||||||
|
procedure context_switch_isr; assembler; nostackframe;
|
||||||
|
asm
|
||||||
|
{ Save all general-purpose registers (EAX,ECX,EDX,EBX,ESP,EBP,ESI,EDI) }
|
||||||
|
pushad
|
||||||
|
|
||||||
|
{ Save segment registers }
|
||||||
|
push ds
|
||||||
|
push es
|
||||||
|
push fs
|
||||||
|
push gs
|
||||||
|
|
||||||
|
{ Load kernel data segments }
|
||||||
|
mov ax, $10
|
||||||
|
mov ds, ax
|
||||||
|
mov es, ax
|
||||||
|
mov fs, ax
|
||||||
|
mov gs, ax
|
||||||
|
|
||||||
|
{ Call Pascal helper: EAX = current ESP (register calling convention).
|
||||||
|
Returns new ESP in EAX. }
|
||||||
|
mov eax, esp
|
||||||
|
call do_context_switch_work
|
||||||
|
mov esp, eax
|
||||||
|
|
||||||
|
{ Restore segment registers }
|
||||||
|
pop gs
|
||||||
|
pop fs
|
||||||
|
pop es
|
||||||
|
pop ds
|
||||||
|
|
||||||
|
{ Restore general-purpose registers }
|
||||||
|
popad
|
||||||
|
|
||||||
|
{ Return from interrupt }
|
||||||
|
iretd
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ -----------------------------------------------------------------------
|
||||||
|
init
|
||||||
|
Override IDT gate 32 with our custom ISR. Must be called AFTER
|
||||||
|
isrmanager.init so that the default gate has been set up first.
|
||||||
|
----------------------------------------------------------------------- }
|
||||||
|
procedure init;
|
||||||
|
begin
|
||||||
|
idt.set_gate(32, uint32(@context_switch_isr), $08, ISR_RING_0);
|
||||||
|
tracer.push_trace('contextswitcher.init');
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
+2
-5
@@ -22,7 +22,7 @@ unit cpu;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
util, RTC;
|
util, RTC, stdio;
|
||||||
|
|
||||||
type
|
type
|
||||||
PCapabilities_Old = ^TCapabilities_Old;
|
PCapabilities_Old = ^TCapabilities_Old;
|
||||||
@@ -113,12 +113,10 @@ var
|
|||||||
CAP_OLD, CAP_NEW : uint32;
|
CAP_OLD, CAP_NEW : uint32;
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
|
procedure Terminal_Command_CPU(Params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
|
||||||
stdio;
|
|
||||||
|
|
||||||
procedure getCPUIdentifier;
|
procedure getCPUIdentifier;
|
||||||
var
|
var
|
||||||
id0, id1, id2 : uint32;
|
id0, id1, id2 : uint32;
|
||||||
@@ -325,7 +323,6 @@ end;
|
|||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
begin
|
begin
|
||||||
stdio.registerCommand('CPU', @Terminal_Command_CPU, 'CPU Info.');
|
|
||||||
CPUID.Capabilities0:= PCapabilities_Old(@CAP_OLD);
|
CPUID.Capabilities0:= PCapabilities_Old(@CAP_OLD);
|
||||||
CPUID.Capabilities1:= PCapabilities_New(@CAP_NEW);
|
CPUID.Capabilities1:= PCapabilities_New(@CAP_NEW);
|
||||||
getCPUIdentifier;
|
getCPUIdentifier;
|
||||||
|
|||||||
+585
File diff suppressed because it is too large.
Load diff
@@ -91,6 +91,7 @@ function getDeviceInfo(class_code : uint8; subclass_code : uint8; prog_if : uint
|
|||||||
procedure requestConfig(bus : uint8; slot : uint8; func : uint8; row : uint8);
|
procedure requestConfig(bus : uint8; slot : uint8; func : uint8; row : uint8);
|
||||||
procedure writeConfig(bus: uint8; slot : uint8; func : uint8; row : uint8; val : uint32);
|
procedure writeConfig(bus: uint8; slot : uint8; func : uint8; row : uint8; val : uint32);
|
||||||
procedure setBusMaster(bus : uint8; slot : uint8; func : uint8; master : boolean);
|
procedure setBusMaster(bus : uint8; slot : uint8; func : uint8; master : boolean);
|
||||||
|
procedure enableDevice(bus : uint8; slot : uint8; func : uint8);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -442,4 +443,34 @@ begin
|
|||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
//Enable device inturrupts and set bus master
|
||||||
|
procedure enableDevice(bus : uint8; slot : uint8; func : uint8);
|
||||||
|
var
|
||||||
|
addr : uint32;
|
||||||
|
cmd : uint32;
|
||||||
|
begin
|
||||||
|
push_trace('PCI.enableDevice');
|
||||||
|
|
||||||
|
addr := ($1 shl 31);
|
||||||
|
addr := addr or (bus shl 16);
|
||||||
|
addr := addr or ((slot) shl 11);
|
||||||
|
addr := addr or ((func) shl 8);
|
||||||
|
addr := addr or ($04 and $FC);
|
||||||
|
|
||||||
|
outl(PCI_CONFIG_ADDRESS_PORT, addr);
|
||||||
|
cmd := inl(PCI_CONFIG_DATA_PORT);
|
||||||
|
cmd := cmd or PCI_COMMAND_MEM_SPACE;
|
||||||
|
cmd := cmd or PCI_COMMAND_BUS_MASTER;
|
||||||
|
cmd := cmd or (3 shl 1);
|
||||||
|
|
||||||
|
//enable interrupts, remove disable interrupt bit maybe
|
||||||
|
cmd := cmd and not PCI_COMMAND_INT_DISABLE;
|
||||||
|
// cmd := cmd and not (1 shl 9);
|
||||||
|
|
||||||
|
outl(PCI_CONFIG_ADDRESS_PORT, addr);
|
||||||
|
outl(PCI_CONFIG_DATA_PORT, cmd);
|
||||||
|
|
||||||
|
pop_trace;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
@@ -158,6 +158,9 @@ procedure init;
|
|||||||
{ Unit Tests }
|
{ Unit Tests }
|
||||||
procedure UnitTest;
|
procedure UnitTest;
|
||||||
|
|
||||||
|
{ Terminal command }
|
||||||
|
procedure terminal_command_usb(params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ ========================= Globals ========================= }
|
{ ========================= Globals ========================= }
|
||||||
@@ -1100,7 +1103,6 @@ begin
|
|||||||
CompletionHookCount := 0;
|
CompletionHookCount := 0;
|
||||||
for i := 0 to MAX_COMPLETION_HOOKS - 1 do
|
for i := 0 to MAX_COMPLETION_HOOKS - 1 do
|
||||||
CompletionHooks[i] := nil;
|
CompletionHooks[i] := nil;
|
||||||
stdio.registerCommand('USB', @terminal_command_usb, 'USB subsystem information.');
|
|
||||||
syslog.logln('USB Core', 'INIT END.');
|
syslog.logln('USB Core', 'INIT END.');
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|||||||
@@ -21,6 +21,29 @@ unit drivertypes;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
|
const
|
||||||
|
PCI_CONFIG_ADDRESS_PORT = $0CF8;
|
||||||
|
PCI_CONFIG_DATA_PORT = $0CFC;
|
||||||
|
|
||||||
|
PCI_COMMAND_IO_SPACE = $0001;
|
||||||
|
PCI_COMMAND_MEM_SPACE = $0002;
|
||||||
|
PCI_COMMAND_BUS_MASTER = $0004;
|
||||||
|
PCI_COMMAND_SPECIAL_CYC = $0008;
|
||||||
|
PCI_COMMAND_MEM_WRITE = $0010;
|
||||||
|
PCI_COMMAND_VGA_PALETTE = $0020;
|
||||||
|
PCI_COMMAND_PARITY = $0040;
|
||||||
|
PCI_COMMAND_WAIT = $0080;
|
||||||
|
PCI_COMMAND_SERR = $0100;
|
||||||
|
PCI_COMMAND_FAST_BACK = $0200;
|
||||||
|
PCI_COMMAND_INT_DISABLE = $0400;
|
||||||
|
PCI_COMMAND_SERR_ENABLE = $8000;
|
||||||
|
|
||||||
|
PCI_CAP_ID_MSI = $05;
|
||||||
|
|
||||||
|
// Bits in the MSI Control register (16-bit):
|
||||||
|
MSI_CONTROL_ENABLE = 1 shl 0; // Bit 0
|
||||||
|
MSI_CONTROL_64BIT = 1 shl 7; // Bit 7
|
||||||
|
MSI_CONTROL_PVMASK = 1 shl 8; // Bit 8 (optional: per-vector masking)
|
||||||
type
|
type
|
||||||
|
|
||||||
PPCI_Device = ^TPCI_Device;
|
PPCI_Device = ^TPCI_Device;
|
||||||
@@ -44,6 +67,7 @@ type
|
|||||||
address1 : uint32;
|
address1 : uint32;
|
||||||
address2 : uint32;
|
address2 : uint32;
|
||||||
address3 : uint32;
|
address3 : uint32;
|
||||||
|
|
||||||
address4 : uint32;
|
address4 : uint32;
|
||||||
address5 : uint32;
|
address5 : uint32;
|
||||||
CIS_pointer : uint32;
|
CIS_pointer : uint32;
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -100,8 +100,8 @@ end;
|
|||||||
|
|
||||||
procedure send(p_data : void; p_len : uint16);
|
procedure send(p_data : void; p_len : uint16);
|
||||||
begin
|
begin
|
||||||
//push_trace('net.send');
|
push_trace('net.send');
|
||||||
//writeToLogLn('L1: net.send');
|
writeToLogLn('L1/NET: send');
|
||||||
if CBSend <> nil then CBSend(p_data, p_len);
|
if CBSend <> nil then CBSend(p_data, p_len);
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
@@ -111,8 +111,7 @@ var
|
|||||||
context : PPacketContext;
|
context : PPacketContext;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
//push_trace('net.recv');
|
push_trace('net.recv');
|
||||||
//writeToLogLn('L1: net.recv');
|
|
||||||
context:= newPacketContext;
|
context:= newPacketContext;
|
||||||
if CBNext <> nil then CBNext(p_data, p_len, context);
|
if CBNext <> nil then CBNext(p_data, p_len, context);
|
||||||
freePacketContext(context);
|
freePacketContext(context);
|
||||||
@@ -129,6 +128,7 @@ end;
|
|||||||
procedure init;
|
procedure init;
|
||||||
begin
|
begin
|
||||||
push_trace('net.init');
|
push_trace('net.init');
|
||||||
|
writeToLogLn('L1/NET: init');
|
||||||
//l2
|
//l2
|
||||||
eth2.register;
|
eth2.register;
|
||||||
//l3
|
//l3
|
||||||
@@ -136,6 +136,7 @@ begin
|
|||||||
ipv4.register;
|
ipv4.register;
|
||||||
//l4
|
//l4
|
||||||
icmp.register;
|
icmp.register;
|
||||||
|
tcp.register;
|
||||||
udp.register;
|
udp.register;
|
||||||
//l5
|
//l5
|
||||||
dhcp.register;
|
dhcp.register;
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ var
|
|||||||
|
|
||||||
procedure registerTypePromisc(eType : uint16; RecvCB : TRecvCallback);
|
procedure registerTypePromisc(eType : uint16; RecvCB : TRecvCallback);
|
||||||
begin
|
begin
|
||||||
|
push_trace('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;
|
||||||
@@ -53,6 +54,7 @@ end;
|
|||||||
|
|
||||||
procedure registerType(eType : uint16; RecvCB : TRecvCallback);
|
procedure registerType(eType : uint16; RecvCB : TRecvCallback);
|
||||||
begin
|
begin
|
||||||
|
push_trace('eth2.registerType');
|
||||||
register;
|
register;
|
||||||
if EthTypes[eType] = nil then EthTypes[eType]:= RecvCB;
|
if EthTypes[eType] = nil then EthTypes[eType]:= RecvCB;
|
||||||
end;
|
end;
|
||||||
@@ -93,7 +95,7 @@ var
|
|||||||
buf : puint8;
|
buf : puint8;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
//writeToLogLn(' L2: eth2.recv');
|
push_trace('eth2.recv');
|
||||||
buf:= puint8(p_data);
|
buf:= puint8(p_data);
|
||||||
|
|
||||||
Header:= PEthernetHeader(buf);
|
Header:= PEthernetHeader(buf);
|
||||||
@@ -120,6 +122,7 @@ var
|
|||||||
begin
|
begin
|
||||||
push_trace('eth2.register');
|
push_trace('eth2.register');
|
||||||
if not Registered then begin
|
if not Registered then begin
|
||||||
|
writeToLogLn(' L2/ETH: register');
|
||||||
for i:=0 to 65535 do begin
|
for i:=0 to 65535 do begin
|
||||||
EthTypes[i]:= nil;
|
EthTypes[i]:= nil;
|
||||||
Promisc[i]:= false;
|
Promisc[i]:= false;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ uses
|
|||||||
tracer, lmemorymanager,
|
tracer, lmemorymanager,
|
||||||
util, lists,
|
util, lists,
|
||||||
net, nettypes, netutils,
|
net, nettypes, netutils,
|
||||||
eth2, ipv4;
|
eth2, ipv4, stdio;
|
||||||
|
|
||||||
type
|
type
|
||||||
PARPCacheRecord = ^TARPCacheRecord;
|
PARPCacheRecord = ^TARPCacheRecord;
|
||||||
@@ -41,11 +41,12 @@ procedure sendGratuitous;
|
|||||||
procedure sendRequest(ip : puint8);
|
procedure sendRequest(ip : puint8);
|
||||||
procedure send(hType : uint16; pType : uint16; op : uint16; p_context : PPacketContext);
|
procedure send(hType : uint16; pType : uint16; op : uint16; p_context : PPacketContext);
|
||||||
function resolveIP(ip : puint8) : puint8;
|
function resolveIP(ip : puint8) : puint8;
|
||||||
|
procedure terminal_command_arp(Params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
stdio, strings;
|
strings;
|
||||||
|
|
||||||
var
|
var
|
||||||
Registered : Boolean = false;
|
Registered : Boolean = false;
|
||||||
@@ -96,6 +97,7 @@ var
|
|||||||
hSize, pSize : uint8;
|
hSize, pSize : uint8;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
push_trace('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);
|
||||||
@@ -135,6 +137,8 @@ var
|
|||||||
context : PPacketContext;
|
context : PPacketContext;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
push_trace('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]);
|
||||||
@@ -150,6 +154,7 @@ var
|
|||||||
CacheRecord : PARPCacheRecord;
|
CacheRecord : PARPCacheRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
push_trace('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
|
||||||
@@ -168,6 +173,8 @@ var
|
|||||||
CacheRecord : PARPCacheRecord;
|
CacheRecord : PARPCacheRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
push_trace('arp.sendRequest');
|
||||||
|
writeToLogLn(' L3/ARP: sendRequest');
|
||||||
context:= newPacketContext;
|
context:= newPacketContext;
|
||||||
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]);
|
||||||
@@ -184,6 +191,7 @@ var
|
|||||||
CacheRecord : PARPCacheRecord;
|
CacheRecord : PARPCacheRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
push_trace('arp.resolveIP');
|
||||||
CacheRecord:= findCacheRecordByIP(ip);
|
CacheRecord:= findCacheRecordByIP(ip);
|
||||||
resolveIP:= nil;
|
resolveIP:= nil;
|
||||||
if CacheRecord = nil then begin
|
if CacheRecord = nil then begin
|
||||||
@@ -203,6 +211,7 @@ var
|
|||||||
context : PPacketContext;
|
context : PPacketContext;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
push_trace('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;
|
||||||
@@ -298,9 +307,9 @@ procedure register;
|
|||||||
begin
|
begin
|
||||||
push_trace('arp.register');
|
push_trace('arp.register');
|
||||||
if not Registered then begin
|
if not Registered then begin
|
||||||
|
writeToLogLn(' L3/ARP: register');
|
||||||
Cache:= LL_New(sizeof(TARPCacheRecord));
|
Cache:= LL_New(sizeof(TARPCacheRecord));
|
||||||
eth2.registerTypePromisc($0806, @recv);
|
eth2.registerTypePromisc($0806, @recv);
|
||||||
stdio.registerCommand('ARP', @terminal_command_arp, 'Get ARP Table.');
|
|
||||||
Registered:= true;
|
Registered:= true;
|
||||||
end;
|
end;
|
||||||
pop_trace;
|
pop_trace;
|
||||||
|
|||||||
@@ -26,17 +26,18 @@ uses
|
|||||||
util, strings,
|
util, strings,
|
||||||
net, nettypes, netutils,
|
net, nettypes, netutils,
|
||||||
lists,
|
lists,
|
||||||
eth2;
|
eth2, 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);
|
||||||
function getIPv4Config : PIPv4Configuration;
|
function getIPv4Config : PIPv4Configuration;
|
||||||
procedure register;
|
procedure register;
|
||||||
|
procedure terminal_command_ifconfig(params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
arp, stdio;
|
arp;
|
||||||
|
|
||||||
var
|
var
|
||||||
Registered : Boolean = false;
|
Registered : Boolean = false;
|
||||||
@@ -46,7 +47,9 @@ var
|
|||||||
|
|
||||||
function getIPv4Config : PIPv4Configuration;
|
function getIPv4Config : PIPv4Configuration;
|
||||||
begin
|
begin
|
||||||
|
push_trace('ipv4.getIPv4Config');
|
||||||
getIPv4Config:= @Config;
|
getIPv4Config:= @Config;
|
||||||
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure send(p_data : void; p_len : uint16; p_context : PPacketContext);
|
procedure send(p_data : void; p_len : uint16; p_context : PPacketContext);
|
||||||
@@ -57,6 +60,7 @@ var
|
|||||||
buffer : void;
|
buffer : void;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
push_trace('ipv4.send');
|
||||||
inc(CurrentID);
|
inc(CurrentID);
|
||||||
Header.version:= 4;
|
Header.version:= 4;
|
||||||
Header.header_len:= 5;
|
Header.header_len:= 5;
|
||||||
@@ -84,6 +88,7 @@ begin
|
|||||||
memcpy(uint32(p_data), uint32(Buffer) + (Header.header_len * 4), p_len);
|
memcpy(uint32(p_data), uint32(Buffer) + (Header.header_len * 4), p_len);
|
||||||
eth2.send(Buffer, (Header.header_len * 4) + p_len, $0800, p_context);
|
eth2.send(Buffer, (Header.header_len * 4) + p_len, $0800, p_context);
|
||||||
kfree(Buffer);
|
kfree(Buffer);
|
||||||
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure recv(p_data : void; p_len : uint16; p_context : PPacketContext);
|
procedure recv(p_data : void; p_len : uint16; p_context : PPacketContext);
|
||||||
@@ -95,6 +100,7 @@ var
|
|||||||
len : uint16;
|
len : uint16;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
push_trace('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;
|
||||||
@@ -195,6 +201,7 @@ var
|
|||||||
begin
|
begin
|
||||||
push_trace('ipv4.register');
|
push_trace('ipv4.register');
|
||||||
if not Registered then begin
|
if not Registered then begin
|
||||||
|
writeToLogLn(' L3/IPv4: register');
|
||||||
for i:=0 to 255 do begin
|
for i:=0 to 255 do begin
|
||||||
Protocols[i]:= nil;
|
Protocols[i]:= nil;
|
||||||
end;
|
end;
|
||||||
@@ -205,7 +212,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
Config.UP:= false;
|
Config.UP:= false;
|
||||||
eth2.registerType($0800, @recv);
|
eth2.registerType($0800, @recv);
|
||||||
stdio.registerCommand('IFCONFIG', @terminal_command_ifconfig, 'Configure Network Settings.');
|
|
||||||
Registered:= true;
|
Registered:= true;
|
||||||
end;
|
end;
|
||||||
pop_trace;
|
pop_trace;
|
||||||
@@ -213,6 +219,7 @@ end;
|
|||||||
|
|
||||||
procedure registerProtocol(Protocol_ID : uint8; recv_callback : TRecvCallback);
|
procedure registerProtocol(Protocol_ID : uint8; recv_callback : TRecvCallback);
|
||||||
begin
|
begin
|
||||||
|
push_trace('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;
|
||||||
|
|||||||
+21
-90
File diff suppressed because it is too large.
Load diff
Loaded 20 of 84 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user