Ics312 x86 PDF
Ics312 x86 PDF
0101…
1111…
"
! A program constantly references all three code much)
regions
! You constantly have to make sure segment registers are set
! Therefore, the program constantly references up correctly
bytes in three different segments
! What happens if you have data/code that’s more than 64K?
" For now let’s assume that each region is fully data " You must then switch back and forth between selector values,
contained in a single segment, which is in fact
not always the case which can be really awkward
! CS: points to the beginning of the code ! Something that can cause complexity also is that two different
segment stack (selector, offset) pairs can reference the same address
" Example: (a,b) and (a-1, b+16)
! DS: points to the beginning of the data
segment ! There is an interesting on-line article on the topic:
http://world.std.com/~swmcd/steven/rants/pc.html
! SS: points to the beginning of the stack
segment
" For backward compatibility, AX, BX, CX, and DX refer to BH BL = EBX
the 16 low bits of EAX, EBX, ECX, and EDX CX
CS
DS
" AH and AL are as before ES
CH CL = ECX FS
" There is no way to access the high 16 bits of EAX DX GS
separately SS
= EDX
! Similarly, other registers are extended DH DL
16 bits
" EBX, EDX, ESI, EDI, EBP, ESP, EFLAGS SI = ESI
= EDI
DI
" For backward compatibility, the previous names are used BP = EBP