From 933abe8bc6f9480bcdea39c6bdd1a4e937402a06 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Fri, 8 Nov 2019 22:50:13 +0100 Subject: Add InterruptStackTable --- kernel/src/boot.asm | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'kernel/src/boot.asm') diff --git a/kernel/src/boot.asm b/kernel/src/boot.asm index 96a1fc1..36b1ef9 100644 --- a/kernel/src/boot.asm +++ b/kernel/src/boot.asm @@ -94,27 +94,26 @@ setup_page_tables: ; map each P2 entry to a huge 2MiB page mov ecx, 0 ; counter variable - mov eax, 0b10000011 ; present + writable + huge - mov edx, stack_bottom - shr edx, 18 + mov eax, 0b10000011 ; huge + writable + present .map_p2_table: - mov ebx, eax - ; map ecx-th P2 entry to a huge page that starts at address 2MiB*ecx - cmp ecx, edx - jne .valid_memory - add ebx, ~1 - sub eax, 0x200000 ; 2MiB - -.valid_memory: - mov [p2_table + ecx ], ebx ; map ecx-th entry + cmp eax, 0b10000011 + stack_bottom + jne .valid_mem + mov ebx, 0b10000010 + mov [p2_table + ecx], ebx + add ecx, 8 + cmp ecx, 4096 + jne .valid_mem + ret +.valid_mem: + mov [p2_table + ecx], eax add eax, 0x200000 ; 2MiB - add ecx, 8 - cmp ecx, 4096 ; if counter == 512, the whole P2 table is mapped - jne .map_p2_table ; else map the next entry - - ret + add ecx, 8 + cmp ecx, 4096 + jne .map_p2_table + + ret enable_paging: mov eax, p4_table @@ -167,7 +166,7 @@ p3_table: resb 4096 p2_table: resb 4096 -alignb 4096 * 512 +alignb 4096 * 512 ; align memory into huge memory page stack_bottom: resb 4096 * 42 stack_top: -- cgit v1.2.3-70-g09d2