[comp.misc] LoadAll?

4rst@unmvax.cs.unm.edu (Forrest Black) (12/28/89)

Hello!  I'm looking for information on the undocumented 80[2,3]86 LOADALL
instruction.  I think maybe the information I'm looking for passed by on
the net a while back, but that must have been before I started reading news.
I have had a hard time getting any concrete information on this matter, so
it's time to turn to all you netlanders for help!  Here's what I do know:

  o   The instruction is encoded (0fh 05h) on 286, and (0fh 07h) on 386.
  o   The instruction is supposed to load some or all of the machine state
      from a table in low memory (0080h:0000h).
  -   I have verified the above.  I put a tell-tale pattern at 80:0, and some
      of the registers had pieces of the pattern in them when I managed to
      regain control (I put a handler on the illegal instruction trap).
  o   The instruction is reportedly a diagnostic tool reserved by Intel, but
      some software houses have used it in applications (rumor).

What I would like to know:

  ?   The format of this table in low memory.
  ?   Whether a complementary instruction STOREALL exists.
  ?   The real purpose behind this bizarre instruction.

If anybody out there can help me, it would be greatly appreciated!
Thanks in advance.  Please e-mail:

4rst@doc.cs.unm.edu     or   ...{ucbvax,gatech,rice}!unmvax!4rst

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Hello, 4rst!  Welcome to Asidonhopo's Panamanian Party Shoppe!         %
%                                                                ------- %
% ----------   #########################    4rst@doc.cs.unm.edu  |!]%/%| %
% |.{......|   #                       #     aka Forrest Black   |)!=??| %
% |........+####  I speak for myself   ##     ...unmvax!4rst     |.@..1| %
% |........|      and my little dogg  ####                       ----@-- %
% --+-------      Toto only.  We are   # ############################d   %
%   ############  guests of the Wiz.  ## #       +       + +      #      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ts@cup.portal.com (Tim W Smith) (12/30/89)

One good(?) use for LoadAll is to allow real mode access to memory
above 1 meg on a 286 in real mode.  This works because the 286, even
in real mode, uses the base registers associated with DS and ES.
These are normally zero in real mode, and there is no normal way to
change them ( in protected mode, they are updated whenever DS or
ES are changed ).

This comes in real handy for 286 boot code that wants to load a
protected mode operating system, such as Unix, that might not fit
into the first meg, when the boot code must run in real mode because
it wants to use ROM BIOS code that would freak out if the 286
were in protected mode.


On the 386, this is not a problem, since you can simply switch
between real and protected mode in the boot code.

						Tim Smith

mmm@cup.portal.com (Mark Robert Thorson) (01/01/90)

What Tim implied, but didn't say explicitly, was that switching to protected
mode on a 286 is a one-way trapdoor.  Can't get back to real-address mode.
This is why MS-DOS on the 286 must run in real mode (8086 compatibility mode)
because it needs to run 8086/8 binaries.

On the 386, this isn't a problem, because you can switch back to real-mode
after loading the "invisible" part of the segment registers.  This lets you
set up addressing beyond the first 1 Mbytes of address space.

aland@infmx.UUCP (Dr. Scump) (01/08/90)

In article <25528@cup.portal.com> mmm@cup.portal.com (Mark Robert Thorson) writes:
>What Tim implied, but didn't say explicitly, was that switching to protected
>mode on a 286 is a one-way trapdoor.  Can't get back to real-address mode.
>This is why MS-DOS on the 286 must run in real mode (8086 compatibility mode)
>because it needs to run 8086/8 binaries.

You *can* switch back to real mode on the 286 -- it's possible, though
not trivial.  The basic strategy is to save off the registers, etc.
and then trigger a reset of the '286 via the keyboard controller (which
makes the 286 start up in real mode).  Then, restore the registers,
etc. and away you go!  (over-simplified, but this is the gist of it).
PS/2s have some other method of resetting the 8086 to real mode, but
I'm not sure how it is done.

This is how protected-mode DOS extenders work, e.g. DOS/16M (which
is used in Informix's DOS products and in Lotus 1-2-3 Release 3.0).

As you indicated, the 386 has instructions to switch between each of
the four(?) modes: real, protected (286), native, and virtual 8086.

--
  Alan S. Denney  @  Informix Software, Inc.    "We're homeward bound
       {pyramid|uunet}!infmx!aland               ('tis a damn fine sound!)
 --------------------------------------------    with a good ship, taut & free
  Disclaimer:  These opinions are mine alone.    We don't give a damn, 
  If I am caught or killed, the secretary        when we drink our rum
  will disavow any knowledge of my actions.      with the girls of old Maui."