Using BIOS interrupts in protected mode. Is it impossible??
Posted: Thu Apr 28, 2011 12:55 pm
Hi this is my first post at Osdev.org
I've been developing an operating system for the past three months as a hobby. My initial plan was to develop a 32 bit protected mode and following some research i found that if I did so I would not be able to use BIOS interrupts. I wondered why but most answers were quite brief and meaningless ("because real mode and protected mode address memory in different ways", "because God said so", etc...) so I started learning about how protected mode works. After a week of researching I'm yet struggling to understand why using BIOS interrupts is such a no-no!?
If I got it right, in Protected mode you use an IDT rather than the IVT and the IDT can be placed anywhere in memory. OK... But couldn't we map the IDT to the usual BIOS IVT address? In protected mode you dont deal with segments but segment descriptors so when you put an address on the segment register it doesnt point to the register but rather to an entry in the Segment Descriptor which than points to a segment right? Plus registers are 32 bit and not 16 bit... OK... But i guess one could still map the IDT and GDT entries so that should you make a call to int 13h it loads the IDT entry that points to the GDT entry which points to the address of the BIOS int 13h ISR, or would that not be possible? Why can't one use 16-bit protected mode then?
I've asked a similar question in stack overflow and was told it wasnt possible due to the different levels implemented by protected mode so apps cant call BIOS code because they are sitting in different rings. Well.. Not if you have everything in ring 0! Or if you create system calls that then make calls to the appropriate BIOS functions (whose addresses will be marked as kernel level code)
I guess all I'm asking is for a descent explanation as to why this is not possible. 'No, it's not only very hard and stupid to implement. It is IMPOSSIBLE because of such and so!' is what I'm looking for
I heard of vmem mode and all that but I wonder what does make protected mode (be it 16 or 32 bit) and BIOS ISRs definitely incompatible!
Thanks in advance!
I've been developing an operating system for the past three months as a hobby. My initial plan was to develop a 32 bit protected mode and following some research i found that if I did so I would not be able to use BIOS interrupts. I wondered why but most answers were quite brief and meaningless ("because real mode and protected mode address memory in different ways", "because God said so", etc...) so I started learning about how protected mode works. After a week of researching I'm yet struggling to understand why using BIOS interrupts is such a no-no!?
If I got it right, in Protected mode you use an IDT rather than the IVT and the IDT can be placed anywhere in memory. OK... But couldn't we map the IDT to the usual BIOS IVT address? In protected mode you dont deal with segments but segment descriptors so when you put an address on the segment register it doesnt point to the register but rather to an entry in the Segment Descriptor which than points to a segment right? Plus registers are 32 bit and not 16 bit... OK... But i guess one could still map the IDT and GDT entries so that should you make a call to int 13h it loads the IDT entry that points to the GDT entry which points to the address of the BIOS int 13h ISR, or would that not be possible? Why can't one use 16-bit protected mode then?
I've asked a similar question in stack overflow and was told it wasnt possible due to the different levels implemented by protected mode so apps cant call BIOS code because they are sitting in different rings. Well.. Not if you have everything in ring 0! Or if you create system calls that then make calls to the appropriate BIOS functions (whose addresses will be marked as kernel level code)
I guess all I'm asking is for a descent explanation as to why this is not possible. 'No, it's not only very hard and stupid to implement. It is IMPOSSIBLE because of such and so!' is what I'm looking for
I heard of vmem mode and all that but I wonder what does make protected mode (be it 16 or 32 bit) and BIOS ISRs definitely incompatible!
Thanks in advance!