SYSENTER: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Brendan (talk | contribs)
m SYSCALL saves "return RIP" into ECX, so caller doesn't need to do this..
Gijswl (talk | contribs)
m Improved readability of section MSRs
Line 10: Line 10:
====MSRs====
====MSRs====
'''These must be accessed through rdmsr and wrmsr'''<br/>
'''These must be accessed through rdmsr and wrmsr'''<br/>
*IA32_SYSENTER_CS (0x174)
*IA32_SYSENTER_CS (0x174) - base ring 0 code segment. Ring 0 data = CS + 8. If REX.W prefix is used with SYSEXIT, ring 3 code = CS + 32 and ring 3 data = CS + 40. Otherwise, ring 3 code = CS + 16 and ring 3 data = CS + 24.<br />
** Contains ring 0 code segment (CS).
These values cannot be changed, therefore your [[GDT]] must be structured as such.
** Ring 0 data = CS + 8.
** If REX.W prefix is used with SYSEXIT, ring 3 code = CS + 32 and ring 3 data = CS + 40.
** Otherwise, ring 3 code = CS + 16 and ring 3 data = CS + 24.
<b>These values cannot be changed, therefore your [[GDT]] must be structured as such.</b>
*IA32_SYSENTER_ESP (0x175) - The kernel's ESP for SYSENTER.
*IA32_SYSENTER_ESP (0x175) - The kernel's ESP for SYSENTER.
*IA32_SYSENTER_EIP (0x176) - The kernel's EIP for SYSENTER. This is the address of your SYSENTER entry point.
*IA32_SYSENTER_EIP (0x176) - The kernel's EIP for SYSENTER. This is the address of your SYSENTER entry point.

====CPU registers====
====CPU registers====
'''These must be set by the application, or the C library wrapper'''<br />
'''These must be set by the application, or the C library wrapper'''<br />