bios switch to pmode

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
kubeos
Member
Member
Posts: 138
Joined: Tue Jan 30, 2007 2:31 pm
Location: Kamloops BC, CANADA
Contact:

bios switch to pmode

Post 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.
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Post by neon »

I never knew there was an int for it... so, no, I never used it :)
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

Post by os64dev »

best to do it yourself, who know what the bios does. it problably is a bios specific function and not generally used.
Author of COBOS
User avatar
mathematician
Member
Member
Posts: 437
Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk

Post 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.
Aali
Member
Member
Posts: 58
Joined: Sat Apr 14, 2007 12:13 pm

Post by Aali »

well, why rely on the BIOS for one of the things we actually do know how to do properly ourselves?
User avatar
mathematician
Member
Member
Posts: 437
Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk

Post by mathematician »

Why take a couple of dozen lines to do what you can do in four or five?
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
mathematician
Member
Member
Posts: 437
Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk

Post 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.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post by earlz »

That'd be very useful for making a bootsector..especially if your not good at optimizing for space..
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Re: bios switch to pmode

Post 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
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
Post Reply