Hello, I am writing an OS for hobby an it doesn't support interrupts in 32-bit mode. However, I plan to implement exception handling, and maybe rewrite keyboard driver. But I'm loading my kernel from USB so using BIOS for it. I switch back to real mode for that.
But I have a doubt; If I set up a new IDT when switching to 32-bit mode, does returning to real mode automatically loads default address for BIOS IVT(00h)? If not, how to load it? Also, do I have to reload IDT(using lidt) when jumping back to 32-bit mode again?
Interrupts when switching back to real mode
-
- Member
- Posts: 91
- Joined: Mon Apr 20, 2020 11:02 am
Interrupts when switching back to real mode
A beginner developer/student. Likes to know stuff. Don't have an OS to put here.
Re: Interrupts when switching back to real mode
No.pranavappu007 wrote:If I set up a new IDT when switching to 32-bit mode, does returning to real mode automatically loads default address for BIOS IVT(00h)?
You use LIDT again.pranavappu007 wrote:If not, how to load it?
And again. Now is a good time for you to start reading the CPU documentation. The answers to most of your questions are there.pranavappu007 wrote:Also, do I have to reload IDT(using lidt) when jumping back to 32-bit mode again?
-
- Member
- Posts: 91
- Joined: Mon Apr 20, 2020 11:02 am
Re: Interrupts when switching back to real mode
So I use lidt to load IVT and IDT. So just like IDT, you write the size of IVT which is 0x3FF and then address which is 0h and load with LIDT?
A beginner developer/student. Likes to know stuff. Don't have an OS to put here.
Re: Interrupts when switching back to real mode
You know, reading the CPU documentation is actually really helpful here. It would tell you that the reset value for the IDTR has a base address of 0, yes, but a length of 65535. I have no idea how it would ever access anything past 0x3ff, since an interrupt vector is 4 bytes in real mode and there are at most 256 of those around, but that is the reset value. Indeed the CPU documentation would tell you that there is no IVT, the IVT is just what we call the IDT in real mode.
Carpe diem!