inter80386

20

o

 

 

MAX LIMIT

 

 

FIXED AT 64K IN

 

REAL MODE

 

 

1

SELECTED

 

64K

SEGMENT

 

L - _ --- 1 - - - - ~J_----+_--'-j~

SEGMENT BASE

231630-54

Figure 3-1. Real Address Mode Addressing

purpose of Real Mode is to set up the processor for Protected Mode Operation.

The LOCK prefix on the 80386, even in Real Mode, is more restrictive than on the 80286. This is due to the addition of paging on the 80386 in Protected Mode and Virtual 8086 Mode. Paging makes it im- possible to guarantee that repeated string instruc- tions can be LOCKed. The 80386 can'trequire that all pages holding the string be physically present in memory. Hence, a Page Fault (exception 14) might have to be taken during the repeated string instruc- tion. Therefore the LOCK prefix can'tbe supported during repeated string instructions.

These are the only instruction forms where the LOCK prefix is legal on the 80386:

Opcode

Operands

(Dest, Source)

 

BIT Test and

Mem, Reg/immed

SET/RESET/COMPLEMENT

XCHG

Reg, Mem

XCHG

Mem, Reg

ADD, OR, ADC, SBB,

Mem, Reg/immed

AND, SUB, XOR

 

NOT, NEG, INC, DEC

Mem

An exception 6 will be generated if a LOCK prefix is placed before any instruction form or opcode not listed above. The LOCK prefix allows indivisible read/modify/write operations on memory operands using the instructions above. For example, even the "ADD Reg/immed, Mem" is not LOCKable, because the Mem operand is not the destination (and there- fore no memory read/modify/operation is being per- formed).

Since, on the 80386, repeated string instructions are not LOCKable, it is not possible to LOCK the bus for a long period of time. Therefore, the LOCK prefix is not IOPL-sensitive on the 80386. The LOCK prefix can be used at any privilege level, but only on the instruction forms listed above.

3.2 MEMORY ADDRESSING

In Real Mode the maximum memory size is limited to

1megabyte. Thus, only address lines A2-A19, BEO-BE are active. (Exception, the high address lines A20-A31 are high during CS-relative memory cycles until an intersegment jump or call is executed (see section 2.10)).

Since paging is not allowed in Real Mode the linear addresses are the same as physical addresses. Physical addresses are formed in Real Mode by adding the contents of the appropriate segment reg- ister which is shifted left by four bits to an effective address. This addition results in a physical address from OOOOOOOOH to 0010FFEFH. This is compatible with 80286 Real Mode. Since segment registers are shifted left by 4 bits this implies that Real Mode seg- ments always start on 16 byte boundaries.

All segments in Real Mode are exactly 64K bytes long, and may be read, written, or executed. The 80386 will generate an exception 13 if a data oper- and or instruction fetch occurs past the end of a segment. (i.e. if an operand has an offset greater the FFFFH, example a word with a low byte at FFFFH and the high byte at OOOOH)

Segments may be overlapped in Real Mode. Thus, if a particular segment does not use all 64K bytes an- other segment can be overlayed on top of the un- used portion of the previous segment. This allows the programmer to minimize the amount of physical memory needed for a program.

32

Page 93
Image 93
Intel 80386 manual Memory Addressing, Set/Reset/Complement, Xchg, Add, Or, Adc, Sbb, And, Sub, Xor Not, Neg, Inc, Dec