diff --git a/arch/x86/kernel/entry32.asm b/arch/x86/kernel/entry32.asm index eb4d8393..00ec044b 100644 --- a/arch/x86/kernel/entry32.asm +++ b/arch/x86/kernel/entry32.asm @@ -70,7 +70,7 @@ stublet: ; jump to the boot processors's C code extern main call main - jmp $ + jmp $ ; infinitive loop global cpu_init cpu_init: @@ -112,7 +112,7 @@ global read_ip read_ip: mov eax, [esp+4] pop DWORD [eax] ; Get the return address - add esp, 4 ; Dirty Hack! read_ip cleanup the stacl + add esp, 4 ; Dirty Hack! read_ip cleanup the stack jmp [eax] ; Return. Can't use RET because return ; address popped off the stack. diff --git a/arch/x86/kernel/entry64.asm b/arch/x86/kernel/entry64.asm index 3cebc86f..d749c08e 100644 --- a/arch/x86/kernel/entry64.asm +++ b/arch/x86/kernel/entry64.asm @@ -30,7 +30,7 @@ extern kernel_end extern apic_mp ; We use a special name to map this section at the begin of our kernel -; => Multiboot needs its magic number at the begin of the kernel +; => Multiboot needs its magic number at the beginning of the kernel SECTION .mboot global start start: @@ -42,19 +42,19 @@ mboot: ; Multiboot macros to make a few lines more readable later MULTIBOOT_PAGE_ALIGN equ 1<<0 MULTIBOOT_MEMORY_INFO equ 1<<1 - ; MULTIBOOT_AOUT_KLUDGE equ 1<<16 + ; MULTIBOOT_AOUT_KLUDGE equ 1<<16 MULTIBOOT_HEADER_MAGIC equ 0x1BADB002 MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO ; | MULTIBOOT_AOUT_KLUDGE - MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) + MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) EXTERN code, bss, end ; This is the GRUB Multiboot header. A boot signature dd MULTIBOOT_HEADER_MAGIC dd MULTIBOOT_HEADER_FLAGS dd MULTIBOOT_CHECKSUM - + ALIGN 4 -; we need already a valid GDT to switch in the 64bit modus +; we need already a valid GDT to switch in the 64bit mode GDT64: ; Global Descriptor Table (64-bit). .Null: equ $ - GDT64 ; The null descriptor. dw 0 ; Limit (low). @@ -81,7 +81,7 @@ GDT64: ; Global Descriptor Table (64-bit). dw $ - GDT64 - 1 ; Limit. dq GDT64 ; Base. - times 256 DD 0 + times 256 DD 0 ; stack for booting startup_stack: SECTION .data @@ -129,8 +129,8 @@ smp_entry: ; enable paging mov eax, cr0 - or eax, 1 << 31 | 1 << 0 ; Set the PG-bit, which is the 31nd bit, and the PM-bit, which is the 0th bit. - mov cr0, eax + or eax, 1 << 31 | 1 << 0 ; Set the PG-bit, which is the 31nd bit, and the PE-bit, which is the 0th bit. + mov cr0, eax ; According to the multiboot spec the PE-bit has to be set by bootloader already! mov edi, [esp+4] ; set argumet for smp_start lgdt [GDT64.Pointer] ; Load the 64-bit global descriptor table. @@ -342,7 +342,7 @@ Lc: ; enable paging mov eax, cr0 - or eax, 1 << 31 | 1 << 0 ; Set the PG-bit, which is the 31nd bit, and the PM-bit, which is the 0th bit. + or eax, 1 << 31 | 1 << 0 ; Set the PG-bit, which is the 31nd bit, and the PE-bit, which is the 0th bit. mov cr0, eax pop ebx ; restore pointer to multiboot structure diff --git a/arch/x86/mm/page32.c b/arch/x86/mm/page32.c index c961e0cc..c298befe 100644 --- a/arch/x86/mm/page32.c +++ b/arch/x86/mm/page32.c @@ -71,7 +71,7 @@ page_dir_t* get_boot_pgd(void) /* * TODO: We create a full copy of the current task. Copy-On-Access will be the better solution. * - * No PGD locking is needed because onls create_pgd use this function and holds already the + * No PGD locking is needed because only create_pgd use this function and holds already the * PGD lock. */ inline static size_t copy_page_table(task_t* task, uint32_t pgd_index, page_table_t* pgt, int* counter) @@ -650,7 +650,7 @@ static void pagefault_handler(struct state *s) memset((void*) viraddr, 0x00, PAGE_SIZE); return; } - + kprintf("Could not map 0x%x at 0x%x\n", phyaddr, viraddr); put_page(phyaddr); } diff --git a/arch/x86/mm/page64.c b/arch/x86/mm/page64.c index 1bb6cea5..9fb19fda 100644 --- a/arch/x86/mm/page64.c +++ b/arch/x86/mm/page64.c @@ -55,8 +55,8 @@ extern const void kernel_start; extern const void kernel_end; -// boot task's page directory and page directory lock -extern page_dir_t boot_pgd; +// boot task's page directory and p:age directory lock +extern page_dir_t boot_pgd; // TODO: initialization done in entry64.asm static spinlock_t kslock = SPINLOCK_INIT; static int paging_enabled = 0; @@ -67,7 +67,7 @@ page_dir_t* get_boot_pgd(void) int create_pgd(task_t* task, int copy) { - // Currently, we support only kernel tasks + // TODO: Currently, we support only kernel tasks // => all tasks are able to use the same pgd if (BUILTIN_EXPECT(!paging_enabled, 0)) @@ -130,7 +130,7 @@ size_t virt_to_phys(size_t viraddr) spinlock_irqsave_lock(&task->pgd_lock); - // Currently, we allocate pages only in kernel space. + // TODO: Currently, we allocate pages only in kernel space. // => physical address of the page table is identical of the virtual address pgt = (page_table_t*) (task->pgd->entries[idx_pd4] & PAGE_MASK); if (!pgt)