rust-osdev / rust-osdev/bootloader

Bootloader does not map all required pages

Open
#197 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.7k
Forks
240
PR merge metrics
No merged PRs in 30d

Description

So I have no idea where to put this, though I've spoke about it in various places and have gotten no response in a month or so. (I apologize if I seem impatient.) It doesn't appear like the bootloader is mapping all of the required paged memory regions that my kernel uses. This in turn makes it prohibitive to continue my project because I have no idea why this is even happening to begin with. My debugging has lead me -- repeatedly -- to conclude that its a bug when x86_64 goes to zero an entry in one of the paging structures, though which one I am unclear about. Specifically, it occurs when allocating the kernel heap. When my kernel attempts to allocate address 3000h (or, rather, 18000003000h) I get a #PF, but since (for some reason) my IDT is being ignored (presumably it isn't mapped yet) a page fault occurs. Then another occurs because the ISRs aren't mapped, and then a double fault occurs, and then a triple fault. It has gotten to the point where I'm considering just making my own paging structures and not using the bootloader-provided ones. I want to avoid that but if there is truly no solution to this then I won't have much of a choice. My code is available here. Does anyone know why this is happening? Is there something I'm missing? From what I can tell the bootloader sets CR3 and (appears) to map everything but the behavior of my kernel leads me to believe otherwise.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the linked kernel repository and the x86_64 boot path, focusing on CR3 setup, paging structures, kernel-heap allocation at 18000003000h, and IDT/ISR mapping. Reproduce the page-fault cascade and compare the bootloader-provided mappings with the regions the kernel accesses; done when the required pages and fault handlers remain available during allocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.