HookAfterStubBegin:\r
db 6ah ; push\r
VectorNum:\r
- db 0 ; 0 will be fixed \r
+ db 0 ; 0 will be fixed\r
push eax\r
mov eax, HookAfterStubHeaderEnd\r
jmp eax\r
sub esp, 8\r
push 0 ; clear EXCEPTION_HANDLER_CONTEXT.OldIdtHandler\r
push 0 ; clear EXCEPTION_HANDLER_CONTEXT.ExceptionDataFlag\r
- \r
+\r
;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;\r
push eax\r
push ecx\r
\r
;; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;\r
mov eax, 1\r
- push ebx ; temporarily save value of ebx on stack \r
- cpuid ; use CPUID to determine if FXSAVE/FXRESTOR and DE \r
+ push ebx ; temporarily save value of ebx on stack\r
+ cpuid ; use CPUID to determine if FXSAVE/FXRESTOR and DE\r
; are supported\r
- pop ebx ; retore value of ebx that was overwritten by CPUID \r
+ pop ebx ; retore value of ebx that was overwritten by CPUID\r
mov eax, cr4\r
push eax ; push cr4 firstly\r
test edx, BIT24 ; Test for FXSAVE/FXRESTOR support\r
jz @F\r
or eax, BIT9 ; Set CR4.OSFXSR\r
-@@: \r
+@@:\r
test edx, BIT2 ; Test for Debugging Extensions support\r
jz @F\r
or eax, BIT3 ; Set CR4.DE\r
-@@: \r
+@@:\r
mov cr4, eax\r
mov eax, cr3\r
push eax\r
; edx still contains result from CPUID above\r
jz @F\r
db 0fh, 0aeh, 07h ;fxsave [edi]\r
-@@: \r
+@@:\r
\r
;; UEFI calling convention for IA32 requires that Direction flag in EFLAGs is clear\r
cld\r
test edx, BIT24 ; Test for FXSAVE/FXRESTOR support\r
jz @F\r
db 0fh, 0aeh, 0eh ; fxrstor [esi]\r
-@@: \r
+@@:\r
add esp, 512\r
\r
;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
sub esp, 4\r
jmp dword ptr [esp - 12]\r
\r
-DoReturn: \r
+DoReturn:\r
cmp mDoFarReturnFlag, 0 ; Check if need to do far return instead of IRET\r
jz DoIret\r
push [esp + 8] ; save EFLAGS\r
;---------------------------------------;\r
; _AsmGetTemplateAddressMap ;\r
;----------------------------------------------------------------------------;\r
-; \r
+;\r
; Protocol prototype\r
; AsmGetTemplateAddressMap (\r
; EXCEPTION_HANDLER_TEMPLATE_MAP *AddressMap\r
; );\r
-; \r
+;\r
; Routine Description:\r
-; \r
+;\r
; Return address map of interrupt handler template so that C code can generate\r
; interrupt table.\r
-; \r
+;\r
; Arguments:\r
-; \r
-; \r
-; Returns: \r
-; \r
+;\r
+;\r
+; Returns:\r
+;\r
; Nothing\r
;\r
-; \r
+;\r
; Input: [ebp][0] = Original ebp\r
; [ebp][4] = Return address\r
-; \r
+;\r
; Output: Nothing\r
-; \r
+;\r
; Destroys: Nothing\r
;-----------------------------------------------------------------------------;\r
AsmGetTemplateAddressMap proc near public\r
mov dword ptr [ebx], AsmIdtVectorBegin\r
mov dword ptr [ebx + 4h], (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32\r
mov dword ptr [ebx + 8h], HookAfterStubBegin\r
- \r
+\r
popad\r
pop ebp\r
ret\r