Skip to content

Commit 93828fb

Browse files
committed
fixed gdt / tss alignment
1 parent af28a81 commit 93828fb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

mckrnl/core/interrupts/gdt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <interrupts/gdt.h>
22
#include <memory/pmm.h>
3-
#include <memory/heap.h>
3+
#include <memory/vmm.h>
44
#include <stdint.h>
55
#include <stdio.h>
66

@@ -18,8 +18,8 @@ void gdt_set_entry(uint64_t* gdt, int i, unsigned int base, unsigned int limit,
1818

1919
uint64_t* new_gdt() {
2020
debugf("Creating new gdt...");
21-
uint64_t* gdt = kmalloc(sizeof(uint64_t) * GDT_ENTRIES);
22-
uint32_t* tss = kmalloc(sizeof(uint32_t) * 32);
21+
uint64_t* gdt = vmm_alloc(TO_PAGES(sizeof(uint64_t) * GDT_ENTRIES));
22+
uint32_t* tss = vmm_alloc(TO_PAGES(sizeof(uint32_t) * 32));
2323

2424
tss[0] = 0;
2525
tss[1] = 0;

mckrnl/core/memory/vmm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ void vmm_init(void) {
9999

100100
debugf("Mapping multiboot structure...");
101101
struct multiboot_module* modules = global_multiboot_info->mbs_mods_addr;
102-
vmm_map_page(kernel_context, (uintptr_t) global_multiboot_info, (uintptr_t) global_multiboot_info, PTE_PRESENT);
103-
vmm_map_page(kernel_context, (uintptr_t) modules, (uintptr_t) modules, PTE_PRESENT);
102+
vmm_map_page(kernel_context, ALIGN_PAGE_DOWN((uintptr_t) global_multiboot_info), ALIGN_PAGE_DOWN((uintptr_t) global_multiboot_info), PTE_PRESENT);
103+
vmm_map_page(kernel_context, ALIGN_PAGE_DOWN((uintptr_t) modules), ALIGN_PAGE_DOWN((uintptr_t) modules), PTE_PRESENT);
104104

105105
int i;
106106
for (i = 0; i < global_multiboot_info->mbs_mods_count; i++) {

0 commit comments

Comments
 (0)