diff --git a/Asuro.iso b/Asuro.iso index e6151774..649c1a18 100644 Binary files a/Asuro.iso and b/Asuro.iso differ diff --git a/bin/kernel.bin b/bin/kernel.bin index 1a3884cb..c56c4ebb 100755 Binary files a/bin/kernel.bin and b/bin/kernel.bin differ diff --git a/iso/boot/asuro.bin b/iso/boot/asuro.bin index 1a3884cb..c56c4ebb 100755 Binary files a/iso/boot/asuro.bin and b/iso/boot/asuro.bin differ diff --git a/lib/bios_data_area.ppu b/lib/bios_data_area.ppu index db36f48c..2326e173 100644 Binary files a/lib/bios_data_area.ppu and b/lib/bios_data_area.ppu differ diff --git a/lib/console.ppu b/lib/console.ppu index d0db2364..44a928b1 100644 Binary files a/lib/console.ppu and b/lib/console.ppu differ diff --git a/lib/gdt.ppu b/lib/gdt.ppu index 54cd5770..00095cc0 100644 Binary files a/lib/gdt.ppu and b/lib/gdt.ppu differ diff --git a/lib/idt.ppu b/lib/idt.ppu new file mode 100644 index 00000000..472cef73 Binary files /dev/null and b/lib/idt.ppu differ diff --git a/lib/isr.ppu b/lib/isr.ppu new file mode 100644 index 00000000..cf256f06 Binary files /dev/null and b/lib/isr.ppu differ diff --git a/lib/kernel.o b/lib/kernel.o index c2c47388..d48f83bd 100644 Binary files a/lib/kernel.o and b/lib/kernel.o differ diff --git a/lib/kernel.ppu b/lib/kernel.ppu index ceacee34..5eef0893 100644 Binary files a/lib/kernel.ppu and b/lib/kernel.ppu differ diff --git a/lib/keyboard.ppu b/lib/keyboard.ppu index 4cf2fc96..84710943 100644 Binary files a/lib/keyboard.ppu and b/lib/keyboard.ppu differ diff --git a/lib/libpconsole.a b/lib/libpconsole.a index 63e7012e..65d76276 100644 Binary files a/lib/libpconsole.a and b/lib/libpconsole.a differ diff --git a/lib/libpkernel.a b/lib/libpkernel.a index 3fa89028..1d66c48c 100644 Binary files a/lib/libpkernel.a and b/lib/libpkernel.a differ diff --git a/lib/libpmultiboot.a b/lib/libpmultiboot.a index 7823e9b3..8f550519 100644 Binary files a/lib/libpmultiboot.a and b/lib/libpmultiboot.a differ diff --git a/lib/libpsystem.a b/lib/libpsystem.a index 89665b78..0b8389f5 100644 Binary files a/lib/libpsystem.a and b/lib/libpsystem.a differ diff --git a/lib/multiboot.ppu b/lib/multiboot.ppu index 34cecfc4..3932a21d 100644 Binary files a/lib/multiboot.ppu and b/lib/multiboot.ppu differ diff --git a/lib/system.o b/lib/system.o index 186f4ad4..06df60ef 100644 Binary files a/lib/system.o and b/lib/system.o differ diff --git a/lib/system.ppu b/lib/system.ppu index 020971fa..09358fca 100644 Binary files a/lib/system.ppu and b/lib/system.ppu differ diff --git a/lib/types.ppu b/lib/types.ppu deleted file mode 100644 index 910b58e4..00000000 Binary files a/lib/types.ppu and /dev/null differ diff --git a/lib/util.ppu b/lib/util.ppu index 05687614..9cc785e9 100644 Binary files a/lib/util.ppu and b/lib/util.ppu differ diff --git a/src/.vscode/launch.json b/src/.vscode/launch.json new file mode 100644 index 00000000..506fabea --- /dev/null +++ b/src/.vscode/launch.json @@ -0,0 +1,12 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug", + "type": "gdb", + "request": "launch", + "target": "./bin/executable", + "cwd": "${workspaceRoot}" + } + ] +} \ No newline at end of file diff --git a/src/bios_data_area.pas b/src/bios_data_area.pas index 4d8449ad..a124223f 100644 --- a/src/bios_data_area.pas +++ b/src/bios_data_area.pas @@ -2,9 +2,6 @@ unit bios_data_area; interface -uses - types; - type TBDA = bitpacked record COM1 : uint16; diff --git a/src/gdt.pas b/src/gdt.pas index 92e8b8ec..c541e01c 100644 --- a/src/gdt.pas +++ b/src/gdt.pas @@ -2,9 +2,6 @@ unit gdt; interface -uses - types; - type TGDT_Entry = bitpacked record limit_low : uint16; diff --git a/src/idt.pas b/src/idt.pas index b25e83cc..38ba916b 100644 --- a/src/idt.pas +++ b/src/idt.pas @@ -3,7 +3,6 @@ unit idt; interface uses - types, util; type @@ -27,6 +26,7 @@ var IDT_Pointer : TIDT_Pointer; procedure init(); +procedure set_gate(Number : uint8; Base : uint32; Selector : uint16; Flags : uint8); implementation diff --git a/src/isr.pas b/src/isr.pas new file mode 100644 index 00000000..c83c4723 --- /dev/null +++ b/src/isr.pas @@ -0,0 +1,31 @@ +unit isr; + +interface + +uses + idt, + console, + util; + +procedure init(); + +implementation + +procedure CLI(); assembler; nostackframe; +asm + CLI +end; + +procedure isr0(); interrupt; +begin + CLI; + console.writestringln('Divide by Zero Exception.'); + util.halt_and_catch_fire; +end; + +procedure init(); +begin + idt.set_gate(0, uint32(@isr0), $08, $8E); +end; + +end. \ No newline at end of file diff --git a/src/kernel.pas b/src/kernel.pas index 7f36ca2f..5e763f9c 100644 --- a/src/kernel.pas +++ b/src/kernel.pas @@ -3,11 +3,11 @@ unit kernel; interface uses - types, multiboot, util, gdt, idt, + isr, console, bios_data_area, keyboard; @@ -21,6 +21,7 @@ var c : uint8; mbi : Pmultiboot_info_t; mbm : uint32; + z : uint32; dds : uint32; begin @@ -28,6 +29,7 @@ begin mbm:= mbmagic; gdt.init(); idt.init(); + isr.init(); console.init(); console.writestringln('Booting Asuro...'); if (mbm <> MULTIBOOT_BOOTLOADER_MAGIC) then begin @@ -41,6 +43,7 @@ begin asm MOV dds, CS end; + z:=0; console.setdefaultattribute(console.combinecolors(Red, Black)); if dds = $08 then console.setdefaultattribute(console.combinecolors(Green, Black)); console.writehexln(dds); @@ -58,6 +61,8 @@ 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; console.writehexln(c); diff --git a/src/keyboard.pas b/src/keyboard.pas index e51b734d..3ac2b5b5 100644 --- a/src/keyboard.pas +++ b/src/keyboard.pas @@ -5,7 +5,6 @@ unit keyboard; interface uses - types, util; function get_scancode() : uint8; diff --git a/src/multiboot.pas b/src/multiboot.pas index c664a57d..e4e2e85c 100644 --- a/src/multiboot.pas +++ b/src/multiboot.pas @@ -1,9 +1,6 @@ unit multiboot; interface - -uses - types; const KERNEL_STACKSIZE = $4000; diff --git a/src/system.pas b/src/system.pas index dd3e3d48..f29fd1fa 100644 --- a/src/system.pas +++ b/src/system.pas @@ -1,15 +1,46 @@ -unit system; - -interface - -type - cardinal = 0..$FFFFFFFF; - hresult = cardinal; - dword = cardinal; - integer = longint; - - pchar = ^char; - -implementation - -end. \ No newline at end of file +unit system; + +interface + +type + //internal types + cardinal = 0..$FFFFFFFF; + hresult = cardinal; + dword = cardinal; + integer = longint; + + pchar = ^char; + + //Standard Types + uInt8 = BYTE; + uInt16 = WORD; + uInt32 = DWORD; + uInt64 = QWORD; + + sInt8 = shortint; + sInt16 = smallint; + sInt32 = integer; + sInt64 = longint; + + Float = Single; + + //Pointer Types + PuByte = ^Byte; + PuInt8 = PuByte; + PuInt16 = ^uInt16; + PuInt32 = ^uInt32; + PuInt64 = ^uInt64; + + PsInt8 = ^sInt8; + PsInt16 = ^sInt16; + PsInt32 = ^sInt32; + PsInt64 = ^sInt64; + + PFloat = ^Float; + PDouble = ^Double; + + Void = ^uInt32; + +implementation + +end. diff --git a/src/types.pas b/src/types.pas deleted file mode 100644 index fbc712f0..00000000 --- a/src/types.pas +++ /dev/null @@ -1,38 +0,0 @@ -unit types; - -interface - -type - //Standard Types - uInt8 = BYTE; - uInt16 = WORD; - uInt32 = DWORD; - uInt64 = QWORD; - - sInt8 = shortint; - sInt16 = smallint; - sInt32 = integer; - sInt64 = longint; - - Float = Single; - - //Pointer Types - PuByte = ^Byte; - PuInt8 = PuByte; - PuInt16 = ^uInt16; - PuInt32 = ^uInt32; - PuInt64 = ^uInt64; - - PsInt8 = ^sInt8; - PsInt16 = ^sInt16; - PsInt32 = ^sInt32; - PsInt64 = ^sInt64; - - PFloat = ^Float; - PDouble = ^Double; - - Void = ^uInt32; - -implementation - -end. diff --git a/src/util.pas b/src/util.pas index 07551b2b..ce3eda55 100644 --- a/src/util.pas +++ b/src/util.pas @@ -4,9 +4,6 @@ unit util; interface -uses - types; - function hi(b : uint8) : uint8; function lo(b : uint8) : uint8; function switchendian(b : uint8) : uint8;