More ISR Hooks.

git-svn-id: https://spexeah.com:8443/svn/Asuro@77 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron 2017-05-17 17:34:38 +00:00
parent bc96202990
commit f8399ecace
6 changed files with 39 additions and 8 deletions

BIN
Asuro.iso

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,7 @@
* Description: 1024/s Timer interrupt * Description: 1024/s Timer interrupt
************************************************ ************************************************
* Author: Aaron Hance * Author: Aaron Hance
* Contributors: * Contributors: K Morris
************************************************ } ************************************************ }
unit isr40; unit isr40;
@ -17,27 +17,58 @@ uses
isr_types, isr_types,
IDT; IDT;
//var
//procedure_ptr : pp_void = nil;
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; //IRQ0, called 1024 times a second. procedure Main; interrupt; //IRQ0, called 1024 times a second.
var
i : integer;
begin begin
console.writestringln('helo3'); for i:=0 to MAX_HOOKS-1 do begin
//if(procedure_ptr <> nil) then begin if uint32(Hooks[i]) <> 0 then Hooks[i](void(18));
// procedure_ptr(); end;
//end;
outb($A0, $20); outb($A0, $20);
outb($20, $20); outb($20, $20);
end; end;
procedure register(); procedure register();
begin begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(40, uint32(@Main), $08, ISR_RING_0); IDT.set_gate(40, 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.