git-svn-id: https://spexeah.com:8443/svn/Asuro@1441 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
50b77b9ce9
commit
99fc00450e
@ -172,6 +172,7 @@ var
|
||||
elm : pchar;
|
||||
|
||||
begin
|
||||
tracer.push_trace('vfs.evaluatePath.enter');
|
||||
List:= STRLL_FromString(Path, '/');
|
||||
if STRLL_Size(List) > 0 then begin
|
||||
for i:=STRLL_Size(List)-1 downto 0 do begin
|
||||
@ -186,6 +187,7 @@ begin
|
||||
end;
|
||||
evaluatePath:= CombineToAbsolutePath(List, STRLL_Size(List));
|
||||
STRLL_Free(List);
|
||||
tracer.push_trace('vfs.evaluatePath.exit');
|
||||
end;
|
||||
|
||||
function getAbsolutePath(Obj : PVFSObject) : pchar;
|
||||
@ -225,6 +227,7 @@ var
|
||||
TempPath : pchar;
|
||||
|
||||
begin
|
||||
tracer.push_trace('vfs.MakeAbsolutePath.enter');
|
||||
if Path[0] = '/' then AbsPath:= stringCopy(Path) else begin
|
||||
if CurrentDirectory[StringSize(CurrentDirectory)-1] <> '/' then
|
||||
TempPath:= StringConcat(CurrentDirectory, '/')
|
||||
@ -234,6 +237,7 @@ begin
|
||||
kfree(void(TempPath));
|
||||
end;
|
||||
MakeAbsolutePath:= AbsPath;
|
||||
tracer.push_trace('vfs.MakeAbsolutePath.exit');
|
||||
end;
|
||||
|
||||
function GetObjectFromPath(path : pchar) : PVFSObject;
|
||||
@ -367,8 +371,13 @@ var
|
||||
Obj : PVFSObject;
|
||||
ObjPath : pchar;
|
||||
RelPath : pchar;
|
||||
AbsPath : pchar;
|
||||
CopyPath : pchar;
|
||||
MntPath : pchar;
|
||||
ValidCallback : TPathValid;
|
||||
|
||||
begin
|
||||
tracer.push_trace('vfs.PathValid.enter');
|
||||
PathValid:= pvInvalid;
|
||||
Obj:= GetObjectFromPath(Path);
|
||||
if Obj <> nil then begin
|
||||
@ -379,14 +388,22 @@ begin
|
||||
otDRIVE:begin
|
||||
ObjPath:= getAbsolutePath(Obj);
|
||||
RelPath:= makeRelative(Path, ObjPath);
|
||||
PathValid:= PVFSDrive(Obj^.Reference)^.PathValid(PVFSDrive(Obj^.Reference)^.DriveHandle, RelPath); //Fix this to be relative path!!!
|
||||
ValidCallback:= PVFSDrive(Obj^.Reference)^.PathValid;
|
||||
if ValidCallback <> nil then
|
||||
PathValid:= ValidCallback(PVFSDrive(Obj^.Reference)^.DriveHandle, RelPath)
|
||||
else
|
||||
PathValid:= pvInvalid;
|
||||
kfree(void(ObjPath));
|
||||
kfree(void(RelPath));
|
||||
end;
|
||||
otDEVICE:begin
|
||||
ObjPath:= getAbsolutePath(Obj);
|
||||
RelPath:= makeRelative(Path, ObjPath);
|
||||
PathValid:= PVFSDevice(Obj^.Reference)^.PathValid(PVFSDevice(Obj^.Reference)^.DeviceHandle, RelPath); //Fix this to be the relative path
|
||||
ValidCallback:= PVFSDevice(Obj^.Reference)^.PathValid;
|
||||
if ValidCallback <> nil then
|
||||
PathValid:= ValidCallback(PVFSDevice(Obj^.Reference)^.DeviceHandle, RelPath)
|
||||
else
|
||||
PathValid:= pvInvalid;
|
||||
kfree(void(ObjPath));
|
||||
kfree(void(RelPath));
|
||||
end;
|
||||
@ -394,10 +411,30 @@ begin
|
||||
PathValid:= pvFile;
|
||||
end;
|
||||
otMOUNT:begin
|
||||
PathValid:= PathValid(PVFSMount(Obj^.Reference)^.Path);
|
||||
{ Get the absolute path of this object, i.e. /mnt/mount1 }
|
||||
ObjPath:= getAbsolutePath(Obj);
|
||||
{ Make our path relative, i.e. /mnt/mount1/myfile becomes /myfile }
|
||||
RelPath:= makeRelative(Path, ObjPath);
|
||||
{ Grab the Redirect Path i.e. /disk/disk1 }
|
||||
MntPath:= PVFSMount(Obj^.Reference)^.Path;
|
||||
{ Ensure that if there isn't a '/' between the RelPath & MntPath we add one }
|
||||
If (MntPath[StringSize(MntPath)-1] <> '/') AND (RelPath[0] <> '/') then
|
||||
CopyPath:= StringConcat(MntPath, '/')
|
||||
else
|
||||
CopyPath:= StringCopy(MntPath);
|
||||
{ Concat MntPath + RelPath, i.e. above examples would become /disk/disk1/myfile }
|
||||
AbsPath:= StringConcat(MntPath, RelPath);
|
||||
{ Recursively call PathValid on our new path }
|
||||
PathValid:= PathValid(AbsPath);
|
||||
{ Free everything we allocated }
|
||||
kfree(void(AbsPath));
|
||||
kfree(void(RelPath));
|
||||
kfree(void(CopyPath));
|
||||
kfree(void(ObjPath));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
tracer.push_trace('vfs.PathValid.exit');
|
||||
end;
|
||||
|
||||
function changeDirectory(Path : pchar) : TIsPathValid;
|
||||
@ -407,6 +444,7 @@ var
|
||||
Validity : TIsPathValid;
|
||||
|
||||
begin
|
||||
tracer.push_trace('vfs.changeDirectory.enter');
|
||||
TempPath:= MakeAbsolutePath(Path);
|
||||
AbsPath:= evaluatePath(TempPath);
|
||||
kfree(void(TempPath));
|
||||
@ -416,6 +454,7 @@ begin
|
||||
end;
|
||||
changeDirectory:= Validity;
|
||||
kfree(void(AbsPath));
|
||||
tracer.push_trace('vfs.changeDirectory.exit');
|
||||
end;
|
||||
|
||||
{ VFS Functions }
|
||||
@ -470,7 +509,9 @@ end;
|
||||
|
||||
function getWorkingDirectory : pchar;
|
||||
begin
|
||||
tracer.push_trace('vfs.getWorkingDirectory.enter');
|
||||
getWorkingDirectory:= CurrentDirectory;
|
||||
tracer.push_trace('vfs.getWorkingDirectory.exit');
|
||||
end;
|
||||
|
||||
{ Terminal Commands }
|
||||
@ -520,6 +561,7 @@ var
|
||||
i : uint32;
|
||||
|
||||
begin
|
||||
tracer.push_trace('vfs.VFS_COMMAND_CD.enter');
|
||||
if ParamCount(Params) > 0 then begin
|
||||
for i:=0 to ParamCount(Params)-1 do begin
|
||||
if i = 0 then begin
|
||||
@ -549,6 +591,7 @@ begin
|
||||
end;
|
||||
kfree(void(Path));
|
||||
end;
|
||||
tracer.push_trace('vfs.VFS_COMMAND_CD.exit');
|
||||
end;
|
||||
|
||||
{ Init }
|
||||
@ -573,10 +616,12 @@ begin
|
||||
newVirtualDirectory('/disk');
|
||||
newVirtualDirectory('/disk/test');
|
||||
newVirtualDirectory('/disk/test/myfolder');
|
||||
newVirtualDirectory('/disk/test/mytest');
|
||||
|
||||
// rel:= makeRelative('/disk/SDA/mydirectory/myfile', '/disk/SDA');
|
||||
// if rel <> nil then outputln('VFS', rel) else outputln('VFS', 'REL IS NULL!');
|
||||
|
||||
//outputln('VFS', makeRelative('/test/mydisk/mything', '/test/mydisk'));
|
||||
//while true do begin end;
|
||||
|
||||
terminal.registerCommand('LS', @VFS_COMMAND_LS, 'List directory contents.');
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(true);
|
||||
BSOD('AC', 'Alignment Check Exception.');
|
||||
console.writestringln('Alignment Check Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(false);
|
||||
BSOD('BE', 'Breakpoint Exception.');
|
||||
console.writestringln('Breakpoint Exception');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(true);
|
||||
BSOD('TSS', 'Bad TSS Exception.');
|
||||
console.writestringln('Bad TSS Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(false);
|
||||
BSOD('CF', 'Coprocessor Fault Exception.');
|
||||
console.writestringln('Coprocessor Fault Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(false);
|
||||
BSOD('CSO', 'Coprocessor Seg Overrun Exception.');
|
||||
console.writestringln('Coprocessor Seg Overrun Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(false);
|
||||
BSOD('DE', 'Debug Exception');
|
||||
console.writestringln('Debug Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(false);
|
||||
BSOD('DBZ', 'Divide By Zero Exception.');
|
||||
console.writestringln('Divide by Zero Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(true);
|
||||
BSOD('DF', 'Double Fault.');
|
||||
console.writestringln('Double Fault.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -25,20 +25,9 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
asm
|
||||
MOV EAX, EBP
|
||||
MOV Regs, EAX
|
||||
end;
|
||||
correctInterruptRegisters(true);
|
||||
BSOD('GPF', 'General Protection Fault.');
|
||||
console.writestringln('General Protection Fault.');
|
||||
console.writestring('Flags: ');
|
||||
console.writehexln(Regs^.EFlags);
|
||||
console.writestring('EIP: ');
|
||||
console.writehexln(Regs^.EIP);
|
||||
console.writestring('CS: ');
|
||||
console.writehexln(Regs^.CS);
|
||||
console.writestring('Error Code: ');
|
||||
console.writehexln(Regs^.ErrorCode);
|
||||
util.halt_and_catch_fire;
|
||||
end;
|
||||
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(false);
|
||||
BSOD('IDO', 'Into Detected Overflow Exception.');
|
||||
console.writestringln('IDO Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(false);
|
||||
BSOD('IO', 'Invalid OPCode Exception.');
|
||||
console.writestringln('Invalid OPCode Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(false);
|
||||
BSOD('MC', 'Machine Check Exception.');
|
||||
console.writestringln('Machine Check Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(false);
|
||||
BSOD('NC', 'No Coprocessor Exception.');
|
||||
console.writestringln('No Coprocessor Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(false);
|
||||
BSOD('NMI', 'Non-Maskable Interrupt Exception.');
|
||||
console.writestringln('NMI Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(false);
|
||||
BSOD('OOB', 'Out of Bouunds Exception.');
|
||||
console.writestringln('OOB Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(true);
|
||||
BSOD('PF', 'Page Fault.');
|
||||
console.writestringln('Page Fault.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(true);
|
||||
BSOD('SF', 'Stack Fault Exception.');
|
||||
console.writestringln('Stack Fault Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(true);
|
||||
BSOD('SNS', 'Segment Not Present Exception.');
|
||||
console.writestringln('Segment Not Present Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -24,6 +24,7 @@ var
|
||||
|
||||
begin
|
||||
CLI;
|
||||
correctInterruptRegisters(false);
|
||||
BSOD('UI', 'Unknown Interrupt Exception.');
|
||||
console.writestringln('Unknown Interrupt Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
|
@ -73,7 +73,7 @@ var
|
||||
implementation
|
||||
|
||||
uses
|
||||
console, RTC, cpu, serial, strings;
|
||||
console, RTC, cpu, serial, strings, isr_types;
|
||||
|
||||
function MsSinceSystemBoot : uint64;
|
||||
begin
|
||||
@ -580,12 +580,21 @@ begin
|
||||
console.writestring(' Fault Info: ');
|
||||
console.writestringln(info);
|
||||
console.writestringln(' ');
|
||||
if IntReg <> nil then begin
|
||||
console.writestringln(' Processor Info: ');
|
||||
console.writestring(' EBP: '); console.writehex(IntReg^.EBP); console.writestring(' EAX: '); console.writehex(IntReg^.EAX); console.writestring(' EBX: '); console.writehexln(IntReg^.EBX);
|
||||
console.writestring(' ECX: '); console.writehex(IntReg^.ECX); console.writestring(' EDX: '); console.writehex(IntReg^.EDX); console.writestring(' ESI: '); console.writehexln(IntReg^.ESI);
|
||||
console.writestring(' EDI: '); console.writehex(IntReg^.EDI); console.writestring(' DS: '); console.writehex(IntReg^.DS); console.writestring(' ES: '); console.writehexln(IntReg^.ES);
|
||||
console.writestring(' FS: '); console.writehex(IntReg^.FS); console.writestring(' GS: '); console.writehex(IntReg^.GS); console.writestring(' ERROR: '); console.writehexln(IntErr^.Error);
|
||||
console.writestring(' EIP: '); console.writehex(IntSpec^.EIP); console.writestring(' CS: '); console.writehex(IntSpec^.CS); console.writestring(' EFLAGS: '); console.writehexln(IntSpec^.EFLAGS);
|
||||
console.writestringln(' ');
|
||||
end;
|
||||
console.writestring(' Call Stack: ');
|
||||
trace:= tracer.get_last_trace;
|
||||
if trace <> nil then begin
|
||||
console.writestring('[-0] ');
|
||||
console.writestringln(trace);
|
||||
for i:=1 to tracer.get_trace_count-1 do begin
|
||||
for i:=1 to tracer.get_trace_count-7 do begin
|
||||
trace:= tracer.get_trace_N(i);
|
||||
if trace <> nil then begin
|
||||
console.writestring(' [');
|
||||
|
@ -12,6 +12,33 @@ const
|
||||
MAX_HOOKS = 16;
|
||||
|
||||
type
|
||||
TInterruptRegisters = packed record
|
||||
EBP : uint32;
|
||||
EAX : uint32;
|
||||
EBX : uint32;
|
||||
ECX : uint32;
|
||||
EDX : uint32;
|
||||
ESI : uint32;
|
||||
EDI : uint32;
|
||||
DS : uint32;
|
||||
ES : uint32;
|
||||
FS : uint32;
|
||||
GS : uint32;
|
||||
end;
|
||||
PInterruptRegisters = ^TInterruptRegisters;
|
||||
|
||||
TError = packed record
|
||||
Error : uint32;
|
||||
end;
|
||||
PError = ^TError;
|
||||
|
||||
TInterruptSpecialRegisters = packed record
|
||||
EIP : uint32;
|
||||
CS : uint32;
|
||||
EFLAGS : uint32;
|
||||
end;
|
||||
PInterruptSpecialRegisters = ^TInterruptSpecialRegisters;
|
||||
|
||||
PRegisters = ^TRegisters;
|
||||
TRegisters = record
|
||||
edi,esi,ebp,esp,ebx,edx,ecx,eax: uint32;
|
||||
@ -22,6 +49,27 @@ type
|
||||
pp_hook_method = procedure(data : void);
|
||||
pp_void = pp_hook_method;
|
||||
|
||||
var
|
||||
IntReg : PInterruptRegisters = nil;
|
||||
IntSpec : PInterruptSpecialRegisters = nil;
|
||||
IntErr : PError = nil;
|
||||
ZeroError : uint32 = 0;
|
||||
|
||||
procedure correctInterruptRegisters(Errorcode : boolean);
|
||||
|
||||
implementation
|
||||
|
||||
procedure correctInterruptRegisters(Errorcode : boolean);
|
||||
begin
|
||||
if IntReg <> nil then begin
|
||||
If errorcode then begin
|
||||
IntSpec:= PInterruptSpecialRegisters(uint32(IntReg) + uint32(SizeOf(TInterruptRegisters)) + uint32(Sizeof(TError)));
|
||||
IntErr:= PError(uint32(IntReg) + uint32(sizeof(TInterruptRegisters)));
|
||||
end else begin
|
||||
IntSpec:= PInterruptSpecialRegisters(uint32(IntReg) + uint32(SizeOf(TInterruptRegisters)));
|
||||
IntErr:= PError(@ZeroError);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
File diff suppressed because it is too large
Load Diff
@ -202,6 +202,9 @@ begin
|
||||
{ Filsystems }
|
||||
fat32.init();
|
||||
|
||||
i:= 0;
|
||||
i:= i div i;
|
||||
|
||||
{ Device Drivers }
|
||||
tracer.push_trace('kmain.DEVDRV');
|
||||
console.outputln('KERNEL', 'DEVICE DRIVERS: INIT BEGIN.');
|
||||
@ -304,6 +307,7 @@ begin
|
||||
// iret;
|
||||
// end;
|
||||
|
||||
|
||||
while true do begin
|
||||
tracer.push_trace('kmain.RedrawWindows');
|
||||
console.redrawWindows;
|
||||
|
Loading…
x
Reference in New Issue
Block a user