- ;\r
- ; Use VMGEXIT to request termination.\r
- ; 1 - #VC was not for CPUID\r
- ;\r
- mov eax, 1\r
- jmp SevEsIdtTerminate\r
-\r
-SevEsUnexpectedRespTerminate:\r
- ;\r
- ; Use VMGEXIT to request termination.\r
- ; 2 - Unexpected Response is received\r
- ;\r
- mov eax, 2\r
-\r
-SevEsIdtTerminate:\r
- ;\r
- ; Use VMGEXIT to request termination. At this point the reason code is\r
- ; located in EAX, so shift it left 16 bits to the proper location.\r
- ;\r
- ; EAX[11:0] => 0x100 - request termination\r
- ; EAX[15:12] => 0x1 - OVMF\r
- ; EAX[23:16] => 0xXX - REASON CODE\r
- ;\r
- shl eax, 16\r
- or eax, 0x1100\r
- xor edx, edx\r
- mov ecx, SEV_GHCB_MSR\r
- wrmsr\r
- ;\r
- ; Issue VMGEXIT - NASM doesn't support the vmmcall instruction in 32-bit\r
- ; mode, so work around this by temporarily switching to 64-bit mode.\r
- ;\r
-BITS 64\r
- rep vmmcall\r
-BITS 32\r
-\r
- ;\r
- ; We shouldn't come back from the VMGEXIT, but if we do, just loop.\r
- ;\r
-SevEsIdtHlt:\r
- hlt\r
- jmp SevEsIdtHlt\r