Changes
git-svn-id: https://spexeah.com:8443/svn/Asuro@165 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
74
src/isr/isr0.pas
Normal file
74
src/isr/isr0.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* 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;
|
||||
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.
|
74
src/isr/isr1.pas
Normal file
74
src/isr/isr1.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* 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;
|
||||
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.
|
74
src/isr/isr10.pas
Normal file
74
src/isr/isr10.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* 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;
|
||||
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.
|
74
src/isr/isr11.pas
Normal file
74
src/isr/isr11.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* 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;
|
||||
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.
|
74
src/isr/isr12.pas
Normal file
74
src/isr/isr12.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* 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;
|
||||
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.
|
74
src/isr/isr13.pas
Normal file
74
src/isr/isr13.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/ISR13
|
||||
* Description: General Protection Fault
|
||||
************************************************
|
||||
* Author: K Morris
|
||||
* Contributors:
|
||||
************************************************ }
|
||||
|
||||
unit isr13;
|
||||
|
||||
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(13));
|
||||
end;
|
||||
console.writestringln('General Protection Fault.');
|
||||
util.halt_and_catch_fire;
|
||||
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;
|
||||
end;
|
||||
|
||||
end.
|
74
src/isr/isr14.pas
Normal file
74
src/isr/isr14.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* 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;
|
||||
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.
|
74
src/isr/isr15.pas
Normal file
74
src/isr/isr15.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* 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;
|
||||
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.
|
74
src/isr/isr16.pas
Normal file
74
src/isr/isr16.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* 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;
|
||||
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.
|
74
src/isr/isr17.pas
Normal file
74
src/isr/isr17.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* 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;
|
||||
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.
|
74
src/isr/isr18.pas
Normal file
74
src/isr/isr18.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* 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;
|
||||
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.
|
74
src/isr/isr2.pas
Normal file
74
src/isr/isr2.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* 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;
|
||||
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.
|
74
src/isr/isr3.pas
Normal file
74
src/isr/isr3.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/ISR3
|
||||
* Description: Breakpoint Exception
|
||||
************************************************
|
||||
* Author: K Morris
|
||||
* Contributors:
|
||||
************************************************ }
|
||||
|
||||
unit isr3;
|
||||
|
||||
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(3));
|
||||
end;
|
||||
console.writestringln('Breakpoint Exception');
|
||||
util.halt_and_catch_fire;
|
||||
end;
|
||||
|
||||
procedure register();
|
||||
begin
|
||||
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
|
||||
IDT.set_gate(3, 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.
|
83
src/isr/isr32.pas
Normal file
83
src/isr/isr32.pas
Normal file
@ -0,0 +1,83 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/isr32
|
||||
* Description: 1024hz Timer interrupt
|
||||
************************************************
|
||||
* Author: Aaron Hance
|
||||
* Contributors: K Morris
|
||||
************************************************ }
|
||||
|
||||
unit isr32;
|
||||
|
||||
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; //IRQ0, 1024.19hz aprox
|
||||
var
|
||||
i : integer;
|
||||
|
||||
begin
|
||||
CLI;
|
||||
for i:=0 to MAX_HOOKS-1 do begin
|
||||
if uint32(Hooks[i]) <> 0 then begin
|
||||
Hooks[i](nil);
|
||||
end;
|
||||
end;
|
||||
outb($20, $20);
|
||||
end;
|
||||
|
||||
procedure register();
|
||||
begin
|
||||
asm
|
||||
mov al, $36
|
||||
out $46, al
|
||||
mov ax, 1165
|
||||
out $40, al
|
||||
mov al, ah
|
||||
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);
|
||||
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.
|
77
src/isr/isr33.pas
Normal file
77
src/isr/isr33.pas
Normal file
@ -0,0 +1,77 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/isr33
|
||||
* Description: Keyboard interrupt
|
||||
************************************************
|
||||
* Author: Aaron Hance
|
||||
* Contributors: K Morris
|
||||
************************************************ }
|
||||
|
||||
unit isr33;
|
||||
|
||||
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;
|
||||
b : dword;
|
||||
|
||||
begin
|
||||
b:= inb($60);
|
||||
//console.writehexln(b);
|
||||
for i:=0 to MAX_HOOKS-1 do begin
|
||||
if uint32(Hooks[i]) <> 0 then begin
|
||||
Hooks[i](void(b));
|
||||
end;
|
||||
end;
|
||||
outb($20, $20);
|
||||
end;
|
||||
|
||||
procedure register();
|
||||
begin
|
||||
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
|
||||
IDT.set_gate(33, 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.
|
74
src/isr/isr4.pas
Normal file
74
src/isr/isr4.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/ISR4
|
||||
* Description: Into Detected Overflow Exception
|
||||
************************************************
|
||||
* Author: K Morris
|
||||
* Contributors:
|
||||
************************************************ }
|
||||
|
||||
unit isr4;
|
||||
|
||||
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(4));
|
||||
end;
|
||||
console.writestringln('IDO Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
end;
|
||||
|
||||
procedure register();
|
||||
begin
|
||||
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
|
||||
IDT.set_gate(4, 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.
|
74
src/isr/isr40.pas
Normal file
74
src/isr/isr40.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/isr40
|
||||
* Description: 1024/s Timer interrupt
|
||||
************************************************
|
||||
* Author: Aaron Hance
|
||||
* Contributors: K Morris
|
||||
************************************************ }
|
||||
|
||||
unit isr40;
|
||||
|
||||
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; //IRQ0, called 1024 times a second.
|
||||
var
|
||||
i : integer;
|
||||
|
||||
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
|
||||
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
|
||||
IDT.set_gate(40, 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.
|
||||
|
73
src/isr/isr46.pas
Normal file
73
src/isr/isr46.pas
Normal file
@ -0,0 +1,73 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/ISR46
|
||||
* Description: Primary ATA IRQ
|
||||
************************************************
|
||||
* Author: Aaron Hance
|
||||
* Contributors:
|
||||
************************************************ }
|
||||
|
||||
unit isr46;
|
||||
|
||||
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($00000000)));
|
||||
end;
|
||||
console.writestringln('Disk Operation Complete');
|
||||
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.
|
74
src/isr/isr5.pas
Normal file
74
src/isr/isr5.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/ISR5
|
||||
* Description: Out of Bounds Exception
|
||||
************************************************
|
||||
* Author: K Morris
|
||||
* Contributors:
|
||||
************************************************ }
|
||||
|
||||
unit isr5;
|
||||
|
||||
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(5));
|
||||
end;
|
||||
console.writestringln('OOB Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
end;
|
||||
|
||||
procedure register();
|
||||
begin
|
||||
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
|
||||
IDT.set_gate(5, 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.
|
74
src/isr/isr6.pas
Normal file
74
src/isr/isr6.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/ISR6
|
||||
* Description: Invalid OPCode Exception
|
||||
************************************************
|
||||
* Author: K Morris
|
||||
* Contributors:
|
||||
************************************************ }
|
||||
|
||||
unit isr6;
|
||||
|
||||
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(6));
|
||||
end;
|
||||
console.writestringln('Invalid OPCode Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
end;
|
||||
|
||||
procedure register();
|
||||
begin
|
||||
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
|
||||
IDT.set_gate(6, 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.
|
74
src/isr/isr7.pas
Normal file
74
src/isr/isr7.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/ISR7
|
||||
* Description: No Coprocessor Exception
|
||||
************************************************
|
||||
* Author: K Morris
|
||||
* Contributors:
|
||||
************************************************ }
|
||||
|
||||
unit isr7;
|
||||
|
||||
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(7));
|
||||
end;
|
||||
console.writestringln('No Coprocessor Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
end;
|
||||
|
||||
procedure register();
|
||||
begin
|
||||
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
|
||||
IDT.set_gate(7, 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.
|
74
src/isr/isr8.pas
Normal file
74
src/isr/isr8.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/ISR8
|
||||
* Description: Double Fault Exception
|
||||
************************************************
|
||||
* Author: K Morris
|
||||
* Contributors:
|
||||
************************************************ }
|
||||
|
||||
unit isr8;
|
||||
|
||||
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(8));
|
||||
end;
|
||||
console.writestringln('Double Fault.');
|
||||
util.halt_and_catch_fire;
|
||||
end;
|
||||
|
||||
procedure register();
|
||||
begin
|
||||
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
|
||||
IDT.set_gate(8, 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.
|
74
src/isr/isr9.pas
Normal file
74
src/isr/isr9.pas
Normal file
@ -0,0 +1,74 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/ISR9
|
||||
* Description: Coprocessor Seg Overrun Exception
|
||||
************************************************
|
||||
* Author: K Morris
|
||||
* Contributors:
|
||||
************************************************ }
|
||||
|
||||
unit isr9;
|
||||
|
||||
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(9));
|
||||
end;
|
||||
console.writestringln('Coprocessor Seg Overrun Exception.');
|
||||
util.halt_and_catch_fire;
|
||||
end;
|
||||
|
||||
procedure register();
|
||||
begin
|
||||
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
|
||||
IDT.set_gate(9, 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.
|
28
src/isr/isr_types.pas
Normal file
28
src/isr/isr_types.pas
Normal file
@ -0,0 +1,28 @@
|
||||
{ ************************************************
|
||||
* Asuro
|
||||
* Unit: Drivers/isr_types
|
||||
* Description: Defines for ISRs (WIP)
|
||||
************************************************
|
||||
* Author: K Morris
|
||||
* Contributors:
|
||||
************************************************ }
|
||||
|
||||
unit isr_types;
|
||||
|
||||
interface
|
||||
|
||||
const
|
||||
MAX_HOOKS = 16;
|
||||
|
||||
type
|
||||
ISR_REGS = record
|
||||
ip, cs, flags, sp, ss : uint16;
|
||||
end;
|
||||
PISR_REGS = ^ISR_REGS;
|
||||
|
||||
pp_hook_method = procedure(data : void);
|
||||
pp_void = pp_hook_method;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
Reference in New Issue
Block a user