NumApsExecutingLocation equ LockLocation + 24h\r
CodeSegmentLocation equ LockLocation + 28h\r
DataSegmentLocation equ LockLocation + 2Ch\r
+EnableExecuteDisableLocation equ LockLocation + 30h\r
+Cr3Location equ LockLocation + 3Ch\r
\r
mov ss, dx\r
\r
mov esi, ebx\r
+\r
+ mov edi, esi\r
+ add edi, EnableExecuteDisableLocation\r
+ cmp byte [edi], 0\r
+ jz SkipEnableExecuteDisable\r
+\r
+ ;\r
+ ; Enable IA32 PAE execute disable\r
+ ;\r
+\r
+ mov ecx, 0xc0000080\r
+ rdmsr\r
+ bts eax, 11\r
+ wrmsr\r
+\r
+ mov edi, esi\r
+ add edi, Cr3Location\r
+ mov eax, dword [edi]\r
+ mov cr3, eax\r
+\r
+ mov eax, cr4\r
+ bts eax, 5\r
+ mov cr4, eax\r
+\r
+ mov eax, cr0\r
+ bts eax, 31\r
+ mov cr0, eax\r
+\r
+SkipEnableExecuteDisable:\r
+\r
mov edi, esi\r
add edi, LockLocation\r
mov eax, NotVacantFlag\r
UINTN NumApsExecuting;\r
UINTN CodeSegment;\r
UINTN DataSegment;\r
+ UINTN EnableExecuteDisable;\r
UINTN Cr3;\r
} MP_CPU_EXCHANGE_INFO;\r
\r
NumApsExecutingLocation equ LockLocation + 44h\r
CodeSegmentLocation equ LockLocation + 4Ch\r
DataSegmentLocation equ LockLocation + 54h\r
-Cr3Location equ LockLocation + 5Ch\r
+EnableExecuteDisableLocation equ LockLocation + 5Ch\r
+Cr3Location equ LockLocation + 64h\r
+\r
\r
;-------------------------------------------------------------------------------\r
mov si, IdtrLocation\r
o32 lidt [cs:si]\r
\r
+ mov si, EnableExecuteDisableLocation\r
+ cmp byte [si], 0\r
+ jz SkipEnableExecuteDisableBit\r
+\r
+ ;\r
+ ; Enable execute disable bit\r
+ ;\r
+ mov ecx, 0c0000080h ; EFER MSR number\r
+ rdmsr ; Read EFER\r
+ bts eax, 11 ; Enable Execute Disable Bit\r
+ wrmsr ; Write EFER\r
+\r
+SkipEnableExecuteDisableBit:\r
\r
mov di, DataSegmentLocation\r
mov edi, [di] ; Save long mode DS in edi\r