Big commit thing.

git-svn-id: https://spexeah.com:8443/svn/Asuro@867 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron 2020-07-08 21:42:55 +00:00
parent 6b781c6345
commit 1dcfc4e7eb
19 changed files with 107 additions and 45 deletions

BIN
Asuro.iso

Binary file not shown.

Binary file not shown.

View File

@ -8,7 +8,7 @@ fedbc69eb42fb2bd685aa3c98732dd24 src//gdt.pas
1e96141f52b3249777c4c561f74486b2 src//idt.pas 1e96141f52b3249777c4c561f74486b2 src//idt.pas
ff963c65c48984566b201003eec8ce47 src//irq.pas ff963c65c48984566b201003eec8ce47 src//irq.pas
ab3f144c41b5e718b4575eb4ef51aa1b src//isr.pas ab3f144c41b5e718b4575eb4ef51aa1b src//isr.pas
042229fed0d637a745fd10d2b658e678 src//kernel.pas 2e5d095b961c2ea7ee24726d6649209d src//kernel.pas
375a0beff3986ead4e9275b2dfa0ec7d src//lmemorymanager.pas 375a0beff3986ead4e9275b2dfa0ec7d src//lmemorymanager.pas
dce0fec2a2bb8dde7dced3598a613318 src//pmemorymanager.pas dce0fec2a2bb8dde7dced3598a613318 src//pmemorymanager.pas
2517817ea68f5797b5c10926dfaf497e src//processloader.pas 2517817ea68f5797b5c10926dfaf497e src//processloader.pas
@ -44,6 +44,7 @@ b26eb54cfc1be4b9afa103e0ec041eba src/prog/memview.pas
84fe7bc577629e64074adf0a0b363cf8 src/prog/splash.pas 84fe7bc577629e64074adf0a0b363cf8 src/prog/splash.pas
4ea0a47afaace151f3bd66f3786947ed src/prog/terminal.pas 4ea0a47afaace151f3bd66f3786947ed src/prog/terminal.pas
c18ca66db1e0e7c3aa8c2974e220a5ec src/prog/themer.pas c18ca66db1e0e7c3aa8c2974e220a5ec src/prog/themer.pas
348812145d1abd16ed75c4836ad01c14 src/prog/udpcat.pas
a69305637377f209b509b097e7271052 src/prog/vmlog.pas a69305637377f209b509b097e7271052 src/prog/vmlog.pas
af1e55dbd64c939cb63a1703de1002c7 src/prog/vmstate.pas af1e55dbd64c939cb63a1703de1002c7 src/prog/vmstate.pas
c0b825d6daacd672ce343e062edc7238 src/include/bios_data_area.pas c0b825d6daacd672ce343e062edc7238 src/include/bios_data_area.pas
@ -61,8 +62,8 @@ ff442b1dc417a277c68b2890740ea5a2 src/driver/storage/asfs.pas
3324eebbdbb3080374a7d65397d1d663 src/driver/storage/ATA_ISR.pas 3324eebbdbb3080374a7d65397d1d663 src/driver/storage/ATA_ISR.pas
15e714c6bf0f6805f95cac019a8ef3ff src/driver/storage/ATA_OLD.pas 15e714c6bf0f6805f95cac019a8ef3ff src/driver/storage/ATA_OLD.pas
631b160eab56da3ce6df8a76b1577452 src/driver/storage/fat32_OLD.pas 631b160eab56da3ce6df8a76b1577452 src/driver/storage/fat32_OLD.pas
0dbc9a5453191d47edbe85a90177e4ca src/driver/storage/fat32.pas 4aeebdde832dff104bed19d4c050054f src/driver/storage/fat32.pas
563f5a6a3aa1d127d9cfd026e681789c src/driver/storage/IDE.pas 4c0ba6867e91b7ad031334aaa17d1c1c src/driver/storage/IDE.pas
0843fb9b9ca537d4c595cafc88eac993 src/driver/storage/partitiontable.pas 0843fb9b9ca537d4c595cafc88eac993 src/driver/storage/partitiontable.pas
3437aa5ff213f37f5088ceb690e78d3d src/driver/storage/storagemanagement.pas 3437aa5ff213f37f5088ceb690e78d3d src/driver/storage/storagemanagement.pas
2b3d1b9259cd2e80a8849515250998be src/driver/interface/serial.pas 2b3d1b9259cd2e80a8849515250998be src/driver/interface/serial.pas
@ -80,7 +81,7 @@ d6b9b21258bcb471d91c85c85c92cdca src/driver/bus/UHCI.pas
0d38ece46e1dd89d6b9298d2dd21e809 src/driver/bus/XHCI.pas 0d38ece46e1dd89d6b9298d2dd21e809 src/driver/bus/XHCI.pas
e6bac1105d578010d8c80ad98e73da75 src/driver/net/l4/icmp.pas e6bac1105d578010d8c80ad98e73da75 src/driver/net/l4/icmp.pas
d15e40376b2ea95d309c19959bbe670c src/driver/net/l4/tcp.pas d15e40376b2ea95d309c19959bbe670c src/driver/net/l4/tcp.pas
9863f5fcb07e10a6776e15dea8c0180c src/driver/net/l4/udp.pas c2e2856db3aec3febaefed782cc87175 src/driver/net/l4/udp.pas
37a2153a326041fccdc8d3006ec81001 src/driver/net/l2/eth2.pas 37a2153a326041fccdc8d3006ec81001 src/driver/net/l2/eth2.pas
31163add86f65e5dfa3eb519f4cc6334 src/driver/net/l1/net.pas 31163add86f65e5dfa3eb519f4cc6334 src/driver/net/l1/net.pas
d877ae603669cb210bba08cafddff767 src/driver/net/include/nettypes.pas d877ae603669cb210bba08cafddff767 src/driver/net/include/nettypes.pas

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -17,12 +17,19 @@ var
Ports : Array[0..65535] of PUDPBindContext; Ports : Array[0..65535] of PUDPBindContext;
procedure register(); procedure register();
function bind(bindContext : PUDPBindContext) : TUDPError;
function unbind(bindContext : PUDPBindContext) : TUDPError;
implementation implementation
uses uses
console, terminal; console, terminal;
function send(p_data : void; p_len : uint16; p_context : PPacketContext; bindContext : PUDPBindContext);
begin
end;
function bind(bindContext : PUDPBindContext) : TUDPError; function bind(bindContext : PUDPBindContext) : TUDPError;
var var
result : TUDPError; result : TUDPError;
@ -66,9 +73,10 @@ begin
result:= tuePortNotFound; result:= tuePortNotFound;
end; end;
end; end;
unbind:= result;
end; end;
procedure UDPReceive(p_data : void; p_len : uint16; p_context : PPacketContext); procedure ProcessPacket(p_data : void; p_len : uint16; p_context : PPacketContext);
var var
header : PUDPHeader; header : PUDPHeader;
context : PUDPPacketContext; context : PUDPPacketContext;
@ -81,18 +89,6 @@ var
begin begin
writeToLogLn(' L4: udp.recv'); writeToLogLn(' L4: udp.recv');
header:= PUDPHeader(p_data); header:= PUDPHeader(p_data);
//writestringln('UDP Packet: ');
//hex:= puint8(p_data);
//for i:=0 to 7 do begin
// writehexpair(hex^);
// hex:= hex+1;
//end;
//writestringln(' ');
//Writeintln(switchendian16(header^.SrcPort));
//Writeintln(header^.SrcPort);
//Writeintln(switchendian16(header^.DstPort));
//Writeintln(header^.DstPort);
//writestringln('');
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)));
context^.PacketContext:= p_context; context^.PacketContext:= p_context;
@ -105,6 +101,7 @@ begin
size:= context^.Length - sizeof(TUDPHeader); size:= context^.Length - sizeof(TUDPHeader);
bind:= Ports[context^.DstPort]; bind:= Ports[context^.DstPort];
bind^.Callback(void(buf), size, context); bind^.Callback(void(buf), size, context);
kfree(void(context));
end; end;
end; end;
@ -131,19 +128,19 @@ begin
for i:=0 to 65535 do begin for i:=0 to 65535 do begin
Ports[i]:= nil; Ports[i]:= nil;
end; end;
context:= PUDPBindContext(kalloc(sizeof(TUDPBindContext))); //context:= PUDPBindContext(kalloc(sizeof(TUDPBindContext)));
context^.Port:= 22294; //context^.Port:= 22294;
context^.Callback:= @TestRecv; //context^.Callback:= @TestRecv;
context^.UID:= 4398724; //context^.UID:= 4398724;
r:= bind(context); //r:= bind(context);
writestring('[TestBind] '); //writestring('[TestBind] ');
case r of //case r of
tueOK:writestringln('22294 bind OK'); // tueOK:writestringln('22294 bind OK');
tuePortInUse:writestringln('22294 port in use'); // tuePortInUse:writestringln('22294 port in use');
tueGenericError:writestringln('22294 generic error'); // tueGenericError:writestringln('22294 generic error');
tuePortRestricted:writestringln('22294 restricted'); // tuePortRestricted:writestringln('22294 restricted');
end; //end;
ipv4.registerProtocol($11, @UDPReceive); ipv4.registerProtocol($11, @ProcessPacket);
end; end;
end. end.

View File

@ -41,6 +41,18 @@ type
info : TIdentResponse; info : TIdentResponse;
end; end;
TIDE_Status = bitpacked record
Busy : Boolean;
Ready : Boolean;
Fault : Boolean;
Seek : Boolean;
DRQ : Boolean;
CORR : Boolean;
IDDEX : Boolean;
ERROR : Boolean;
end;
PIDE_Status = ^TIDE_Status;
const const
ATA_SR_BUSY = $80; //BUSY ATA_SR_BUSY = $80; //BUSY
@ -325,39 +337,62 @@ var
begin begin
push_trace('ide.writePIO28'); push_trace('ide.writePIO28');
console.writestringln('[IDE] (WRITEPIO28) BEGIN'); console.writestringln('[IDE] (WRITEPIO28) BEGIN');
console.redrawWindows;
while true do if (inb($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy while true do if (inb($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy
console.writestringln('[IDE] (WRITEPIO28) 1');
console.redrawWindows;
noInt(drive); noInt(drive);
if IDEDevices[drive].isMaster then begin if IDEDevices[drive].isMaster then begin
//outb($1F6, $A0); //drive select outb($1F6, $A0); //drive select
outb($1F7, $E0 or ((LBA shr 24) and $0F)); //LBA command primary master outb($1F7, $E0 or ((LBA shr 24) and $0F)); //LBA command primary master
end end
else begin else begin
//outb($1F6, $B0); //drive select outb($1F6, $B0); //drive select
outb($1F7, $F0 or ((LBA shr 24) and $0F)); //LBA command primary slave outb($1F7, $F0 or ((LBA shr 24) and $0F)); //LBA command primary slave
end; end;
console.writestringln('[IDE] (WRITEPIO28) 2');
console.redrawWindows;
outb($1F2, sectorCount); outb($1F2, sectorCount);
outb($1F3, LBA); outb($1F3, LBA);
outb($1F4, LBA shr 8); outb($1F4, LBA shr 8);
outb($1F5, LBA shr 16); outb($1F5, LBA shr 16);
outb($1F7, $30); //write command outb($1F7, $30); //write command
for i:=0 to sectorCount do begin console.writestringln('[IDE] (WRITEPIO28) 3');
console.redrawWindows;
for i:=0 to sectorCount-1 do begin
//poll status //poll status
while true do if (inb($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy while true do if (inb($1f7) and ATA_SR_BUSY) = 0 then break; //Wait until drive not busy
console.writestringln('[IDE] (WRITEPIO28) 4');
console.redrawWindows;
while true do begin while true do begin
console.writestring('[IDE] (WRITEPIO28) inb($1f7): ');
writehexpair(inb($1f7));
if inb($1f7) = $40 then begin
while true do begin console.redrawWindows; end;
end;
writestringln(' ');
console.redrawWindows;
if (inb($1f7) and (1 shl 3)) <> 0 then break; if (inb($1f7) and (1 shl 3)) <> 0 then break;
if (inb($1F7) and 1) <> 0 then begin if (inb($1F7) and 1) <> 0 then begin
console.writestringln('write error'); console.writestringln('write error');
console.redrawWindows;
exit; exit;
end; //drive error end; //drive error
end; end;
console.writestringln('[IDE] (WRITEPIO28) 5');
console.redrawWindows;
for ii:=0 to 127 do begin //write data for ii:=0 to 127 do begin //write data
outb($1F0, Puint32(buffer + ((i * 512) + (ii * 32) DIV 32) )^); outb($1F0, Puint32(buffer + ((i * 512) + (ii * 32) DIV 32) )^);
while true do if (inb($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy while true do if (inb($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy
@ -367,10 +402,14 @@ begin
while true do if (inb($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy while true do if (inb($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy
outb($1F7, $E7); outb($1F7, $E7);
end; end;
end;
console.writestringln('[IDE] (WRITEPIO28) 6');
console.redrawWindows;
end; end;
end;
console.writestringln('[IDE] (WRITEPIO28) END'); console.writestringln('[IDE] (WRITEPIO28) END');
console.redrawWindows;
pop_trace(); pop_trace();
end; end;
@ -402,7 +441,7 @@ begin
outb($1F7, $20); //read command outb($1F7, $20); //read command
for i:=0 to sectorCount do begin for i:=0 to sectorCount-1 do begin
//poll status //poll status
while true do if (inb($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy while true do if (inb($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy
@ -483,4 +522,5 @@ procedure write(device : PStorage_device; LBA : uint32; sectorCount : uint32; bu
begin begin
writePIO28(device^.controllerId0, LBA, sectorCount, buffer); writePIO28(device^.controllerId0, LBA, sectorCount, buffer);
end; end;
end. end.

View File

@ -800,8 +800,8 @@ begin //maybe increase buffer size by one?
// memset(uint32(buffer), 0, sizeof(TBootRecord)); // memset(uint32(buffer), 0, sizeof(TBootRecord));
// bootRecord:= PBootRecord(buffer); // bootRecord:= PBootRecord(buffer);
buffer:= puint32(kalloc(2048)); buffer:= puint32(kalloc(disk^.sectorSize));
memset(uint32(buffer), 0, 2048); memset(uint32(buffer), 0, disk^.sectorSize);
bootRecord:= PBootRecord(buffer); bootRecord:= PBootRecord(buffer);
@ -831,30 +831,48 @@ begin //maybe increase buffer size by one?
fatStart:= start + 1 + bootRecord^.rsvSectors; fatStart:= start + 1 + bootRecord^.rsvSectors;
dataStart:= fatStart + bootRecord^.FATSize; dataStart:= fatStart + bootRecord^.FATSize;
zeroBuffer:= puint32(kalloc( disk^.sectorSize * 4 )); zeroBuffer:= puint32(kalloc( disk^.sectorSize ));
memset(uint32(zeroBuffer), 0, disk^.sectorSize * 4); memset(uint32(zeroBuffer), 0, disk^.sectorSize );
while true do begin {while true do begin
if i > FATSize DIV 4 then break; if i > FATSize then break;
disk^.writecallback(disk, fatStart + i, 4, zeroBuffer); writestring('LOOP BEGIN: ');
writeintln(i);
writeintln(bootRecord^.rsvSectors);
writeintln(start);
writeintln(fatStart);
writeintln(FATSize);
console.redrawWindows;
disk^.writecallback(disk, fatStart + i, 1, zeroBuffer);
writestring('LOOP END: ');
writeintln(i);
console.redrawWindows;
i+=1; i+=1;
end; end;}
kfree(buffer); kfree(buffer);
kfree(zeroBuffer); kfree(zeroBuffer);
writestring('Frees');
console.redrawWindows;
buffer:= puint32(kalloc(disk^.sectorSize)); buffer:= puint32(kalloc(disk^.sectorSize));
memset(uint32(buffer), 0, disk^.sectorSize); memset(uint32(buffer), 0, disk^.sectorSize);
puint32(buffer)[0]:= $FFFFFFF8; //fsinfo puint32(buffer)[0]:= $FFFFFFF8; //fsinfo
puint32(buffer)[1]:= $FFFFFFF8; //root cluster puint32(buffer)[1]:= $FFFFFFF8; //root cluster
writestring('Buffer Alloc');
console.redrawWindows;
disk^.writecallback(disk, fatStart, 1, buffer); disk^.writecallback(disk, fatStart, 1, buffer);
writestring('WriteCB1');
console.redrawWindows;
kfree(buffer); kfree(buffer);
buffer:= puint32(kalloc(disk^.sectorsize)); buffer:= puint32(kalloc(disk^.sectorsize));
memset(uint32(buffer), 0, disk^.sectorsize); memset(uint32(buffer), 0, disk^.sectorsize);
writestring('Buffer Alloc 2');
console.redrawWindows;
PDirectory(buffer)[0].fileName := thisArray; PDirectory(buffer)[0].fileName := thisArray;
PDirectory(buffer)[0].attributes := $08; PDirectory(buffer)[0].attributes := $08;
@ -865,8 +883,12 @@ begin //maybe increase buffer size by one?
PDirectory(buffer)[1].clusterLow := 1; PDirectory(buffer)[1].clusterLow := 1;
disk^.writecallback(disk, dataStart + (config^ * rootCluster), 1, buffer); disk^.writecallback(disk, dataStart + (config^ * rootCluster), 1, buffer);
writestring('WriteCB2');
console.redrawWindows;
kfree(buffer); kfree(buffer);
writestring('Free');
console.redrawWindows;
end; end;

View File

@ -44,7 +44,8 @@ uses
vmlog, vmlog,
vm, vm,
vmstate, vmstate,
edit; edit,
udpcat;
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
@ -221,6 +222,7 @@ begin
vmstate.init(); vmstate.init();
tracer.push_trace('kmain.EDIT'); tracer.push_trace('kmain.EDIT');
edit.init(); edit.init();
udpcat.init();
terminal.run(); terminal.run();
{ Init Splash } { Init Splash }