git-svn-id: https://spexeah.com:8443/svn/Asuro@507 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c

This commit is contained in:
kieron 2018-04-12 14:38:50 +00:00
parent 866362b5b0
commit 3124582151
110 changed files with 2499 additions and 1450 deletions

BIN
Asuro.iso

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/ACE.ppu Normal file

Binary file not shown.

BIN
lib/BPE.ppu Normal file

Binary file not shown.

BIN
lib/BTSSE.ppu Normal file

Binary file not shown.

BIN
lib/CFE.ppu Normal file

Binary file not shown.

BIN
lib/CSOE.ppu Normal file

Binary file not shown.

BIN
lib/DBGE.ppu Normal file

Binary file not shown.

BIN
lib/DBZ.ppu Normal file

Binary file not shown.

BIN
lib/DFE.ppu Normal file

Binary file not shown.

BIN
lib/GPF.ppu Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/IDOE.ppu Normal file

Binary file not shown.

BIN
lib/IOPE.ppu Normal file

Binary file not shown.

BIN
lib/MCE.ppu Normal file

Binary file not shown.

BIN
lib/NCE.ppu Normal file

Binary file not shown.

BIN
lib/NMIE.ppu Normal file

Binary file not shown.

BIN
lib/OOBE.ppu Normal file

Binary file not shown.

BIN
lib/PF.ppu Normal file

Binary file not shown.

BIN
lib/PS2_KEYBOARD_ISR.ppu Normal file

Binary file not shown.

BIN
lib/PS2_MOUSE_ISR.ppu Normal file

Binary file not shown.

BIN
lib/SFE.ppu Normal file

Binary file not shown.

BIN
lib/SNPE.ppu Normal file

Binary file not shown.

BIN
lib/TMR_0_ISR.ppu Normal file

Binary file not shown.

BIN
lib/UIE.ppu Normal file

Binary file not shown.

BIN
lib/faults.ppu Normal file

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.

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.

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

@ -7,7 +7,7 @@
* Contributors: K Morris
************************************************ }
unit isr33;
unit PS2_KEYBOARD_ISR;
interface
@ -15,6 +15,7 @@ uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
@ -25,8 +26,9 @@ implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
Registered : Boolean = false;
procedure Main(); interrupt;
procedure Main();
var
i : integer;
b : dword;
@ -42,15 +44,18 @@ begin
Hooks[i](void(b));
end;
end;
outb($20, $20);
end;
procedure register();
begin
if not Registered then begin
Registered:= true;
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(33, uint32(@Main), $08, ISR_RING_0);
//IDT.set_gate(33, uint32(@Main), $08, ISR_RING_0);
isrmanager.registerISR(33, @Main);
inb($60);
end;
end;
procedure hook(hook_method : uint32);
var

View File

@ -7,7 +7,7 @@
* Contributors:
************************************************ }
unit isr44;
unit PS2_MOUSE_ISR;
interface
@ -16,6 +16,7 @@ uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
@ -29,6 +30,7 @@ var
Cycle : uint32 = 0;
Mouse_Byte : Array[0..2] of uint8;
Packet : uint32;
Registered : Boolean = false;
procedure mouse_wait(w_type : uint8);
var
@ -69,7 +71,7 @@ begin
pop_trace;
end;
procedure Main(); interrupt;
procedure Main();
var
i : integer;
b : byte;
@ -124,6 +126,8 @@ var
begin
push_trace('isr44.register');
if not Registered then begin
Registered:= true;
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
mouse_wait(1);
outb($64, $A8);
@ -139,7 +143,9 @@ begin
mouse_read();
mouse_write($F4);
mouse_read();
IDT.set_gate(44, uint32(@Main), $08, ISR_RING_0);
isrmanager.registerISR(44, @Main);
//IDT.set_gate(44, uint32(@Main), $08, ISR_RING_0);
end;
pop_trace;
end;

View File

@ -14,7 +14,7 @@ interface
uses
console,
util,
isr33;
PS2_KEYBOARD_ISR;
type
@ -61,7 +61,8 @@ end;
function load(ptr : void) : boolean;
begin
isr33.hook(uint32(@callback));
PS2_KEYBOARD_ISR.register();
PS2_KEYBOARD_ISR.hook(uint32(@callback));
console.outputln('PS/2 KEYBOARD', 'LOADED.');
load:= true;
end;

View File

@ -15,7 +15,7 @@ uses
tracer,
console,
util,
isr44,
PS2_MOUSE_ISR,
lmemorymanager,
strings,
drivermanagement;
@ -110,7 +110,8 @@ end;
function load(ptr : void) : boolean;
begin
push_trace('mouse.load');
isr44.hook(uint32(@callback));
PS2_MOUSE_ISR.register();
PS2_MOUSE_ISR.hook(uint32(@callback));
console.outputln('PS/2 MOUSE', 'LOADED.');
load:= true;
pop_trace;

View File

@ -7,7 +7,7 @@
* Contributors:
************************************************ }
unit isr76;
unit ATA_ISR;
interface
@ -15,6 +15,7 @@ uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
@ -41,7 +42,8 @@ end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(76, uint32(@Main), $08, ISR_RING_0);
isrmanager.registerISR(76, @Main);
//IDT.set_gate(76, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);

View File

@ -7,7 +7,7 @@
* Contributors: K Morris
************************************************ }
unit isr32;
unit TMR_0_ISR;
interface
@ -15,6 +15,7 @@ uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
@ -25,8 +26,9 @@ implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
Registered : boolean = false;
procedure Main; interrupt; //IRQ0, 1024.19hz aprox
procedure Main; //IRQ0, 1024.19hz aprox
var
i : integer;
regs : PRegisters;
@ -42,11 +44,11 @@ begin
Hooks[i](nil);
end;
end;
outb($20, $20);
end;
procedure register();
begin
if not registered then begin
asm
mov al, $36
out $46, al
@ -56,7 +58,10 @@ begin
out $40, al
end;
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(32, uint32(@Main), $08, ISR_RING_0);
isrmanager.registerISR(32, @Main);
Registered:= true;
end;
//IDT.set_gate(32, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
@ -64,6 +69,7 @@ var
i : uint32;
begin
register();
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;

View File

@ -7,7 +7,7 @@
* Contributors: K Morris
************************************************ }
unit isr40;
unit TMR_1_ISR;
interface
@ -25,8 +25,9 @@ implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
Registered : boolean = false;
procedure Main; interrupt; //IRQ0, called 1024 times a second.
procedure Main; //IRQ0, called 1024 times a second.
var
i : integer;
@ -34,14 +35,16 @@ begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(18));
end;
outb($A0, $20);
outb($20, $20);
end;
procedure register();
begin
if not registered then begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(40, uint32(@Main), $08, ISR_RING_0);
isrmanager.registerISR(40, @Main);
//IDT.set_gate(40, uint32(@Main), $08, ISR_RING_0);
Registered:= true;
end;
end;
procedure hook(hook_method : uint32);
@ -49,6 +52,7 @@ var
i : uint32;
begin
register();
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;

43
src/fault/ACE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR17
* Description: Alignment Check Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit ACE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('AC', 'Alignment Check Exception.');
console.writestringln('Alignment Check Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(17, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(17, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/BPE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR3
* Description: Breakpoint Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit BPE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('BE', 'Breakpoint Exception.');
console.writestringln('Breakpoint Exception');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(3, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(3, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/BTSSE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR10
* Description: Bad TSS Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit BTSSE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('TSS', 'Bad TSS Exception.');
console.writestringln('Bad TSS Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(10, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(10, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/CFE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR11
* Description: Coprocessor Fault Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit CFE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('CF', 'Coprocessor Fault Exception.');
console.writestringln('Coprocessor Fault Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(16, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(16, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/CSOE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR9
* Description: Coprocessor Seg Overrun Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit CSOE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('CSO', 'Coprocessor Seg Overrun Exception.');
console.writestringln('Coprocessor Seg Overrun Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(9, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(9, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/DBGE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR1
* Description: Debug Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit DBGE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('DE', 'Debug Exception');
console.writestringln('Debug Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(1, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(1, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/DBZ.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR0
* Description: Divide-By-Zero Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit DBZ;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('DBZ', 'Divide By Zero Exception.');
console.writestringln('Divide by Zero Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(0, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(0, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/DFE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR8
* Description: Double Fault Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit DFE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('DF', 'Double Fault.');
console.writestringln('Double Fault.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(8, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(8, uint32(@Main), $08, ISR_RING_0);
end;
end.

View File

@ -7,7 +7,7 @@
* Contributors:
************************************************ }
unit isr13;
unit GPF;
interface
@ -15,18 +15,14 @@ uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt;
procedure Main();
var
i : uint32;
Regs : PRegisters;
@ -37,9 +33,6 @@ begin
MOV EAX, EBP
MOV Regs, EAX
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(13));
end;
BSOD('GPF', 'General Protection Fault.');
console.writestringln('General Protection Fault.');
console.writestring('Flags: ');
@ -55,34 +48,9 @@ end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(13, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = 0 then begin
Hooks[i]:= pp_hook_method(hook_method);
exit;
end;
end;
end;
procedure unhook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
If uint32(Hooks[i]) = hook_method then Hooks[i]:= nil;
exit;
end;
isrmanager.registerISR(13, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(13, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/IDOE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR4
* Description: Into Detected Overflow Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit IDOE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('IDO', 'Into Detected Overflow Exception.');
console.writestringln('IDO Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(4, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(4, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/IOPE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR6
* Description: Invalid OPCode Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit IOPE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('IO', 'Invalid OPCode Exception.');
console.writestringln('Invalid OPCode Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(6, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(6, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/MCE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR18
* Description: Machine Check Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit MCE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('MC', 'Machine Check Exception.');
console.writestringln('Machine Check Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(18, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(18, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/NCE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR7
* Description: No Coprocessor Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit NCE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('NC', 'No Coprocessor Exception.');
console.writestringln('No Coprocessor Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(7, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(7, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/NMIE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR2
* Description: Non-Maskable Interrupt Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit NMIE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('NMI', 'Non-Maskable Interrupt Exception.');
console.writestringln('NMI Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(2, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(2, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/OOBE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR5
* Description: Out of Bounds Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit OOBE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('OOB', 'Out of Bouunds Exception.');
console.writestringln('OOB Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(5, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(5, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/PF.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR14
* Description: Page Fault
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit PF;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('PF', 'Page Fault.');
console.writestringln('Page Fault.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(14, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(14, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/SFE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR12
* Description: Stack Fault Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit SFE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('SF', 'Stack Fault Exception.');
console.writestringln('Stack Fault Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(12, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(12, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/SNPE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR11
* Description: Segment Not Present Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit SNPE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('SNS', 'Segment Not Present Exception.');
console.writestringln('Segment Not Present Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(11, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(11, uint32(@Main), $08, ISR_RING_0);
end;
end.

43
src/fault/UIE.pas Normal file
View File

@ -0,0 +1,43 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR15
* Description: Unknown Interrupt Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit UIE;
interface
uses
util,
console,
isr_types,
isrmanager,
IDT;
procedure register();
implementation
procedure Main();
var
i : integer;
begin
CLI;
BSOD('UI', 'Unknown Interrupt Exception.');
console.writestringln('Unknown Interrupt Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
isrmanager.registerISR(15, @Main);
//memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
//IDT.set_gate(15, uint32(@Main), $08, ISR_RING_0);
end;
end.

36
src/faults.pas Normal file
View File

@ -0,0 +1,36 @@
unit faults;
interface
uses
ACE, BPE, BTSSE, CFE, CSOE, DBGE, DBZ, DFE, GPF, IDOE, IOPE, MCE,
NCE, NMIE, OOBE, PF, SFE, SNPE, UIE;
procedure init;
implementation
procedure init;
begin
ACE.register();
BPE.register();
BTSSE.register();
CFE.register();
CSOE.register();
DBGE.register();
DBZ.register();
DFE.register();
GPF.register();
IDOE.register();
IOPE.register();
MCE.register();
NCE.register();
NMIE.register();
OOBE.register();
PF.register();
SFE.register();
SNPE.register();
UIE.register();
end;
end.

View File

@ -12,11 +12,11 @@ unit isr;
interface
uses
Console,
ISR0, ISR1, ISR2, ISR3, ISR4, ISR5, ISR6, ISR7, ISR8, ISR9,
Console
{ISR0, ISR1, ISR2, ISR3, ISR4, ISR5, ISR6, ISR7, ISR8, ISR9,
ISR10, ISR11, ISR12, ISR13, ISR14, ISR15, ISR16, ISR17, ISR18,
ISR32, ISR33,
ISR40, ISR44;
ISR40, ISR44};
procedure init();
@ -24,7 +24,7 @@ implementation
procedure init();
begin
console.outputln('ISR','INIT START.');
{console.outputln('ISR','INIT START.');
ISR0.register(); // Divide-By-Zero
ISR1.register(); // Debug
ISR2.register(); // Non-Maskable Inturrupt
@ -49,7 +49,7 @@ begin
ISR33.register(); // Keyboard
ISR40.register(); // 1024/s Timer
ISR44.register(); // Mouse
console.outputln('ISR','INIT END.');
console.outputln('ISR','INIT END.');}
end;
end.

View File

@ -1,75 +0,0 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR0
* Description: Divide-By-Zero Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit isr0;
interface
uses
util,
console,
isr_types,
IDT;
procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt;
var
i : integer;
begin
CLI;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(0));
end;
BSOD('DBZ', 'Divide By Zero Exception.');
console.writestringln('Divide by Zero Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(0, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = 0 then begin
Hooks[i]:= pp_hook_method(hook_method);
exit;
end;
end;
end;
procedure unhook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
If uint32(Hooks[i]) = hook_method then Hooks[i]:= nil;
exit;
end;
end;
end.

View File

@ -1,75 +0,0 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR1
* Description: Debug Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit isr1;
interface
uses
util,
console,
isr_types,
IDT;
procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt;
var
i : integer;
begin
CLI;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(1));
end;
BSOD('DE', 'Debug Exception');
console.writestringln('Debug Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(1, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = 0 then begin
Hooks[i]:= pp_hook_method(hook_method);
exit;
end;
end;
end;
procedure unhook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
If uint32(Hooks[i]) = hook_method then Hooks[i]:= nil;
exit;
end;
end;
end.

View File

@ -1,75 +0,0 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR10
* Description: Bad TSS Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit isr10;
interface
uses
util,
console,
isr_types,
IDT;
procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt;
var
i : integer;
begin
CLI;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(10));
end;
BSOD('TSS', 'Bad TSS Exception.');
console.writestringln('Bad TSS Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(10, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = 0 then begin
Hooks[i]:= pp_hook_method(hook_method);
exit;
end;
end;
end;
procedure unhook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
If uint32(Hooks[i]) = hook_method then Hooks[i]:= nil;
exit;
end;
end;
end.

View File

@ -1,75 +0,0 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR11
* Description: Segment Not Present Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit isr11;
interface
uses
util,
console,
isr_types,
IDT;
procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt;
var
i : integer;
begin
CLI;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(11));
end;
BSOD('SNS', 'Segment Not Present Exception.');
console.writestringln('Segment Not Present Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(11, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = 0 then begin
Hooks[i]:= pp_hook_method(hook_method);
exit;
end;
end;
end;
procedure unhook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
If uint32(Hooks[i]) = hook_method then Hooks[i]:= nil;
exit;
end;
end;
end.

View File

@ -1,75 +0,0 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR12
* Description: Stack Fault Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit isr12;
interface
uses
util,
console,
isr_types,
IDT;
procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt;
var
i : integer;
begin
CLI;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(12));
end;
BSOD('SF', 'Stack Fault Exception.');
console.writestringln('Stack Fault Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(12, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = 0 then begin
Hooks[i]:= pp_hook_method(hook_method);
exit;
end;
end;
end;
procedure unhook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
If uint32(Hooks[i]) = hook_method then Hooks[i]:= nil;
exit;
end;
end;
end.

View File

@ -1,75 +0,0 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR14
* Description: Page Fault
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit isr14;
interface
uses
util,
console,
isr_types,
IDT;
procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt;
var
i : integer;
begin
CLI;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(14));
end;
BSOD('PF', 'Page Fault.');
console.writestringln('Page Fault.');
util.halt_and_catch_fire;
end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(14, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = 0 then begin
Hooks[i]:= pp_hook_method(hook_method);
exit;
end;
end;
end;
procedure unhook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
If uint32(Hooks[i]) = hook_method then Hooks[i]:= nil;
exit;
end;
end;
end.

View File

@ -1,75 +0,0 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR15
* Description: Unknown Interrupt Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit isr15;
interface
uses
util,
console,
isr_types,
IDT;
procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt;
var
i : integer;
begin
CLI;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(15));
end;
BSOD('UI', 'Unknown Interrupt Exception.');
console.writestringln('Unknown Interrupt Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(15, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = 0 then begin
Hooks[i]:= pp_hook_method(hook_method);
exit;
end;
end;
end;
procedure unhook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
If uint32(Hooks[i]) = hook_method then Hooks[i]:= nil;
exit;
end;
end;
end.

View File

@ -1,75 +0,0 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR11
* Description: Coprocessor Fault Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit isr16;
interface
uses
util,
console,
isr_types,
IDT;
procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt;
var
i : integer;
begin
CLI;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(16));
end;
BSOD('CF', 'Coprocessor Fault Exception.');
console.writestringln('Coprocessor Fault Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(16, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = 0 then begin
Hooks[i]:= pp_hook_method(hook_method);
exit;
end;
end;
end;
procedure unhook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
If uint32(Hooks[i]) = hook_method then Hooks[i]:= nil;
exit;
end;
end;
end.

View File

@ -1,75 +0,0 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR17
* Description: Alignment Check Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit isr17;
interface
uses
util,
console,
isr_types,
IDT;
procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt;
var
i : integer;
begin
CLI;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(17));
end;
BSOD('AC', 'Alignment Check Exception.');
console.writestringln('Alignment Check Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(17, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = 0 then begin
Hooks[i]:= pp_hook_method(hook_method);
exit;
end;
end;
end;
procedure unhook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
If uint32(Hooks[i]) = hook_method then Hooks[i]:= nil;
exit;
end;
end;
end.

View File

@ -1,75 +0,0 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR18
* Description: Machine Check Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit isr18;
interface
uses
util,
console,
isr_types,
IDT;
procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt;
var
i : integer;
begin
CLI;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(18));
end;
BSOD('MC', 'Machine Check Exception.');
console.writestringln('Machine Check Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(18, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = 0 then begin
Hooks[i]:= pp_hook_method(hook_method);
exit;
end;
end;
end;
procedure unhook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
If uint32(Hooks[i]) = hook_method then Hooks[i]:= nil;
exit;
end;
end;
end.

View File

@ -1,75 +0,0 @@
{ ************************************************
* Asuro
* Unit: Drivers/ISR2
* Description: Non-Maskable Interrupt Exception
************************************************
* Author: K Morris
* Contributors:
************************************************ }
unit isr2;
interface
uses
util,
console,
isr_types,
IDT;
procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt;
var
i : integer;
begin
CLI;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](void(2));
end;
BSOD('NMI', 'Non-Maskable Interrupt Exception.');
console.writestringln('NMI Exception.');
util.halt_and_catch_fire;
end;
procedure register();
begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(2, uint32(@Main), $08, ISR_RING_0);
end;
procedure hook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = hook_method then exit;
end;
for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) = 0 then begin
Hooks[i]:= pp_hook_method(hook_method);
exit;
end;
end;
end;
procedure unhook(hook_method : uint32);
var
i : uint32;
begin
for i:=0 to MAX_HOOKS-1 do begin
If uint32(Hooks[i]) = hook_method then Hooks[i]:= nil;
exit;
end;
end;
end.

Some files were not shown because too many files have changed in this diff Show More