Segmentation: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
No edit summary
m adding links
Line 19: Line 19:
*CS = Code Segment
*CS = Code Segment
*DS = Data Segment
*DS = Data Segment
*SS = Stack Segment
*SS = [[Stack]] Segment
*ES = Extra Segment
*ES = Extra Segment
*FS/GS = General Purpose Segments
*FS/GS = General Purpose Segments
Line 45: Line 45:
Here the new value for CS is encoded in the jump instruction. Eg JMP 0x10:0x100 says to load CS with segment 0x10 and IP with 0x100. CS:IP is the logical address of the instruction to be executed.
Here the new value for CS is encoded in the jump instruction. Eg JMP 0x10:0x100 says to load CS with segment 0x10 and IP with 0x100. CS:IP is the logical address of the instruction to be executed.
====Far Call====
====Far Call====
This is exactly the same as a far jump, but the current values of CS/IP are pushed onto the stack before executing at the new position.
This is exactly the same as a far jump, but the current values of CS/IP are pushed onto the [[stack]] before executing at the new position.
====INT====
====INT====
The processor reads the new value of CS/IP from the Interrupt Vector Table and then executes what is effectively a far call after pushing EFLAGS onto the stack.
The processor reads the new value of CS/IP from the Interrupt Vector Table and then executes what is effectively a far call after pushing EFLAGS onto the [[stack]].
====Far Return====
====Far Return====
Here the processor pops the return segment/offset from the stack into CS/IP and switches execution to that address.
Here the processor pops the return segment/offset from the [[stack]] into CS/IP and switches execution to that address.
====IRET====
====IRET====
This is exactly the same as a far return apart from the processor popping EFLAGS off the stack in addition to CS/IP.
This is exactly the same as a far return apart from the processor popping EFLAGS off the [[stack]] in addition to CS/IP.


Apart from these cases no instruction alters the value of CS.
Apart from these cases no instruction alters the value of CS.