Access to ROM BIOS routines in Protected Mode 
Author Message
 Access to ROM BIOS routines in Protected Mode

Hi y'all,
Could someone help me with the physical address locations and extents of ROM
BIOS routines and data in memory?
If theses routines were mapped onto a 16-bit, conforming, code segment at
ring0 in protected mode could they then be made available for use to common
programs via the IDT or GDT?

I'm having difficulty viewing messages posted after the 18 of February
(including my own) so it would be really helpful if replies are directed to

thanks a bunch.

PS. Alexei, none of my messages seem to get through to your addresses



Thu, 08 Aug 2002 03:00:00 GMT  
 Access to ROM BIOS routines in Protected Mode

Hello there,


Quote:
> Hi y'all,
> Could someone help me with the physical address locations and extents of
ROM
> BIOS routines and data in memory?
> If theses routines were mapped onto a 16-bit, conforming, code segment at
> ring0 in protected mode could they then be made available for use to
common
> programs via the IDT or GDT?

Short answer: No.
Long answer: This is not possible as the BIOS contains real mode code. This
code cannot be run in protected mode even if you place it in a 16bit segment
on ring0. The problem here is that the BIOS assumes it has direct access to
physical memory regions (e.g. its own data area at segment 0x40). So,
whenever the BIOS will attempt to load segment registers in its internal
code, your OS or whatever you're developing will throw an exception.

If you want to use the BIOS in protected mode, you could set up a v86 mode
task for it.

Regards,
    Thomas



Thu, 08 Aug 2002 03:00:00 GMT  
 Access to ROM BIOS routines in Protected Mode

I don't understand you. Do you want to execute BIOS services in PMode,
right?
If so, only PnP stuff is present as a PMode code as well as a Real Mode
code in the BIOS.
You can't execute video service Int 10h in PMode. You may do it either
in Real Mode or V86 mode. There is no other way.

If you have problems reaching me via e-mail,
try the followeing addresses (I check e-mail from both):



Good Luck
Alexei A. Frounze

Quote:

> Hi y'all,
> Could someone help me with the physical address locations and extents of ROM
> BIOS routines and data in memory?
> If theses routines were mapped onto a 16-bit, conforming, code segment at
> ring0 in protected mode could they then be made available for use to common
> programs via the IDT or GDT?

> I'm having difficulty viewing messages posted after the 18 of February
> (including my own) so it would be really helpful if replies are directed to

> thanks a bunch.

> PS. Alexei, none of my messages seem to get through to your addresses



Thu, 08 Aug 2002 03:00:00 GMT  
 Access to ROM BIOS routines in Protected Mode

Quote:
> Hello there,


> > Hi y'all,
> > Could someone help me with the physical address locations and extents of
> ROM
> > BIOS routines and data in memory?
> > If theses routines were mapped onto a 16-bit, conforming, code segment
at
> > ring0 in protected mode could they then be made available for use to
> common
> > programs via the IDT or GDT?

> Short answer: No.
> Long answer: This is not possible as the BIOS contains real mode code.
This
> code cannot be run in protected mode even if you place it in a 16bit
segment
> on ring0. The problem here is that the BIOS assumes it has direct access
to
> physical memory regions (e.g. its own data area at segment 0x40).

That's no problem. It's possible to define a selector 40 and map it to
linear
address 400. The same goes for A000, B000, B800, C000, C800 and F000.
The problem is it might use other unexpected segments that might give you
faults and you cannot define all possible real mode segments as selectors.

If you define 40 and all segments above A000 it might work on some
BIOSes. On second thoughts it would probably not, since there is no way to
define segment 0 as valid and with a 0 base and most BIOSes would use
segment 0 to manipulate interrupt vectors. You would need an instruction
emulator to emulate all instructions using selector 0 ;)

Quote:
> So,
> whenever the BIOS will attempt to load segment registers in its internal
> code, your OS or whatever you're developing will throw an exception.

> If you want to use the BIOS in protected mode, you could set up a v86 mode
> task for it.

I agree.

----------------------------------------------------------------------------
--------------------------
Want a fast, multi-threaded OS for your PC or embedded system?
Download RDOS at www.rdos.net!



Sat, 10 Aug 2002 03:00:00 GMT  
 Access to ROM BIOS routines in Protected Mode

Quote:
> That's no problem. It's possible to define a selector 40 and map it to
> linear
> address 400. The same goes for A000, B000, B800, C000, C800 and F000.

Yeah, I do agree, I missed that here. But another thing could cause
problems: Weird segment values like 0x17 if any BIOS should use such :-)

Quote:
> The problem is it might use other unexpected segments that might give you
> faults and you cannot define all possible real mode segments as selectors.

Yep, I included this in my thoughts.

Quote:
> If you define 40 and all segments above A000 it might work on some
> BIOSes. On second thoughts it would probably not, since there is no way to
> define segment 0 as valid and with a 0 base and most BIOSes would use
> segment 0 to manipulate interrupt vectors. You would need an instruction
> emulator to emulate all instructions using selector 0 ;)

Yikes!

Regards,
    Thomas



Sat, 10 Aug 2002 03:00:00 GMT  
 Access to ROM BIOS routines in Protected Mode


[ ... ]

Quote:
> That's no problem. It's possible to define a selector 40 and map it to
> linear
> address 400. The same goes for A000, B000, B800, C000, C800 and F000.
> The problem is it might use other unexpected segments that might give you
> faults and you cannot define all possible real mode segments as selectors.

There's another problem to keep in mind as well: the bottom two bits
of a selector encode an RPL.  Just for example, the bottom two bits
of all the selectors above are 00, meaning you can only use any of
them from ring 0 code.  If you were trying to run the BIOS in ring 3,
it would cause a major problem in a big hurry...

--
    Later,
    Jerry.

The universe is a figment of its own imagination.



Sat, 10 Aug 2002 03:00:00 GMT  
 Access to ROM BIOS routines in Protected Mode



|
|[ ... ]
|
|> That's no problem. It's possible to define a selector 40 and map it to
|> linear
|> address 400. The same goes for A000, B000, B800, C000, C800 and F000.
|> The problem is it might use other unexpected segments that might give you
|> faults and you cannot define all possible real mode segments as
selectors.
|
|There's another problem to keep in mind as well: the bottom two bits
|of a selector encode an RPL.  Just for example, the bottom two bits
|of all the selectors above are 00, meaning you can only use any of
|them from ring 0 code.  If you were trying to run the BIOS in ring 3,
|it would cause a major problem in a big hurry...

You can load ES, DS, FS, and GS with a selector with RPL=0 when in PL3
if Desc.DPL=3. But why bother with this when there's VM?



Sun, 11 Aug 2002 03:00:00 GMT  
 Access to ROM BIOS routines in Protected Mode

Btw, Real Mode code may use segment registers just as an extra storage.
So if a BIOS has this stuff... :)
Btw, code and data segment descriptors must have different access rights
so simple copying DS to CS and vice virsa is also a problem.

I would not recommend to emulate Real Mode in PMode. Just use V86 or
keep your hands away of BIOS code.

If you want to see how V86 is setup and works, take a look at my
tutorial (V86 Monitor)
homepage: http://alexfru.chat.ru
mirror: http://members.xoom.com/alexfru

It's in "Pmode / OS dev / Docs" section.

Good Luck
Alexei A. Frounze

Quote:

> > Hello there,


> > > Hi y'all,
> > > Could someone help me with the physical address locations and extents of
> > ROM
> > > BIOS routines and data in memory?
> > > If theses routines were mapped onto a 16-bit, conforming, code segment
> at
> > > ring0 in protected mode could they then be made available for use to
> > common
> > > programs via the IDT or GDT?

> > Short answer: No.
> > Long answer: This is not possible as the BIOS contains real mode code.
> This
> > code cannot be run in protected mode even if you place it in a 16bit
> segment
> > on ring0. The problem here is that the BIOS assumes it has direct access
> to
> > physical memory regions (e.g. its own data area at segment 0x40).

> That's no problem. It's possible to define a selector 40 and map it to
> linear
> address 400. The same goes for A000, B000, B800, C000, C800 and F000.
> The problem is it might use other unexpected segments that might give you
> faults and you cannot define all possible real mode segments as selectors.

> If you define 40 and all segments above A000 it might work on some
> BIOSes. On second thoughts it would probably not, since there is no way to
> define segment 0 as valid and with a 0 base and most BIOSes would use
> segment 0 to manipulate interrupt vectors. You would need an instruction
> emulator to emulate all instructions using selector 0 ;)

> > So,
> > whenever the BIOS will attempt to load segment registers in its internal
> > code, your OS or whatever you're developing will throw an exception.

> > If you want to use the BIOS in protected mode, you could set up a v86 mode
> > task for it.

> I agree.

> ----------------------------------------------------------------------------
> --------------------------
> Want a fast, multi-threaded OS for your PC or embedded system?
> Download RDOS at www.rdos.net!



Sun, 11 Aug 2002 03:00:00 GMT  
 Access to ROM BIOS routines in Protected Mode

Sorry, but how all the DPMI programs work ?
Is DPMI runs only on 386 and uses v86 for DOS/BIOS ?

-------
http://sandman4.cjb.net
CC's greatly appreciated (poor news server).



etc...



Wed, 21 Aug 2002 03:00:00 GMT  
 Access to ROM BIOS routines in Protected Mode

Yes, every standard DPMI host (DOS extender) pass IRQs to real-mode
ISRs. But before that it switches to a V86 mode. The same with calling
BIOS Video services. It simply switches to V86 and then do all the job.
DPMI could be done on 286 too, but there is no V86 mode in 286. So each
Int/IRQ should be done with PMode->RMode->PMode switching.

Good Luck
Alexei A. Frounze

Quote:

> Sorry, but how all the DPMI programs work ?
> Is DPMI runs only on 386 and uses v86 for DOS/BIOS ?



Thu, 22 Aug 2002 03:00:00 GMT  
 Access to ROM BIOS routines in Protected Mode

Note that the 286 provides no

        Pmode->RMode

switch. This requires a *reset*.



)
)Yes, every standard DPMI host (DOS extender) pass IRQs to real-mode
)ISRs. But before that it switches to a V86 mode. The same with calling
)BIOS Video services. It simply switches to V86 and then do all the job.
)DPMI could be done on 286 too, but there is no V86 mode in 286. So each
)Int/IRQ should be done with PMode->RMode->PMode switching.
)
)Good Luck
)Alexei A. Frounze
)
)>
)> Sorry, but how all the DPMI programs work ?
)> Is DPMI runs only on 386 and uses v86 for DOS/BIOS ?
)
)
)

--
----
char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
I don't speak for Alcatel      <- They make me say that.



Sat, 24 Aug 2002 03:00:00 GMT  
 Access to ROM BIOS routines in Protected Mode

Quote:

> Note that the 286 provides no

>         Pmode->RMode

> switch. This requires a *reset*.

But it's not a reset by pressing the reset key. :))
Program may control this CPU reset, since it may put reset code to CMOS
and then continue in the Real Mode.

Good Luck
Alexei A. Frounze



Sat, 24 Aug 2002 03:00:00 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. ROM-BIOS Checksum routine

2. Protected mode memory access in real mode problem?

3. IDE CD-ROM Access Through BIOS???

4. Useing Bios in protected-Mode

5. Protected mode and BIOS

6. Calling BIOS in Protected mode

7. BIOS in protected mode theories

8. BIOS calls and protected mode

9. Making BIOS calls from protected mode

10. Protected mode BIOS?

11. Protected Mode BIOS Interrupts

12. how BIOS routines used in protection mode??

 

 
Powered by phpBB® Forum Software