fixed paging problem
This commit is contained in:
parent
faa6ce0757
commit
bd20049519
|
@ -80,18 +80,6 @@ flush_tss:
|
|||
ltr [esp+4]
|
||||
ret
|
||||
|
||||
global enable_paging
|
||||
enable_paging:
|
||||
push eax
|
||||
mov eax, [esp+4]
|
||||
mov cr3, eax
|
||||
|
||||
mov eax, cr0
|
||||
or eax, 0x80000000
|
||||
mov cr0, eax
|
||||
pop eax
|
||||
ret
|
||||
|
||||
extern exception_handler
|
||||
%macro isr_err_stub 1
|
||||
isr_stub_%+%1:
|
||||
|
|
|
@ -17,7 +17,6 @@ extern void pit_isr(void);
|
|||
extern void jmp_user_mode(uint32_t esp, uint32_t eip);
|
||||
extern void flush_tss(uint32_t segment_selector);
|
||||
extern gdt_t gdt[6];
|
||||
extern void enable_paging(uint32_t *page_directory);
|
||||
|
||||
void exception_handler(int_stack_frame_t r) {
|
||||
LOG("Exception 0x%X (0x%X) has occurred\nEAX: 0x%08X\nECX: 0x%08X\nEDX: 0x%08X\nEBX: 0x%08X\nESI: 0x%08X\nEDI: 0x%08X\nEBP: 0x%08X\nESP: 0x%08X\n",
|
||||
|
@ -94,8 +93,6 @@ void kernel(multiboot_info_t *info) {
|
|||
#define PAGE_TAB_INDEX(x) (((x) >> 12) & 0x3FF)
|
||||
#define PAGE_OFFSET(x) ((x) & 0xFFF)
|
||||
|
||||
LOG("Page directory: %08X -- Page table: %08X\n", page_dir, page_tab);
|
||||
|
||||
for (int i = 0; i < 1024; i++) {
|
||||
page_tab[i] = (i * 0x1000) | PAGE_PRESENT | PAGE_RW | PAGE_USER;
|
||||
}
|
||||
|
@ -104,7 +101,17 @@ void kernel(multiboot_info_t *info) {
|
|||
page_dir[i] = ((uint32_t)page_tab) | PAGE_PRESENT | PAGE_RW | PAGE_USER;
|
||||
}
|
||||
|
||||
enable_paging(page_dir);
|
||||
//enable_paging(page_dir);
|
||||
asm volatile("mov %0, %%cr3" :: "r" (page_dir));
|
||||
|
||||
asm volatile(
|
||||
"mov %%cr0, %%eax;"
|
||||
"or $0x80000000, %%eax;"
|
||||
"mov %%eax, %%cr0;"
|
||||
:
|
||||
:
|
||||
: "%eax"
|
||||
);
|
||||
|
||||
uint32_t stack = (uint32_t)mmap_find_first_free_block();
|
||||
multi_mod_t *init = (multi_mod_t *)info->moduleaddress;
|
||||
|
|
Loading…
Reference in New Issue
Block a user