enable paging before setting up idt

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ITchimp
Member
Member
Posts: 134
Joined: Sat Aug 18, 2018 8:44 pm

enable paging before setting up idt

Post by ITchimp »

Is idt set up mandatory before enable paging?

I am playing with the OS tutorial... I move the idt_init after paging and keep getting weird crashes...
someone help!!!
User avatar
bellezzasolo
Member
Member
Posts: 110
Joined: Sun Feb 20, 2011 2:01 pm

Re: enable paging before setting up idt

Post by bellezzasolo »

ITchimp wrote:Is idt set up mandatory before enable paging?

I am playing with the OS tutorial... I move the idt_init after paging and keep getting weird crashes...
someone help!!!
It's not compulsory, I initialize the IDT well after setting up paging.

Check that your idt_init is using virtual addresses.
Whoever said you can't do OS development on Windows?
https://github.com/ChaiSoft/ChaiOS
nullplan
Member
Member
Posts: 1790
Joined: Wed Aug 30, 2017 8:24 am

Re: enable paging before setting up idt

Post by nullplan »

While you are creating your paging implementation, you may want to add a temporary "early IDT". The routines would have to operate while paging is not available, and mostly just panic, but do so in an orderly fashion (unlike when you don't do this, maybe even load a zero-length IDT, and if something goes wrong the machine will tripple-fault). But yes, the main IDT has to be loaded after enabling paging. Both the IDT base address and the addresses of the routines contained therein are linear addresses, and thus will be considered virtual addresses once CR0.PG is enabled. Same for GDT, by the way. The GDT you load for switching to protected mode is only temporary, and the final version can only be loaded after you enable paging.
Carpe diem!
Post Reply