Page 1 of 1

bios switch to pmode

Posted: Thu Jun 14, 2007 7:58 pm
by kubeos
I was going through a list of int 15h services and noticed that function 89h allows you to switch to pmode. This sure seems like an easier way to do it as it also allows you to setup the irq's during the call as well. Of course you still need a GDT before making the call.

Is this something that is supported by most bios's or only a specific type.

[EDIT] And has anyone ever used this? Just curious.

Posted: Thu Jun 14, 2007 9:49 pm
by neon
I never knew there was an int for it... so, no, I never used it :)

Posted: Fri Jun 15, 2007 2:27 am
by os64dev
best to do it yourself, who know what the bios does. it problably is a bios specific function and not generally used.

Posted: Fri Jun 15, 2007 2:39 am
by mathematician
int 15h fn 89h has been one of the BIOS services for as far back as I can remember. I have wondered more than once why nobody here seems to use it.

Not only does it reprogram the PICs, but it enables A20 as well.

Posted: Fri Jun 15, 2007 3:52 am
by Aali
well, why rely on the BIOS for one of the things we actually do know how to do properly ourselves?

Posted: Fri Jun 15, 2007 5:09 am
by mathematician
Why take a couple of dozen lines to do what you can do in four or five?

Posted: Fri Jun 15, 2007 5:50 am
by Brendan
Hi,
mathematician wrote:Why take a couple of dozen lines to do what you can do in four or five?
Because if you use your own code you don't have to worry about whether or not this BIOS function is supported by the computer.

You also don't end up with 6 descriptors when 2 is (typically) enough, and don't need to be worried about how the BIOS returns to your code (if CS needs to use a 16-bit default operand size to make sure the BIOS's IRET works, if CS base needs to be the same as it was in real mode, and whether or not the IDT must have descriptors preconfigured or if the BIOS returns with interrupts disabled).


Cheers,

Brendan

Posted: Fri Jun 15, 2007 7:49 am
by mathematician
Brendan wrote:Hi,
mathematician wrote:Why take a couple of dozen lines to do what you can do in four or five?
Because if you use your own code you don't have to worry about whether or not this BIOS function is supported by the computer.

You also don't end up with 6 descriptors when 2 is (typically) enough, and don't need to be worried about how the BIOS returns to your code (if CS needs to use a 16-bit default operand size to make sure the BIOS's IRET works, if CS base needs to be the same as it was in real mode, and whether or not the IDT must have descriptors preconfigured or if the BIOS returns with interrupts disabled).
This function has been a standard part of the BIOS for as long as I have been programming PCs, and that is quite a few years now. You have as many entries in the GDT as you want to put in it. If you read the documentation you will discover that the cs base does need to be the same as it was in real mode, which is hardly surprising given that execution is going to resume with the very next instruction after the int.

Posted: Fri Jun 15, 2007 9:06 am
by earlz
That'd be very useful for making a bootsector..especially if your not good at optimizing for space..

Re: bios switch to pmode

Posted: Sat Jun 16, 2007 4:57 am
by inflater
kubeos wrote:I was going through a list of int 15h services and noticed that function 89h allows you to switch to pmode. This sure seems like an easier way to do it as it also allows you to setup the irq's during the call as well. Of course you still need a GDT before making the call.

Is this something that is supported by most bios's or only a specific type.

[EDIT] And has anyone ever used this? Just curious.
Hi,
well, I think that this function was for simpler way for going into protected mode. In AThelp, this function is not recommended (I do not know why), but it remaps the PIC and enables A20 so I think it is a space-preserving way to enter pmode.

I am just wondering if this function wasn't rarely used in 80286's where you could not enable pmode with CR0. (Through MSW)

inflater