ISR Hooking.

git-svn-id: https://spexeah.com:8443/svn/Asuro@76 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron committed 2017-05-17 17:31:38 +00:00
1 parent 886e6a8cdf
commit bc96202990
25 files changed
+685 -1

No files matched your search

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -33,7 +33,7 @@ var
begin begin
CLI; CLI;
for i:=0 to MAX_HOOKS-1 do begin for i:=0 to MAX_HOOKS-1 do begin
if uint32(Hooks[i]) <> 0 then Hooks[i](nil); if uint32(Hooks[i]) <> 0 then Hooks[i](void(0));
end; end;
console.writestringln('Divide by Zero Exception.'); console.writestringln('Divide by Zero Exception.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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.'); console.writestringln('Debug Exception.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(1, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(1, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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.'); console.writestringln('Bad TSS Exception.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(10, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(10, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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.'); console.writestringln('Segment Not Present Exception.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(11, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(11, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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.'); console.writestringln('Stack Fault Exception.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(12, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(12, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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.'); console.writestringln('General Protection Fault.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(13, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(13, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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.'); console.writestringln('Page Fault.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(14, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(14, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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.'); console.writestringln('Unknown Interrupt Exception.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(15, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(15, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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.'); console.writestringln('Coprocessor Fault Exception.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(16, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(16, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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.'); console.writestringln('Alignment Check Exception.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(17, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(17, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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.'); console.writestringln('Machine Check Exception.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(18, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(18, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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.'); console.writestringln('NMI Exception.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(2, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(2, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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'); console.writestringln('Breakpoint Exception');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(3, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(3, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
+38
View File
@@ -18,19 +18,57 @@ uses
IDT; IDT;
procedure register(); procedure register();
procedure hook(hook_method : uint32);
procedure unhook(hook_method : uint32);
implementation implementation
var
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
procedure Main(); interrupt; procedure Main(); interrupt;
var
i : integer;
begin begin
CLI; 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.'); console.writestringln('IDO Exception.');
util.halt_and_catch_fire; util.halt_and_catch_fire;
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(4, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(4, uint32(@Main), $08, ISR_RING_0);
end; 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. end.
Loaded 20 of 25 files, more files were not shown because too many files have changed in this diff. Show more