3-683
INSTRUCTION SET REFERENCE
SYSENTER—Fast Transition to System Call Entry Point
(Continued)
Operation
SYSENTER
IF CR0.PE == 0 THEN #GP(0)
IF SYSENTER_CS_MSR == 0 THEN #GP(0)
EFLAGS.VM := 0
// Prevent VM86 mode
EFLAGS.IF := 0
// Mask interrupts
CS.SEL := SYSENTER_CS_MSR
// Operating system provides CS
// Set rest of CS to a fixed value
CS.SEL.CPL := 0
// CPL = 0
CS.SEL.BASE := 0
// Flat segment
CS.SEL.LIMIT := 0xFFFF
// 4G limit
CS.SEL.G := 1
// 4 KB granularity
CS.SEL.S := 1
CS.SEL.TYPE_xCRA := 1011
// Execute + Read, Accessed
CS.SEL.D := 1
// 32 bit code
CS.SEL.DPL := 0
CS.SEL.RPL := 0
CS.SEL.P := 1
SS.SEL := CS.SEL+8
// Set rest of SS to a fixed value
SS.SEL.BASE := 0
// Flat segment
SS.SEL.LIMIT := 0xFFFF
// 4G limit
SS.SEL.G := 1
// 4 KB granularity
SS.SEL.S := 1
SS.SEL.TYPE_xCRA := 0011
// Read/Write, Accessed
SS.SEL.D := 1
// 32 bit stack
SS.SEL.DPL := 0
SS.SEL.RPL := 0
SS.SEL.P := 1
ESP := SYSENTER_ESP_MSR
EIP := SYSENTER_EIP_MSR