386 Protected Mode ed

Register ed

EFLAGS
0   1   carry flag
1   1   1
2   1   parity flag
3   1   0
4   1   auxiliary carry flag
5   1   0
6   1   zero flag
7   1   sign flag
8   1   trap flag
9   1   interrupt enable
10  1   direction flag
11  1   overflow
12  2   I/O privilege level
14  1   nested task flag
15  1   0
16  1   resume flag
17  1   virtual 8086 mode

CR0
0   1   PE: protection enabled
1   1   MP: math present
2   1   EM: math emulation
3   1   TS: task switched
4   1   ET: extension type (80287/80387)
31  1   PG: paging

Speicher-Verwaltung ed

Segment Descriptors ed

0   2   limit 0..15
2   2   base 0..15
4   1   base 16..23
5   1   5   type
        2   dpl (privilege)
        1   present
6   1   4   limit 16..19
        1   unused
        1   0
        1   X
        1   granularity: 0 => limit in bytes, 1 => limit in 4k
7   1   base 24..31

type (data seg):
    accessed
    writable
    expand-down
    0
    1
type (executable seg):
    accessed
    readable
    conforming (privileges...)
    0
    1

GDT/LDT (global/local descriptor table) jeweils bis zu 8192 Einträge. Ein Selector in den cs,ss etc. Registern (16bit):

0   2  requestor's privilege level
2   1   table indicator (0=GDT, 1=LDT)
3   13  index

Paging ed

Linear address (32 bit):

0   12  offset
12  10  page
22  10  directory

Page Table Entry (32 bit):

0   1   present
1   1   writable
2   1   user/supervisor
3   2   00
5   1   accessed?
6   1   dirty
7   2   00
9   ?   unused
12  20  address 12..31

2 Ebenen aus page tables (directory, page)

call ed

Call-Gate:

0   2   offset 0..15
2   2   selector
4   1   5   dword count (copy from stack)
        3   000
5   1   5   type 00110
        2   dpl (privilege)
        1   present
6   2   offset 16..31

Start ed

PE=1 in CR0 und dann einen jmp