diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2014-12-02 18:10:14 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2014-12-02 18:10:14 +0100 |
commit | 456fc99e8feac598f7c6f1a3aaa82bf994404e39 (patch) | |
tree | c2aaf5b8225f7873f8189c5606bfe9041a7fa582 /kernel/l0/loader.s | |
parent | 76795abc2f08f180b7a895aaf26e80b971caa81c (diff) | |
download | kogata-456fc99e8feac598f7c6f1a3aaa82bf994404e39.tar.gz kogata-456fc99e8feac598f7c6f1a3aaa82bf994404e39.zip |
Begin implementation of paging
Diffstat (limited to 'kernel/l0/loader.s')
-rw-r--r-- | kernel/l0/loader.s | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/l0/loader.s b/kernel/l0/loader.s index 0f57549..e4c4611 100644 --- a/kernel/l0/loader.s +++ b/kernel/l0/loader.s @@ -1,5 +1,6 @@ [EXTERN kmain] ; kmain is defined in kmain.c [GLOBAL loader] ; making entry point visible to linker +[GLOBAL kernel_pagedir] ; make kernel page directory visible ; higher-half kernel setup K_HIGHHALF_ADDR equ 0xC0000000 @@ -24,7 +25,8 @@ multiboot_header: loader: ; setup the boot page directory used for higher-half - mov ecx, boot_pagedir + mov ecx, kernel_pagedir + sub ecx, K_HIGHHALF_ADDR ; access its lower-half address mov cr3, ecx ; Set PSE bit in CR4 to enable 4MB pages. @@ -41,8 +43,9 @@ loader: lea ecx, [higherhalf] jmp ecx +[section .data] align 0x1000 -boot_pagedir: +kernel_pagedir: ; uses 4MB pages ; identity-maps the first 4Mb of RAM, and also maps them with offset += k_highhalf_addr dd 0x00000083 @@ -53,7 +56,7 @@ boot_pagedir: [section .text] higherhalf: ; now we're running in higher half ; unmap first 4Mb - mov dword [boot_pagedir], 0 + mov dword [kernel_pagedir], 0 invlpg [0] mov esp, stack_top ; set up the stack |