diff --git a/src/bios_data_area.pas b/src/bios_data_area.pas index a124223f..c175b83d 100644 --- a/src/bios_data_area.pas +++ b/src/bios_data_area.pas @@ -1,3 +1,13 @@ +{ ************************************************ + * Asuro + * Unit: bios_data_area + * Description: Data Structures controlled by + * the BIOS. + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + unit bios_data_area; interface diff --git a/src/console.pas b/src/console.pas index 1fc388dc..a80d86e9 100644 --- a/src/console.pas +++ b/src/console.pas @@ -1,3 +1,12 @@ +{ ************************************************ + * Asuro + * Unit: console + * Description: Basic Console Output + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + unit console; interface diff --git a/src/drivers/isr0.pas b/src/drivers/isr0.pas index 33dab442..142b4541 100644 --- a/src/drivers/isr0.pas +++ b/src/drivers/isr0.pas @@ -1,3 +1,12 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR0 + * Description: Divide-By-Zero Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + unit isr0; interface @@ -5,15 +14,15 @@ interface uses util, console, + isr_types, IDT; procedure register(); implementation -procedure Main; interrupt; +procedure Main(); interrupt; begin - CLI; console.writestringln('Divide by Zero Exception.'); util.halt_and_catch_fire; end; diff --git a/src/drivers/isr1.pas b/src/drivers/isr1.pas index 160097f5..02dcd68d 100644 --- a/src/drivers/isr1.pas +++ b/src/drivers/isr1.pas @@ -1,3 +1,12 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR1 + * Description: Debug Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + unit isr1; interface @@ -5,16 +14,15 @@ interface uses util, console, + isr_types, IDT; procedure register(); implementation -procedure Main; interrupt; +procedure Main(); interrupt; begin - CLI; - util.halt_and_catch_fire; end; diff --git a/src/drivers/isr10.pas b/src/drivers/isr10.pas new file mode 100644 index 00000000..cfc82a69 --- /dev/null +++ b/src/drivers/isr10.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR10 + * Description: Bad TSS Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr10; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(10, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr11.pas b/src/drivers/isr11.pas new file mode 100644 index 00000000..2ab52f4a --- /dev/null +++ b/src/drivers/isr11.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR11 + * Description: Segment Not Present Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr11; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(11, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr12.pas b/src/drivers/isr12.pas new file mode 100644 index 00000000..ff21abe6 --- /dev/null +++ b/src/drivers/isr12.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR12 + * Description: Stack Fault Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr12; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(12, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr13.pas b/src/drivers/isr13.pas new file mode 100644 index 00000000..9b06a445 --- /dev/null +++ b/src/drivers/isr13.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR13 + * Description: General Protection Fault + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr13; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(13, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr14.pas b/src/drivers/isr14.pas new file mode 100644 index 00000000..4bbffbe6 --- /dev/null +++ b/src/drivers/isr14.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR14 + * Description: Page Fault + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr14; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(14, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr15.pas b/src/drivers/isr15.pas new file mode 100644 index 00000000..c4fd27cd --- /dev/null +++ b/src/drivers/isr15.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR15 + * Description: Unknown Interrupt Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr15; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(15, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr16.pas b/src/drivers/isr16.pas new file mode 100644 index 00000000..dde3f2ca --- /dev/null +++ b/src/drivers/isr16.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR11 + * Description: Coprocessor Fault Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr16; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(16, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr17.pas b/src/drivers/isr17.pas new file mode 100644 index 00000000..2d4c5b3e --- /dev/null +++ b/src/drivers/isr17.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR17 + * Description: Alignment Check Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr17; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(17, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr18.pas b/src/drivers/isr18.pas new file mode 100644 index 00000000..58e2ddec --- /dev/null +++ b/src/drivers/isr18.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR18 + * Description: Machine Check Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr18; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(18, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr2.pas b/src/drivers/isr2.pas new file mode 100644 index 00000000..ff41f989 --- /dev/null +++ b/src/drivers/isr2.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR2 + * Description: Non-Maskable Interrupt Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr2; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(2, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr3.pas b/src/drivers/isr3.pas new file mode 100644 index 00000000..92487671 --- /dev/null +++ b/src/drivers/isr3.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR3 + * Description: Breakpoint Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr3; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(3, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr4.pas b/src/drivers/isr4.pas new file mode 100644 index 00000000..76ffab58 --- /dev/null +++ b/src/drivers/isr4.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR4 + * Description: Into Detected Overflow Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr4; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(4, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr5.pas b/src/drivers/isr5.pas new file mode 100644 index 00000000..155dea01 --- /dev/null +++ b/src/drivers/isr5.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR5 + * Description: Out of Bounds Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr5; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(5, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr6.pas b/src/drivers/isr6.pas new file mode 100644 index 00000000..24711206 --- /dev/null +++ b/src/drivers/isr6.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR6 + * Description: Invalid OPCode Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr6; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(6, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr7.pas b/src/drivers/isr7.pas new file mode 100644 index 00000000..65dcc7e8 --- /dev/null +++ b/src/drivers/isr7.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR7 + * Description: No Coprocessor Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr7; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(7, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr8.pas b/src/drivers/isr8.pas new file mode 100644 index 00000000..b96ed1e4 --- /dev/null +++ b/src/drivers/isr8.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR8 + * Description: Double Fault Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr8; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(8, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr9.pas b/src/drivers/isr9.pas new file mode 100644 index 00000000..7c301a88 --- /dev/null +++ b/src/drivers/isr9.pas @@ -0,0 +1,34 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/ISR9 + * Description: Coprocessor Seg Overrun Exception + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr9; + +interface + +uses + util, + console, + isr_types, + IDT; + +procedure register(); + +implementation + +procedure Main(); interrupt; +begin + util.halt_and_catch_fire; +end; + +procedure register(); +begin + IDT.set_gate(9, uint32(@Main), $08, ISR_RING_0); +end; + +end. \ No newline at end of file diff --git a/src/drivers/isr_types.pas b/src/drivers/isr_types.pas new file mode 100644 index 00000000..ca6e782c --- /dev/null +++ b/src/drivers/isr_types.pas @@ -0,0 +1,22 @@ +{ ************************************************ + * Asuro + * Unit: Drivers/isr_types + * Description: Defines for ISRs (WIP) + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + +unit isr_types; + +interface + +type + ISR_REGS = record + ip, cs, flags, sp, ss : uint16; + end; + PISR_REGS = ^ISR_REGS; + +implementation + +end. \ No newline at end of file diff --git a/src/gdt.pas b/src/gdt.pas index c541e01c..f4934acb 100644 --- a/src/gdt.pas +++ b/src/gdt.pas @@ -1,3 +1,12 @@ +{ ************************************************ + * Asuro + * Unit: GDT + * Description: GDT Structure and Implementation + ************************************************ + * Author: K Morris + * Contributors: A Hance + ************************************************ } + unit gdt; interface diff --git a/src/idt.pas b/src/idt.pas index c09efc14..b05560c3 100644 --- a/src/idt.pas +++ b/src/idt.pas @@ -1,3 +1,12 @@ +{ ************************************************ + * Asuro + * Unit: IDT + * Description: IDT Structure and Implementation + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + unit idt; interface diff --git a/src/isr.pas b/src/isr.pas index d9884755..b86ea1da 100644 --- a/src/isr.pas +++ b/src/isr.pas @@ -1,10 +1,21 @@ +{ ************************************************ + * Asuro + * Unit: isr + * Description: Stub for ISR Driver Initialization + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + unit isr; interface uses - ISR0, - ISR1; + ISR0, ISR1, ISR2, ISR3, ISR4, ISR5, ISR6, ISR7, ISR8, ISR9, + ISR10, ISR11, ISR12, ISR13, ISR14, ISR15, ISR16, ISR17, ISR18; + + procedure init(); @@ -14,6 +25,23 @@ procedure init(); begin ISR0.register(); ISR1.register(); + ISR2.register(); + ISR3.register(); + ISR4.register(); + ISR5.register(); + ISR6.register(); + ISR7.register(); + ISR8.register(); + ISR9.register(); + ISR10.register(); + ISR11.register(); + ISR12.register(); + ISR13.register(); + ISR14.register(); + ISR15.register(); + ISR16.register(); + ISR17.register(); + ISR18.register(); end; end. \ No newline at end of file diff --git a/src/kernel.pas b/src/kernel.pas index 5e763f9c..f114a6c6 100644 --- a/src/kernel.pas +++ b/src/kernel.pas @@ -47,6 +47,7 @@ begin console.setdefaultattribute(console.combinecolors(Red, Black)); if dds = $08 then console.setdefaultattribute(console.combinecolors(Green, Black)); console.writehexln(dds); + mbm := mbm div z; console.setdefaultattribute(console.combinecolors(Green, Black)); console.writestringln('Asuro Booted Correctly!'); console.writestringln(''); @@ -61,7 +62,6 @@ begin console.writeint(((mbinfo^.mem_upper + 1000) div 1024) +1); console.writestringln('MB'); console.setdefaultattribute(console.combinecolors(lYellow, Black)); - mbm := mbm div z; util.halt_and_catch_fire; {while true do begin c:= keyboard.get_scancode; diff --git a/src/keyboard.pas b/src/keyboard.pas index 3ac2b5b5..75085bd9 100644 --- a/src/keyboard.pas +++ b/src/keyboard.pas @@ -1,3 +1,14 @@ +{ ************************************************ + * DEPRECATED + ************************************************ + * Asuro + * Unit: keyboard + * Description: Basic Keyboard Polling + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + unit keyboard; {$ASMMODE intel} diff --git a/src/multiboot.pas b/src/multiboot.pas index e4e2e85c..3c8f06b7 100644 --- a/src/multiboot.pas +++ b/src/multiboot.pas @@ -1,3 +1,12 @@ +{ ************************************************ + * Asuro + * Unit: Multiboot + * Description: Mutliboot (GRUB) Structures. + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + unit multiboot; interface diff --git a/src/system.pas b/src/system.pas index f29fd1fa..52fe7cc2 100644 --- a/src/system.pas +++ b/src/system.pas @@ -1,3 +1,12 @@ +{ ************************************************ + * Asuro + * Unit: system + * Description: Standard System Types + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + unit system; interface diff --git a/src/util.pas b/src/util.pas index e262944f..31f9be50 100644 --- a/src/util.pas +++ b/src/util.pas @@ -1,3 +1,12 @@ +{ ************************************************ + * Asuro + * Unit: util + * Description: Utilities for data manipulation + ************************************************ + * Author: K Morris + * Contributors: + ************************************************ } + unit util; {$ASMMODE intel}