up:
Chapter 13 -- Executing 80286 Protected-Mode Code
prev: 13.2 Two ways to Execute 80286 Tasks
next: Chapter 14 -- 80386 Real-Address Mode
13.3 Differences From 80286
The few differences that do exist primarily affect operating system code.
13.3.1 Wraparound of 80286 24-Bit Physical Address Space
With the 80286, any base and offset combination that addresses beyond 16M
bytes wraps around to the first megabyte of the 80286 address space. With
the 80386, since it has a greater physical address space, any such address
falls into the 17th megabyte. In the unlikely event that any software
depends on this anomaly, the same effect can be simulated on the 80386 by
using paging to map the first 64K bytes of the 17th megabyte of logical
addresses to physical addresses in the first megabyte.
13.3.2 Reserved Word of Descriptor
Because the 80386 uses the contents of the reserved word (last word) of
every descriptor, 80286 programs that place values in this word may not
execute correctly on the 80386.
13.3.3 New Descriptor Type Codes
Operating-system code that manages space in descriptor tables often uses an
invalid value in the access-rights field of descriptor-table entries to
identify unused entries. Access rights values of 80H and 00H remain invalid
for both the 80286 and 80386. Other values that were invalid on for the
80286 may be valid for the 80386 because of the additional descriptor types
defined by the 80386.
13.3.4 Restricted Semantics of LOCK
The 80286 processor implements the bus lock function differently than the
80386. Programs that use forms of memory locking specific to the 80286 may
not execute properly when transported to a specific application of the
80386.
The LOCK
prefix and its corresponding output signal should only be used to
prevent other bus masters from interrupting a data movement operation.
LOCK
may only be used with the following 80386 instructions when they modify
memory. An undefined-opcode exception results from using
LOCK before any
other instruction.
- Bit test and change: BTS,
BTR,
BTC.
- Exchange:
XCHG.
- One-operand arithmetic and logical:
INC,
DEC,
NOT, and
NEG.
- Two-operand arithmetic and logical:
ADD,
ADC,
SUB,
SBB,
AND,
OR,
XOR.
A locked instruction is guaranteed to lock only the area of memory defined
by the destination operand, but may lock a larger memory area. For example,
typical 8086 and 80286 configurations lock the entire physical memory space.
With the 80386, the defined area of memory is guaranteed to be locked
against access by a processor executing a locked instruction on exactly the
same memory area, i.e., an operand with identical starting address and
identical length.
13.3.5 Additional Exceptions
The 80386 defines new exceptions that can occur even in systems designed
for the 80286.
-
Exception #6 -- invalid opcode
-
This exception can result from improper use of the
LOCK instruction.
-
Exception #14 -- page fault
-
This exception may occur in an 80286 program if the operating system
enables paging. Paging can be used in a system with 80286 tasks as long
as all tasks use the same page directory. Because there is no place in
an 80286 TSS to store the PDBR, switching to an 80286 task does not
change the value of PDBR. Tasks ported from the 80286 should be given
80386 TSSs so they can take full advantage of paging.
up:
Chapter 13 -- Executing 80286 Protected-Mode Code
prev: 13.2 Two ways to Execute 80286 Tasks
next: Chapter 14 -- 80386 Real-Address Mode