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
************************************************
* Author: Aaron Hance
* Contributors:
* Contributors: K Morris
************************************************ }
unit isr40;
@ -17,27 +17,58 @@ uses
isr_types,
IDT;
//var
//procedure_ptr : pp_void = nil;
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
console.writestringln('helo3');
//if(procedure_ptr <> nil) then begin
// procedure_ptr();
//end;
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.