Made Kernel 'Higher-Half' and enabled paging.

git-svn-id: https://spexeah.com:8443/svn/Asuro@85 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron
2017-05-17 23:24:05 +00:00
parent 7a8034196b
commit 019f6ccabf
43 changed files with 153 additions and 18 deletions

View File

@ -36,7 +36,7 @@ type
PBDA = ^TBDA;
const
BDA : PBDA = PBDA($0400);
BDA : PBDA = PBDA($C0000400);
procedure tick_update(data : void);

View File

@ -97,8 +97,8 @@ type
var
Console_Properties : TConsoleProperties;
Console_Memory : PVideoMemory = PVideoMemory($b8000);
Console_Matrix : P2DVideoMemory = P2DVideoMemory($b8000);
Console_Memory : PVideoMemory = PVideoMemory($C00b8000);
Console_Matrix : P2DVideoMemory = P2DVideoMemory($C00b8000);
Console_Cursor : TCoord;
procedure init(); [public, alias: 'console_init'];

View File

@ -20,9 +20,9 @@ implementation
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; [public, alias: 'kmain'];
var
c : uint8;
mbi : Pmultiboot_info_t;
mbm : uint32;
c : uint8;
mbi : Pmultiboot_info_t;
mbm : uint32;
z : uint32;
dds : uint32;
@ -46,9 +46,7 @@ begin
irq.init();
STI;
isr32.hook(uint32(@bios_data_area.tick_update));
console.debug:= true;
asm
@ -62,6 +60,7 @@ begin
console.setdefaultattribute(console.combinecolors(Red, Black));
console.writestringln('GDT: LOAD FAIL.');
end;
console.writestringln('');
console.setdefaultattribute(console.combinecolors(Green, Black));
console.writestringln('Asuro Booted Correctly!');
@ -76,6 +75,7 @@ begin
console.writestring('Total Memory = ');
console.writeint(((mbinfo^.mem_upper + 1000) div 1024) +1);
console.writestringln('MB');
while(true)do begin end;
console.setdefaultattribute(console.combinecolors(lYellow, Black));
util.halt_and_dont_catch_fire;

View File

@ -10,12 +10,12 @@
;
; Export entrypoint
;
[global kstart]
global _loader
;
; Import kernel entrypoint
;
[extern kmain]
extern kmain
;
; Posible multiboot header flags
@ -36,9 +36,18 @@ MULTIBOOT_HEADER_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEA
; Kernel stack size
;
KERNEL_STACKSIZE equ 0x4000
KERNEL_VIRTUAL_BASE equ 0xC0000000
KERNEL_PAGE_NUMBER equ (KERNEL_VIRTUAL_BASE >> 22)
section .data
align 0x1000
BootPageDirectory:
dd 0x00000083
times (KERNEL_PAGE_NUMBER - 1) dd 0
dd 0x00000083
times (1024 - KERNEL_PAGE_NUMBER - 1) dd 0
section .text
;
; Multiboot header
;
@ -50,16 +59,38 @@ dd MULTIBOOT_HEADER_CHECKSUM
;
; Entrypoint
;
loader equ _loader
global loader
_loader:
mov ecx, (BootPageDirectory - KERNEL_VIRTUAL_BASE)
mov cr3, ecx
mov ecx, cr4
or ecx, 0x00000010
mov cr4, ecx
mov ecx, cr0
or ecx, 0x80000000
mov cr0, ecx
lea ecx, [kstart]
jmp ecx
kstart:
mov dword [BootPageDirectory], 0
invlpg [0]
mov esp, KERNEL_STACK+KERNEL_STACKSIZE ;Create kernel stack
push eax ;Multiboot magic number
add ebx, KERNEL_VIRTUAL_BASE
push ebx ;Multiboot info
call kmain ;Call kernel entrypoint
cli ;Clear interrupts
hlt ;Halt machine
section .bss
;
; Kernel stack location
;