Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36ec7bfdb6 | ||
|
|
6c3c0e63d5 | ||
|
|
df71c59aea | ||
|
|
97244a2b95 | ||
|
|
ecca496978 | ||
|
|
e52b4a9763 | ||
|
|
f78eaa3811 | ||
|
|
acb4a15e41 | ||
|
|
d3581eea2e | ||
|
|
1fc00e3e7c | ||
|
|
2f837ace6e | ||
|
|
f8182b24b3 | ||
|
|
f0531ff861 | ||
|
|
3d9c4cb49a | ||
|
|
3a733b1559 | ||
|
|
deb513c925 | ||
|
|
789fb7971a | ||
|
|
4e3acd6af7 | ||
|
|
262d064b6d | ||
|
|
738e5828f6 |
No files matched your search
+11
-9
@@ -1,17 +1,19 @@
|
|||||||
*.o
|
/lib/*.ppu
|
||||||
*.ppu
|
/lib/*.a
|
||||||
*.s
|
/lib/*.o
|
||||||
*.iso
|
/release/*.svg
|
||||||
*.elf
|
/release/*.iso
|
||||||
lib/
|
/bin/*.bin
|
||||||
release/
|
/iso/boot/asuro.bin
|
||||||
doc/
|
/*.iso
|
||||||
bin/
|
/*.md5
|
||||||
|
/*.sh~
|
||||||
/*.img
|
/*.img
|
||||||
src/include/asuro.pas
|
src/include/asuro.pas
|
||||||
localenv.json
|
localenv.json
|
||||||
/lvgl/
|
/lvgl/
|
||||||
dockerout.txt
|
dockerout.txt
|
||||||
AGENTS.md
|
AGENTS.md
|
||||||
|
lessons_learnt.md
|
||||||
*.log
|
*.log
|
||||||
/doc/*.md
|
/doc/*.md
|
||||||
-135
@@ -1,135 +0,0 @@
|
|||||||
|
|
||||||
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
|
|
||||||
+1
-1
@@ -10,4 +10,4 @@ for dir in $(find src wasuro -type d 2>/dev/null); do
|
|||||||
FU_PATHS="$FU_PATHS -Fu$dir"
|
FU_PATHS="$FU_PATHS -Fu$dir"
|
||||||
done
|
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
|
fpc -Aelf -gw -g -gl -n -v0e -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ $FU_PATHS src/kernel.pas
|
||||||
+2
-1
@@ -4,4 +4,5 @@ echo "======================="
|
|||||||
echo " "
|
echo " "
|
||||||
echo "Compiling Stub..."
|
echo "Compiling Stub..."
|
||||||
echo " "
|
echo " "
|
||||||
nasm -f elf src/stub/stub.asm -o lib/stub.o
|
nasm -f elf src/stub/stub.asm -o lib/stub.o
|
||||||
|
nasm -f elf src/stub/splash_tga.asm -o lib/splash_tga.o
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
Binary file not shown.
-603
File diff suppressed because it is too large.
Load diff
@@ -29,14 +29,11 @@ unit contextswitcher;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
idt, isrmanager, processmanager, proctypes, util, syslog, tracer;
|
idt, isrmanager, processmanager, proctypes, util, tracer;
|
||||||
|
|
||||||
{ Initialise: overwrite IDT gate 32 with our custom ISR. }
|
{ Initialise: overwrite IDT gate 32 with our custom ISR. }
|
||||||
procedure init;
|
procedure init;
|
||||||
|
|
||||||
{ No idle ESP variable needed — idle is now a formal process (PID 0)
|
|
||||||
with its SavedESP managed like any other process. }
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ -----------------------------------------------------------------------
|
{ -----------------------------------------------------------------------
|
||||||
|
|||||||
-585
File diff suppressed because it is too large.
Load diff
@@ -957,11 +957,14 @@ end;
|
|||||||
procedure usb_check_hotplug;
|
procedure usb_check_hotplug;
|
||||||
var
|
var
|
||||||
i : uint32;
|
i : uint32;
|
||||||
|
count: uint32;
|
||||||
hc : PUSBHCDriver;
|
hc : PUSBHCDriver;
|
||||||
port : uint8;
|
port : uint8;
|
||||||
begin
|
begin
|
||||||
if HCList = nil then exit;
|
if HCList = nil then exit;
|
||||||
for i := 0 to LL_Size(HCList) - 1 do begin
|
count := LL_Size(HCList);
|
||||||
|
if count = 0 then exit;
|
||||||
|
for i := 0 to count - 1 do begin
|
||||||
hc := PUSBHCDriver(LL_Get(HCList, i));
|
hc := PUSBHCDriver(LL_Get(HCList, i));
|
||||||
if (hc <> nil) and hc^.PortChangePending then begin
|
if (hc <> nil) and hc^.PortChangePending then begin
|
||||||
hc^.PortChangePending := false;
|
hc^.PortChangePending := false;
|
||||||
|
|||||||
@@ -119,8 +119,12 @@ var
|
|||||||
x32, y32 : sint32;
|
x32, y32 : sint32;
|
||||||
r : pchar;
|
r : pchar;
|
||||||
begin
|
begin
|
||||||
|
{ mouse_wait(0) checks OBF with a short timeout (100 iterations).
|
||||||
|
When it returns true, data is ready — read it directly with inb($60).
|
||||||
|
Do NOT call mouse_read here: it uses mouse_wait_long (100k iterations)
|
||||||
|
and would spin-block the ISR if the next packet byte hasn't arrived yet. }
|
||||||
while mouse_wait(0) do begin
|
while mouse_wait(0) do begin
|
||||||
b := mouse_read;
|
b := inb($60);
|
||||||
if Cycle = 0 then begin
|
if Cycle = 0 then begin
|
||||||
if (b AND $08) = $08 then begin
|
if (b AND $08) = $08 then begin
|
||||||
Mouse_Byte[Cycle] := b;
|
Mouse_Byte[Cycle] := b;
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -1,58 +0,0 @@
|
|||||||
# AHCI Driver Notes
|
|
||||||
|
|
||||||
## Pre-scheduling / Process Kill Hazards
|
|
||||||
|
|
||||||
### 1. Dangling DMA Buffer (critical)
|
|
||||||
When a process is killed, its `kalloc`'d buffers get freed. But the AHCI hardware
|
|
||||||
is still DMA'ing into that physical memory. The DMA write lands on whatever now
|
|
||||||
occupies that memory, silently corrupting the kernel heap or another process.
|
|
||||||
|
|
||||||
**Fix:** Before freeing a process's memory, either:
|
|
||||||
- Wait for all its pending AHCI slots to drain (`cmd_issue` bits clear), or
|
|
||||||
- Issue a port reset to abort in-flight commands, *then* free memory.
|
|
||||||
|
|
||||||
### 2. Dangling Completion Callback / Userdata Pointer (critical)
|
|
||||||
In `storage_read`/`storage_write`, the completion callback writes to `@done` —
|
|
||||||
a **stack-local variable**. If the scheduler preempts or kills the process while
|
|
||||||
it's in the `hlt` loop, that stack frame is gone. The ISR fires and writes to a
|
|
||||||
dangling stack address, corrupting whatever now uses that stack page.
|
|
||||||
|
|
||||||
**Fix:** The `done` flag and completion context must be heap-allocated (or in a
|
|
||||||
kernel-owned structure that outlives the process). A per-request struct like:
|
|
||||||
```pascal
|
|
||||||
type TPendingIO = record
|
|
||||||
done : uint32;
|
|
||||||
ownerPID : uint32; { skip delivery if process is dead }
|
|
||||||
end;
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Command Slot Leak
|
|
||||||
If a process is killed with pending I/O, `pending[slot].inUse` stays `true`
|
|
||||||
forever. Eventually all 32 slots fill up and the device becomes unusable.
|
|
||||||
|
|
||||||
**Fix:** When killing a process, scan all AHCI devices for `pending[]` entries
|
|
||||||
belonging to that process, and either:
|
|
||||||
- Let the hardware finish but null out the completion callback (ISR just frees slot), or
|
|
||||||
- Abort the command (port reset) and clear the slot.
|
|
||||||
|
|
||||||
### 4. Interrupt-Disabled Preemption
|
|
||||||
The `asm sti` before the `hlt` loop is fine, but if the timer fires during setup
|
|
||||||
(between `readCallbackAsync(...)` and `asm sti`), the process could be switched
|
|
||||||
out with interrupts in an unexpected state. `hlt` is also not preemption-safe.
|
|
||||||
|
|
||||||
**Fix:** Move to a proper wait-queue/sleep mechanism instead of `hlt`.
|
|
||||||
|
|
||||||
## Recommended Path Forward
|
|
||||||
Implement a small **I/O request queue** owned by the kernel (not the process stack):
|
|
||||||
1. Allocate a request struct
|
|
||||||
2. Put it on a per-device queue
|
|
||||||
3. ISR completes it
|
|
||||||
4. Process kill walks the queue and cancels entries for that PID
|
|
||||||
|
|
||||||
## Other Bugs Fixed (2026-03-03)
|
|
||||||
- **vtop mask bug:** `$FFFFFF` (24-bit) → `$3FFFFF` (22-bit) for 4MB page offset
|
|
||||||
- **find_cmd_slot:** Now checks `pending[].inUse` in addition to `cmd_issue` bit
|
|
||||||
- **Missing lba5:** Both `send_read_dma_async` and `send_write_dma_async` now write all 48 LBA bits
|
|
||||||
- **IOAPIC routing:** PCI interrupts routed through IOAPIC so AHCI interrupts actually reach the CPU
|
|
||||||
- **LAPIC EOI:** `ISR_N` now sends LAPIC EOI for IOAPIC-delivered interrupts
|
|
||||||
- **PxIS pre-clear removed:** No longer blanket-clears port interrupt status before issuing commands (was eating other slots' completions)
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -23,15 +23,15 @@ unit flatfs;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
tracer,
|
|
||||||
strings,
|
|
||||||
filesystemmanager,
|
filesystemmanager,
|
||||||
lists,
|
lists,
|
||||||
syslog,
|
lmemorymanager,
|
||||||
stdio,
|
stdio,
|
||||||
storagemanager,
|
storagemanager,
|
||||||
storagetypes,
|
storagetypes,
|
||||||
lmemorymanager,
|
strings,
|
||||||
|
syslog,
|
||||||
|
tracer,
|
||||||
util,
|
util,
|
||||||
volumemanager;
|
volumemanager;
|
||||||
|
|
||||||
@@ -592,15 +592,18 @@ end;
|
|||||||
procedure detect_volumes(disk : PStorage_Device);
|
procedure detect_volumes(disk : PStorage_Device);
|
||||||
var
|
var
|
||||||
buffer : puint32;
|
buffer : puint32;
|
||||||
|
bufSize : uint32;
|
||||||
volume : PStorage_volume;
|
volume : PStorage_volume;
|
||||||
begin
|
begin
|
||||||
push_trace('flatfs.detectVolumes()');
|
push_trace('flatfs.detectVolumes()');
|
||||||
|
|
||||||
buffer := puint32(kalloc(512));
|
bufSize := disk^.sectorSize;
|
||||||
memset(uint32(buffer), 0, 512);
|
if bufSize < 512 then bufSize := 512;
|
||||||
|
buffer := puint32(kalloc(bufSize));
|
||||||
|
memset(uint32(buffer), 0, bufSize);
|
||||||
|
|
||||||
if (disk^.readCallback = nil) and (disk^.readCallbackAsync = nil) then begin
|
if disk^.dispatchRead = nil then begin
|
||||||
syslog.writestringln('FlatFS: detect_volumes: device has no read callback.');
|
syslog.writestringln('FlatFS: detect_volumes: device has no read dispatch.');
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@@ -759,14 +762,17 @@ end;
|
|||||||
|
|
||||||
function identify_volume(volume : PStorage_Volume) : boolean;
|
function identify_volume(volume : PStorage_Volume) : boolean;
|
||||||
var
|
var
|
||||||
buffer : puint32;
|
buffer : puint32;
|
||||||
|
bufSize : uint32;
|
||||||
begin
|
begin
|
||||||
push_trace('flatfs.identify_volume');
|
push_trace('flatfs.identify_volume');
|
||||||
identify_volume := false;
|
identify_volume := false;
|
||||||
if (volume^.device^.readCallback = nil) and (volume^.device^.readCallbackAsync = nil) then exit;
|
if volume^.device^.dispatchRead = nil then exit;
|
||||||
|
|
||||||
buffer := puint32(kalloc(512));
|
bufSize := volume^.device^.sectorSize;
|
||||||
memset(uint32(buffer), 0, 512);
|
if bufSize < 512 then bufSize := 512;
|
||||||
|
buffer := puint32(kalloc(bufSize));
|
||||||
|
memset(uint32(buffer), 0, bufSize);
|
||||||
|
|
||||||
storagemanager.storage_read(volume^.device, volume^.sectorStart, 1, buffer);
|
storagemanager.storage_read(volume^.device, volume^.sectorStart, 1, buffer);
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -1,3 +1,16 @@
|
|||||||
|
// Copyright 2021 Aaron Hance
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
{
|
{
|
||||||
Driver->Storage->MBR Master boot record
|
Driver->Storage->MBR Master boot record
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,3 +1,16 @@
|
|||||||
|
// Copyright 2021 Aaron Hance
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
{
|
{
|
||||||
Driver->Storage->IOBuffer - Safe IO buffer allocation helpers.
|
Driver->Storage->IOBuffer - Safe IO buffer allocation helpers.
|
||||||
|
|
||||||
@@ -38,12 +51,10 @@ begin
|
|||||||
if size = 0 then exit;
|
if size = 0 then exit;
|
||||||
|
|
||||||
{ Round up to a whole number of sectors so DMA / block I/O is safe }
|
{ Round up to a whole number of sectors so DMA / block I/O is safe }
|
||||||
sectorSize := volume^.device^.sectorSize; //TODO need fileystsem function to get thing size, like cluster size, for file-level IO buffer allocation. For now we just assume sector size.
|
sectorSize := volume^.device^.sectorSize;
|
||||||
if sectorSize = 0 then
|
if sectorSize = 0 then
|
||||||
sectorSize := 512;
|
sectorSize := 512;
|
||||||
|
|
||||||
sectorSize := 512*4; { safe default } //TODO
|
|
||||||
|
|
||||||
alignedSize := ((size + sectorSize - 1) div sectorSize) * sectorSize;
|
alignedSize := ((size + sectorSize - 1) div sectorSize) * sectorSize;
|
||||||
|
|
||||||
buf := puint32(kalloc(alignedSize));
|
buf := puint32(kalloc(alignedSize));
|
||||||
|
|||||||
Loaded 20 of 63 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user