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

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

No files matched your search

@@ -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,14 +44,17 @@ 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);
inb($60);
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);
isrmanager.registerISR(33, @Main);
inb($60);
end;
end;
procedure hook(hook_method : uint32);
@@ -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,22 +126,26 @@ var
begin
push_trace('isr44.register');
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
mouse_wait(1);
outb($64, $A8);
mouse_wait(1);
outb($64, $20);
mouse_wait(0);
status:= inb($60) OR $02;
mouse_wait(1);
outb($64, $60);
mouse_wait(1);
outb($60, status);
mouse_write($F6);
mouse_read();
mouse_write($F4);
mouse_read();
IDT.set_gate(44, uint32(@Main), $08, ISR_RING_0);
if not Registered then begin
Registered:= true;
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
mouse_wait(1);
outb($64, $A8);
mouse_wait(1);
outb($64, $20);
mouse_wait(0);
status:= inb($60) OR $02;
mouse_wait(1);
outb($64, $60);
mouse_wait(1);
outb($60, status);
mouse_write($F6);
mouse_read();
mouse_write($F4);
mouse_read();
isrmanager.registerISR(44, @Main);
//IDT.set_gate(44, uint32(@Main), $08, ISR_RING_0);
end;
pop_trace;
end;
+3 -2
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;
+3 -2
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;
@@ -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);
@@ -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,21 +44,24 @@ 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
if not registered then 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);
isrmanager.registerISR(32, @Main);
Registered:= true;
end;
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(32, uint32(@Main), $08, ISR_RING_0);
//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;
@@ -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
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
IDT.set_gate(40, uint32(@Main), $08, ISR_RING_0);
if not registered then begin
memset(uint32(@Hooks[0]), 0, sizeof(pp_hook_method)*MAX_HOOKS);
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
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
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
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
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
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
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
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
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.
+6 -38
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
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
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
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
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.
Loaded 20 of 110 files, more files were not shown because too many files have changed in this diff. Show more