Re: ESP corruption bug - what CPUs are affected?

From: Richard B. Johnson
Date: Wed Sep 22 2004 - 15:29:50 EST


On Thu, 23 Sep 2004, Stas Sergeev wrote:

> Hi,
>
> Richard B. Johnson wrote:
> > What problem is this supposed to fix?
> Richard, it will really help if you read the
> whole thread. I was answering this to Denis
> Vlasenko already - he agreed. Do I have to
> repeat the explanations?
>
> > ESP is __not__ corrupted
> Right, but is not properly restored either,
> while it have to be.
>
> > when returning to protected-mode or a different privilege level.
> It gets "corrupted" (not properly restored)
> exactly when returning to *protected mode*
> from another priv level. Please refer to the
> Intel docs I pointed to in that thread earlier.
>
> > You don't 'return' to protected mode from a virtual-8086 mode,
> Noone was speaking about v86. I don't see why
> you pick that up.
>
> > The so-called bug is that when in real mode or in virtual-8086
> > mode, the high word of ESP is not changed.
> In short: Wrong.
> The complete explanations are easily locateable
> in that thread. And it have nothing to do with
> the real mode either.
>
> > It is not a bug
> > because the high word doesn't even exist when in VM-86 mode!!
> Noone was speaking about v86, sorry. I am bypassing
> that part.
>
> > It is possible to use the 32-bit prefix, when in 16-bit mode,
> That's not about the prefixes either, sorry.
> We were talking about the 32bit PM code.
>
> > Please, somebody from Intel tell these guys to leave the thing
> > alone.
> Thanks many, they already left that alone once:)
> Maybe enough of leaving the bugs alone?
> I have lots of the DOS progs here that do not
> work under dosemu without that patch, and work
> perfectly with it. It should be enough. If
> you need an examples - well, OpenCubicPlayer
> for one. It will start, but crash as soon as
> the music is attempted to play. The patch fixes
> it. Other progs you'll have problems downloading
> anyway, but let me know if you need these.
>
> > I, for one, don't want a bunch of "fixes" that do nothing
> > except consume valuable RAM, making it near impossible to
> > use later versions of Linux in embedded systems.
> Well, my patch is purely in asm. How many
> valueable bytes does it take from you?
> As for performance - 8 asm insns on a generic
> path. Not too much either, as for me.
>

Well DOSEMU uses VM-86 mode. That's how it works. It
creates a virtual 8086 machine, complete with the
required "DOS compatible" virtual BIOS environment.

I use it all the time because I write, amongst other things,
the complete BIOS and startup code for many Intel based
machines.

I run compilers, assemblers, linkers, and editors in that
environment and it works.

Sombody mentions a completely unrelated so-called Intel
bug and next thing you know, there are patches to work-
around the bug???

The bug doesn't exist period. Here is a session in
VM-86 mode., using DOSEMU. It does one hell of a lot
more work than your games.



Script started on Wed Sep 22 16:00:02 2004
# godos
CPU speed set to 2793/1 MHz
Running on CPU=586, FPU=1, rdtsc=1
Linux DOS emulator 0.98.5.0 $Date: 99/01/15 $
Last configured at Wed Mar 24 12:44:16 EST 1999 on linux
This is work in progress.
Please test against a recent version before reporting bugs and problems.
Bugs, Patches & New Code to linux-msdos@xxxxxxxxxxxxxxxx

Starting MS-DOS...





 1. Start the TCP/IP Network (NE* B
radley's code)  2. Start the TCP/IP Network (3COM Board PCTCP)  3. Start the TCP/IP Network (3COM Board ANALOGIC)  4. Load NDIS driver only (3COM Board)  5. Do not load any network  6. Do not execute any AUTOEXEC.BAT commands  7. Start RCCS Host Software  MS-DOS 6.22 Startup Menu  Enter a choice: 5ออออออ            F5=Bypass startup files F8=Confirm each line of CONFIG.SYS and AUTOEXEC.BAT [N]Time remaining: 04  
MS-DOS Version 6.22

C:\>cd pbios

C:\PBIOS>make clean

Microsoft (R) Program Maintenance Utility Version 4.07
Copyright (C) Microsoft Corp 1984-1988. All rights reserved.



  if exist *.obj del *.obj 


 if exist *.bin del *.bin  if exist *.rom del *.rom  if exist *.hex del *.hex 






 if exist *.lis del *.lis  if exist *.com del *.com  if exist *.exe del *.exe  if exist *.oe0 del *.oe0  if exist *.oe1 del *.oe1  cd tools  if exist *.obj del *.obj 






C:\PBIOS> make clean if exist *.bin del *.bin  if exist *.rom del *.rom  if exist *.hex del *.hex  if exist *.com del *.com  if exist *.exe del *.exe  cd ..  C:\PBIOS>makepbiosMMMMMMMMMMMMMMMM if exist *.obj del *.obj
if exist *.bin del *.bin  if exist *.rom del *.rom  if exist *.hex del *.hex  if exist *.com del *.com  if exist *.exe del *.exe  cd ..  C:\PBIOS> make pbios  Microsoft (R) Program Maintenance Utility Version 4.07 Copyright (C) Microsoft Corp 1984-1988. All rights reserved.   MAKE : warning U4000: 'TOOLS\IHEX.EXE' : target does not exist  CD TOOLS  MAKE TOOLS  
MAKE : warning U4000: 'odeven.exe' : target does not existcl -W3 odeven.c

MMMMcomcomexeexecd .. 
C:\PBIOS> make pbios 
Microsoft (R) Program Maintenance Utility Version 4.07
Copyright (C) Microsoft Corp 1984-1988. All rights reserved.

MAKE : warning U4000: 'TOOLS\IHEX.EXE' : target does not exist  CD TOOLS  MAKE TOOLS  AKE : warning U4000: 'odeven.exe' : target does not exist
cl -W3 odeven.c
Microsoft (R) C Optimizing Compiler Version 6.00A
Copyright (c) Microsoft Corp 1984-1990. All rights reserved.

odeven.c









  Microsoft (R) Segmented-Executable Linker Version 5.13 Copyright (C) Microsoft Corp 1984-1991. All rights reserved.  Object Modules [.OBJ]: odeven.obj /farcall Run File [odeven.exe]: "odeven.exe" /noi List File [NUL.MAP]: NUL Libraries [.LIB]: Definitions File [NUL.DEF]: ; 






  MAKE : warning U4000: 'fixup.exe' : target does not exist  cl -W3 fixup.c Microsoft (R) C Optimizing Compiler Version 6.00A Copyright (c) Microsoft Corp 1984-1990. All rights reserved.  fixup.c Definitions File [NUL.DEF]: ;fixup.exe' : target does not exist fixup.c



fixup.c fixup.obj /farcall fixup.exe]: "fixup.exe" /noi getall.exe' : target does not existgetall.c



getall.c
getall.exe' : target does not existgetall.c



getall.cgetall.obj /farcallgetall.exe]: "getall.exe" /noipci.obj' : target does not exist AL -c -W3 -o pci.obj pci.c



pci.c






  pci.c  MAKE : warning U4000: 'pcireg.obj' : target does not exist  tasm pcireg; Turbo Assembler Version 2.0 Copyright (c) 1988, 1990 Borland International Assembling file: pcireg.ASM
MMMMMMMMMMMMMMMMMMMAKE : warning U4000: 'pci.obj' : target does not exist
cl -AL -c -W3 -o pci.obj pci.c
Microsoft (R) C Optimizing Compiler Version 6.00A Copyright (c) Microsoft Corp 1984-1990. All rights reserved.  pci.c  MAKE : warning U4000: 'pcireg.obj' : target does not exist  tasm pcireg; Turbo Assembler Version 2.0 Copyright (c) 1988, 1990 Borland International  Assembling file: pcireg.ASM Error messages: None Warning messages: None Passes: 1 Remaining memory: 324k   MAKE : warning U4000: 'pci.exe' : target does not exist  link pci pcireg; 







 MAKE : warning U4000: 'ihex.exe' : target does not exist  cl -W3 ihex.c Microsoft (R) C Optimizing Compiler Version 6.00A Copyright (c) Microsoft Corp 1984-1990. All rights reserved.  ihex.c MM 
MAKE : warning U4000: 'pci.exe' : target does not exist link pci pcireg;

Microsoft (R) Segmented-Executable Linker Version 5.13
Copyright (C) Microsoft Corp 1984-1991. All rights reserved.


MAKE : warning U4000: 'ihex.exe' : target does not existcl -W3 ihex.cicrosoft (R) C Optimizing Compiler Version 6.00A
Copyright (c) Microsoft Corp 1984-1990. All rights reserved.
ihex.c 
Object Modules [.OBJ]: ihex.obj /farcall
Run File [ihex.exe]: "ihex.exe" /noi
List File [NUL.MAP]: NUL
Libraries [.LIB]:
Definitions File [NUL.DEF]: ;
MMMMihex.exe' : target does not existcl -W3 ihex.c
Microsoft (R) C Optimizing Compiler Version 6.00A Copyright (c) Microsoft Corp 1984-1990. All rights reserved.  ihex.c 
Object Modules [.OBJ]: ihex.obj /farcall
Run File [ihex.exe]: "ihex.exe" /noi
List File [NUL.MAP]: NUL
Libraries [.LIB]:
Definitions File [NUL.DEF]: ;
CD ..

MAKE : warning U4000: 'ABIOS.OBJ' : target does not exist
TASM /ml /p /w2 /m2 PBIOS, ABIOS.OBJ, PBIOS.LIS;
Turbo Assembler Version 2.0 Copyright (c) 1988, 1990 Borland International

Assembling file: PBIOS.ASM to ABIOS.OBJ




Turbo Assembler Version 2.0 Copyright (c) 1988, 1990 Borland International  Assembling file: PBIOS.ASM to ABIOS.OBJ Error messages: None Warning messages: None Passes: 2 Remaining memory: 258k   MAKE : warning U4000: 'BBIOS.OBJ' : target does not exist  TASM /ml /p /w2 /m2 /DCOM=1 PBIOS, BBIOS.OBJ; B








Error messages: None Warning messages: None Passes: 2 Remaining memory: 262k   MAKE : warning U4000: 'ABIOS.BIN' : target does not exist  LINK/T ABIOS.OBJ, ABIOS.BIN; MMMMMMMAssembling file: PBIOS.ASM to ABIOS.OBJ
Error messages: None
Warning messages: None
Passes:2
Remaining memory: 258k
 MAKE : warning U4000: 'BBIOS.OBJ' : target does not exist  TASM /ml /p /w2 /m2 /DCOM=1 PBIOS, BBIOS.OBJ; Turbo Assembler Version 2.0 Copyright (c) 1988, 1990 Borland International  Assembling file: PBIOS.ASM to BBIOS.OBJ Remaining memory: 262k


MAKE : warning U4000: 'ABIOS.BIN' : target does not exist
LINK/T ABIOS.OBJ, ABIOS.BIN;

Microsoft (R) Segmented-Executable Linker Version 5.13
Copyright (C) Microsoft Corp 1984-1991. All rights reserved.
M
Assembling file: PBIOS.ASM to BBIOS.OBJ Remaining memory: 262k


MAKE : warning U4000: 'ABIOS.BIN' : target does not exist
LINK/T ABIOS.OBJ, ABIOS.BIN;

Microsoft (R) Segmented-Executable Linker Version 5.13
Copyright (C) Microsoft Corp 1984-1991. All rights reserved.


MAKE : warning U4000: 'PBIOS.COM' : target does not existLINK/T BBIOS.OBJ, PBIOS.COM;icrosoft (R) Segmented-Executable Linker Version 5.13
Copyright (C) Microsoft Corp 1984-1991. All rights reserved.


MAKE : warning U4000: 'PBIOS.ROM' : target does not exist TOOLS\FIXUP ABIOS.BIN PBIOS.ROM







 MAKE : warning U4000: 'PBIOS.HEX' : target does not exist  TOOLS\IHEX PBIOS.ROM PBIOS.HEX 0 20 Y IHEX V2.00 Analogic Software Tools  Reading from file PBIOS.ROM, writing to file PBIOS.HEX ... Starting address (hex) 0000, block length (hex) 20 
C:\PBIOS> back


(B(B

#
#
#
#
# exit
Script done on Wed Sep 22 16:00:39 2004

Even Linux 32-bit `script` works when I am in VM-86 mode.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/