Page 2 of 2

Re: Best design strategy for loading > 1mb

Posted: Wed Dec 31, 2008 8:17 pm
by Brendan
Hi,

OK, I did some testing...

The short summary is that out of 30 separate tests on 22 different computers, the CPU was left in unreal mode for 3 of the 10 floppy boot tests (and none of the 20 PXE/network boot tests).

The code I used for testing is:

Code: Select all

	org 0x7c00

	jmp 0:START
	align 4
START:
	xor ax,ax
	cli
	mov ds,ax
	mov es,ax
	mov ss,ax
	mov sp,START
	sti

	mov ax,0x0003
	int 0x10

	mov eax,0x1F1F1F1F
	mov edi,0x000B8000
	mov ecx,80*25/2
	cld
	a32 rep stosd

	jmp $

	times ($$-$+0x01FE) db 0x00
	dw 0xAA55
Note that this code can be booted from both PXE and floppy (the code was identical regardless of how I booted).

Some of the computers were tested by booting from the network (PXE) and booting from floppy. A lot of the computers don't have floppy drives and were tested by booting with PXE only. Two of the computers are currently unable to boot using PXE and were tested with floppy only.

Here's a complete/detailed list of test computers and results:

Code: Select all

Cyrix "Cx6x86-P150+", AMIBIOS, PXE - crashed, Floppy - crashed
Cyrix "6x86PR166+", Award BIOS v4.51PG, PXE - crashed, Floppy - crashed
Cyrix "6x86MX-PR200", Award BIOS v4.51PG, PXE - crashed

Intel 80486DX, AMIBIOS OPTI-496SLC BIOS VER 2.1, Floppy - crashed
Intel Pentium, Award BIOS v4.50PG, PXE - crashed
Intel Pentium, Phoenix BIOS Version 4.05, PXE - crashed, Floppy - worked!
Intel Pentium Pro, Phoenix ROM BIOS Plus Version 1.10 A06, PXE - crashed
Intel Pentium Pro, AMIBIOS (BIOS Release 735120996), PXE - crashed, Floppy - crashed
Dual Pentium Pro, COMPAQ System BIOS - P08 (11/08/2000), Floppy - crashed
Dual Intel Pentium III, PhoenixBIOS 4.0 Release 6, PXE - crashed, Floppy - crashed
Dual Intel Xeon (P4/Netburst), AMI BIOS (BIOS Build 0190), PXE - crashed, Floppy - crashed
Intel Celeron (P4/Netburst), Award Modular BIOS V6.00PG, PXE - crashed

AMD Am5x86-P75-S, Award BIOS v4.51G, PXE - crashed, Floppy - worked!
AMD AMD-K6-2/300, Award BIOS v4.51PG, PXE - crashed
AMD Athlon, Phoenix AwardBIOS v6.00PG, PXE - crashed
Dual AMD Opteron 265, AMIBIOS (Tyan Thunder K8S/K8S-D Pro BIOS v3.04), PXE - crashed, Floppy - worked!

VIA Eden ESP 4000, Phoenix AwardBIOS v6.00PG, PXE - crashed
VIA C3 1.0A, Phoenix AwardBIOS v6.00PG, PXE - crashed

NSC/AMD Geode GX1, Unknown BIOS, PXE - crashed
NSC/AMD Geode GX2, Unknown BIOS, PXE - crashed

Transmeta TM5800, "HP t5000 series v6.00PG", PXE - crashed

Vortex A9100, AMIBIOS 08.00.14, PXE - crashed
To be honest, I'm completely amazed that it actually did work on 3 of these computers - leaving the CPU in unreal mode is probably the most common BIOS bug I've come across.


Cheers,

Brendan

Re: Best design strategy for loading > 1mb

Posted: Thu Jan 01, 2009 5:53 am
by djmauretto
To be honest, I'm completely amazed that it actually did work on 3 of these computers - leaving the CPU in unreal mode is probably the most common BIOS bug I've come across.
3 + My 2 PC + Virtual PC 2004 + Virtual PC 2007 = 5 bios buggy and 2 emulator buggy :wink:
isn't it funny ? 8)

Re: Best design strategy for loading > 1mb

Posted: Thu Jan 01, 2009 5:58 am
by Brendan
Hi,
djmauretto wrote: 3 + My 2 PC + Virtual PC 2004 + Virtual PC 2007 = 5 bios buggy and 2 emulator buggy :wink:
isn't it funny ? 8)
It's unusual/unexpected.

The point is that all "PC compatible" computers *should* put the CPU in real mode before starting the OS, and these BIOSs *are* buggy, and a generic OS for "PC compatible" computers *can't* rely on the BIOS being buggy...


Cheers,

Brendan

Re: Best design strategy for loading > 1mb

Posted: Thu Jan 01, 2009 7:10 am
by djmauretto
Intel Celeron (P4/Netburst), Award Modular BIOS V6.00PG, PXE - crashed
Another funny stuff , i have the same bios Award Modular BIOS V6.00PG, but
it don't crash....
Now i'm doing some deeply test , I want crash my PC :lol:

Re: Best design strategy for loading > 1mb

Posted: Thu Jan 01, 2009 1:34 pm
by djmauretto
I get Segment Overrun Exception
Thanks God :D

Re: Best design strategy for loading > 1mb

Posted: Fri Jan 02, 2009 8:56 am
by djmauretto
Test on my sister and my brother Pc,both with AMI bios,
seems that AMI bios let you with Unreal mode set and with all data segment descriptor
DS,ES,FS,GS,( i don't tryed SS ) WITH 4GB limit and of course with A20 already enabled,in special way latest AMI bios ( from 2003 ?) is maybe a new compatible standard ?
Note that also MS Virtual PC use virtual AMI BIos (2003) to emulate bios =D>

Re: Best design strategy for loading > 1mb

Posted: Fri Jan 02, 2009 9:43 am
by Brendan
Hi,
djmauretto wrote:Test on my sister and my brother Pc,both with AMI bios,
seems that AMI bios let you with Unreal mode set and with all data segment descriptor
DS,ES,FS,GS,( i don't tryed SS ) WITH 4GB limit and of course with A20 already enabled,in special way latest AMI bios ( from 2003 ?) is maybe a new compatible standard ?
Note that also MS Virtual PC use virtual AMI BIos (2003) to emulate bios =D>
I'd assume that Award aren't aware of the bug, and would probably fix it if they knew about it. Also, AFAIK most (all?) commercial BIOSs are modular, and it might just be one buggy module in a set of modules (where any module could be replaced at any time for any reason without effecting the other modules, including the replacement of the buggy module).

There's also a lot of different PCI cards that have ROMs that are executed after the BIOS has done most of it's work, and any of these ROMs may enable protected mode and then switch back to real mode correctly, inadvertently fixing the bug (which is possibly why my machines don't exhibit this bug as frequently as yours - most of my computers have ethernet cards with boot ROMs). Finally there's also a different boot managers and MBRs around that could have been executed before your code - for example, if someone decides to use GRUB to chainload your OS, then don't be surprised if you end up with real mode even though the BIOS itself is buggy.

IMHO it only takes around 35 bytes to enable unreal mode yourself, and there's no good reason to rely on BIOS bugs to begin with. For example, for a decent/reliable OS it'd probably cost you 20 bytes to test if the BIOS is buggy or not, and then it'd still cost you another 35 bytes to enable unreal mode if you do find out the BIOS isn't buggy (the code is easier, faster and smaller if you simply assume the BIOS doesn't have the bug, even if it does).


Cheers,

Brendan

Re: Best design strategy for loading > 1mb

Posted: Fri Jan 02, 2009 10:18 am
by djmauretto
Yes I Agree with you, it's only a curiosity, i have disassembled many Option Rom
code , it usually copy data from extended memory > 1MB to Low memory < 1MB ( PXE)
or reverse but usually use BIOS function AH 87H INT 15H for that.
I had think that maybe was a new AMI Bios secret standard for new OS ( A20 + Unreal Mode) :-)

PS: AMI = American Megatrends not Award