History

  • 8086 designed to mimic 8080 for porting ease
  • 8080 had 16 bits (64k) of addressing, 8 bits per address for up to 64k of memory. (You put 16 bit address out on address lines, 8 bits come back)
  • 8086 set up so that you could select a 64kB segment and work within it the same way you did with the 8080 (16 * 64 KB = 1 MB).
(in order in which they were introduced)

Real Mode Flat Model

  • 8088, 8086, 80286
  • Like a mini version of Protected Mode
  • CS, DS, SS and ES set by OS and held constant to the 64K block of RAM you live in
  • SP (stack pointer) starts pointing at 0xFFFF - stack size (at the top of RAM) and works its way up
  • ...hence, you don't have to allocate it yourself
  • WordStar and Turbo Pascal ran in this mode (64 KB for code and data!)

Real Mode Segmented Model

  • Ugly
  • Up to 1 MB (0x100000, 20 bits) accessible seen through a 16 bit window known as a paragraph controlled via 4 segment registers (CD, DS, SS, ES). 386 adds 2 more (FS, GS).
  • these processors have 16 bit registers, so 20 bit addresssing is handled with 2 registers.
  • an address can have many different representations. 0000:002D = 0001H:001D = 0002H:000D
  • A 386 can put itself in real mode (vs. protected mode) to 'become' an old processor to run old DOS code
  • a paragraph boundary is a memory address divisible by 16 and is a valid starting position for a segment. Therefore there are 64K segment addresses
  • Segments may overlap!. They are not protected. They are a horizon beyond which a certain type of memory reference cannot go.
  • Segment Registers:
    • CS = code segment. this is the segment address of the currently executing instruction. (Example: CS:IP to point to next instruction). Note, you don't change CS yourself to go to another code segment; you do a jmp, and CS gets updated for you.
    • DS = data segment. same for data/variables (Example: DS:SI)
    • SS = stack segment. same for stack data & addresses. (Example: SS:SP is where next stack op will happen)
    • ES = extra segment. a spare for specifying a memory location. (Example: ES:DI)
    • FS & GS - just 2 more ES registers.
    • They can be forced to do non-segment address stuff
  • General purpose registers
    • you can only use BP, BX, SI & DI to address a memory location (e.g. mov ax, [bx] is ok; can't do mov ax, [cx])
  • You have to allocate the stack yourself

Big Real Mode

from here

A small range of extended memory addresses can be accessed in real mode (Gate A20). 386 and higher x86 processors can be switched from protected mode to real mode without a reset, which allows them to operate in the Big Real Mode: a modified real mode in which the processor can access up to 4 GB of memory. BIOSs can put the processor in this mode during POST (Power On Self Test) to make access to extended memory easier.

Protected Mode Flat Model

  • NT/XP & Linux
  • 80386 (1986) and newer. (The 286 sort of supported it)
  • CS set by OS and held constant
  • apps simply cannot control this mode, an OS is required

-- MattWalsh - 15 Apr 2004

Topic revision: r5 - 17 Jun 2004 - MattWalsh
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback