hi,
i was trying to implement paging, it was fast at first, all was doing great, but after i created a blank dir, and fill the table index, i have to initializate paging, and there's where the problem comes.inmediately when the paging is enabling, i got a triple fault, and comes back to grub.i couldn't solve it by my own or searching it in google.
Thanks!
Trying to enable paging causes triple faulting
Re: Trying to enable paging causes triple faulting
That is not enough info. It would be useful to see your code/know if you've used any tutorials.
What's the error code you're getting and what's the faulting address (see CR2 register)?
Triple faults (page faults in this case) can be caused by a variety of things.
For starters make sure:
1. CR3 holds a PHYSICAL address.
2. Your paging structures are mapped correctly, accessing them if not mapped leads to a page fault.
3. Your kernel is mapped correctly, aka PHYSICAL = VIRTUAL (if there is no higher half setup, if there is that's a different story)
Where is your kernel located (higher/lower half)?
Without any other info we can only guess.
Run it in Bochs and tell us what happens.
What's the error code you're getting and what's the faulting address (see CR2 register)?
Triple faults (page faults in this case) can be caused by a variety of things.
For starters make sure:
1. CR3 holds a PHYSICAL address.
2. Your paging structures are mapped correctly, accessing them if not mapped leads to a page fault.
3. Your kernel is mapped correctly, aka PHYSICAL = VIRTUAL (if there is no higher half setup, if there is that's a different story)
Where is your kernel located (higher/lower half)?
Without any other info we can only guess.
Run it in Bochs and tell us what happens.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: Trying to enable paging causes triple faulting
you can see my code in the github page that's below of the message. i've used the osdever paging page, Paging, and Setting Up Paging.the kernel is in the lower half.when i run bochs, the last thing that says is: ''[CPU0] WARNING: HLT instruction with IF=0!"
Thanks!
Thanks!
- eryjus
- Member
- Posts: 286
- Joined: Fri Oct 21, 2011 9:47 pm
- Libera.chat IRC: eryjus
- Location: Tustin, CA USA
Re: Trying to enable paging causes triple faulting
Where exactly are your page tables? I could not find a Page Directory or any Page Table. I could not find an place where they might be initialized (statically or runtime).
I am looking for the code in your initialization that will, at minimum:
* Allocate a 4096-byte block of memory that is 4K aligned for the Page Directory
* Clear that block of memory
* Allocate another 4096-byte block of memory that is 4K aligned for the kernel Page Table
* Clear that block of memory
* Determine the PD entry for the running kernel
* Install the kernel Page Table in the correct Page Directory Entry (physical address, mind)
* Determine the proper kernel Page Table entries for the running kernel
* Install the kernel physical memory frames into the kernel Page Table in the proper entries
* Install the Page Directory into the cr3 register (physical address, mind)
* Enables paging
Failing to build all these structures, paging will not work if you try to enable it and you will Page Fault with the very next instruction. Your Page Fault handler code will not be locatable and you will Double Fault. Your Double Fault code will not be locatable and you will triple fault.
I am looking for the code in your initialization that will, at minimum:
* Allocate a 4096-byte block of memory that is 4K aligned for the Page Directory
* Clear that block of memory
* Allocate another 4096-byte block of memory that is 4K aligned for the kernel Page Table
* Clear that block of memory
* Determine the PD entry for the running kernel
* Install the kernel Page Table in the correct Page Directory Entry (physical address, mind)
* Determine the proper kernel Page Table entries for the running kernel
* Install the kernel physical memory frames into the kernel Page Table in the proper entries
* Install the Page Directory into the cr3 register (physical address, mind)
* Enables paging
Failing to build all these structures, paging will not work if you try to enable it and you will Page Fault with the very next instruction. Your Page Fault handler code will not be locatable and you will Double Fault. Your Double Fault code will not be locatable and you will triple fault.
Adam
The name is fitting: Century Hobby OS -- At this rate, it's gonna take me that long!
Read about my mistakes and missteps with this iteration: Journal
"Sometimes things just don't make sense until you figure them out." -- Phil Stahlheber
The name is fitting: Century Hobby OS -- At this rate, it's gonna take me that long!
Read about my mistakes and missteps with this iteration: Journal
"Sometimes things just don't make sense until you figure them out." -- Phil Stahlheber
Re: Trying to enable paging causes triple faulting
IMO. Getting paging right is one of the most confusing things in OS development. But it's just like riding a bike. Once you get it right you don't forget it (no matter what architecture).
Re: Trying to enable paging causes triple faulting
Does CR2 contain a page address or an unaligned address?
I suspect that it would contain the exact address that failed and it would need to be manually aligned to 4096 bytes (or the size of pages) to find out the faulting page, but I don't know.
I suspect that it would contain the exact address that failed and it would need to be manually aligned to 4096 bytes (or the size of pages) to find out the faulting page, but I don't know.
YouTube:
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
Re: Trying to enable paging causes triple faulting
Yes, CR2 contains the entire failed address. If it failed, the processor can't know the page size, right? (Well, OK, unless it failed due to permissions)
Carpe diem!
Re: Trying to enable paging causes triple faulting
hi,
sorry for make no response.i've found the problem, i forgot to blank the page directory and fill the table index.sorry if i bothered with this!
Thanks!
sorry for make no response.i've found the problem, i forgot to blank the page directory and fill the table index.sorry if i bothered with this!
Thanks!