Re: Option ROM - Real Mode - PCI BAR



Hi,

On Jan 11, 6:48 am, "H. Peter Anvin" <spamt...@xxxxxxxxxx> wrote:
Or somewhat more complex, but safer, is to go into protected mode and
set up a so-called BIOS extender, a stub to intercept interrupts and
return to real mode.

I have a disk emulator called MEMDISK, which stashes the virtual disk in
high memory. As a result it has to do bounces to protected mode to
fetch the data. It doesn't use INT 15h unless it has to (i.e. it is
running in a PM already, e.g. under EMM386.) It is still quite fast,
enough that it doesn't require interrupt service during the switchover.

If you *do* take extended time for copying, you will need to service
interrupts.

The problem here is that some software may expect the BIOS and option
ROMs to contain "real mode only" code, and might use the GDT and/or
unreal mode. In this case there's no guaranteed safe way for BIOS code
or option ROM code to use protected mode or unreal mode without
trashing the caller's segments; because in some cases it's impossible
to save/restore the hidden parts of the caller's segment registers
(e.g. non-standard segment limits) - especially when the current GDTR
doesn't still point to the caller's original GDT, or when the caller's
original GDT has been modified after segments were loaded.

In addition, it's common for an OS to expect certain BIOS/device
services to be usable from virtual8086 mode - mainly disk functions
and video functions, where virtual8086 may be used by boot code
(before native device drivers are started) or after boot for fallback
code (when no suitable native device driver can be found). In this
case, if your option ROM attempts to use protected mode then the OS is
screwed, as virtual8086 only works for real mode code - as soon as
your code attempts to set the "protected mode enable" bit in CR0 it'd
trap to the OS, and unless the OS includes a full CPU emulator (which
would be extremely unlikely) there's no way for the OS to continue.

Of course none of this matters for option ROM initialization code -
it's only option ROM code that hooks BIOS services (like "Int 0x13").

On Jan 10, 5:44 am, google000 <spamt...@xxxxxxxxxx> wrote:
- Should I have the hardware guys add a I/O BAR to the device, that
the BIOS will map to a low address, and which I can access directly
with in/out instructions?

How much would an I/O BAR add to the "unit cost" of the final device?
How much would not having an I/O BAR add to the helpdesk/support costs
(customers complaining that it doesn't work in certain/rare
situations); and if the device can't work in certain/rare situations
will that harm your company's reputation and/or cause some lost sales?
I can't answer these questions...


Cheers,

Brendan

.



Relevant Pages

  • Re: maximum hard drive size in Latitude cpi
    ... >>> to bios are a well known problem ... >>in real mode (I don't know why ... ... >>how big the disk is, then carries that info over to the multitasking o/s ...
    (comp.sys.laptops)
  • Re: maximum hard drive size in Latitude cpi
    ... If you don't grok "bios is not used in disk i/o" you ... What I daresay is happening is that the win o/s starts up with the cpu ... in real mode (I don't know why ... ...
    (comp.sys.laptops)
  • Re: BIOS
    ... > I guess that coding assembly in Linux is different because ... > What is I only use the BIOS functions? ... the machine acts like "real mode" but is also in "protected mode" at ... Unfortunately, unlike the BIOS, no "standard" was ever agreed...device ...
    (alt.lang.asm)
  • Re: How to use a corrupted hard drive as an external hard drive
    ... Do I just attach it and boot the computer like normal? ... Thank you in advance for any guidance you can give me as I am technically challenged and attaching all the cables correctly is a challenge. ... should see the identity string in the BIOS screen. ... as they exist on the disk). ...
    (microsoft.public.windowsxp.hardware)
  • Re: Grub hangs - two hard drives and a CD
    ... > What you wrote is all based on a wrong assumption that grub numbers drives ... > that the BIOS will call to boot an OS. ... The Bios calls to read disk require the register DL to ...
    (comp.os.linux.setup)

Loading