//\r
SetupCpuExceptionHandlers ();\r
\r
- //\r
- // Update IDT entry INT3\r
- //\r
- IdtEntry = (INTERRUPT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (INTERRUPT_GATE_DESCRIPTOR)));\r
- S3DebugBuffer = (UINTN) (AcpiS3Context->S3DebugBufferAddress);\r
-\r
- IdtEntry->Offset15To0 = (UINT16)S3DebugBuffer;\r
- IdtEntry->SegmentSelector = (UINT16)AsmReadCs ();\r
- IdtEntry->Attributes = (UINT16)INTERRUPT_GATE_ATTRIBUTE;\r
- IdtEntry->Offset31To16 = (UINT16)(S3DebugBuffer >> 16);\r
- IdtEntry->Offset63To32 = (UINT32)(S3DebugBuffer >> 32);\r
- IdtEntry->Reserved = 0;\r
+ DEBUG_CODE (\r
+ //\r
+ // Update IDT entry INT3 if the instruction is valid in it\r
+ //\r
+ S3DebugBuffer = (UINTN) (AcpiS3Context->S3DebugBufferAddress);\r
+ if (*(UINTN *)S3DebugBuffer != (UINTN) -1) {\r
+ IdtEntry = (INTERRUPT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (INTERRUPT_GATE_DESCRIPTOR)));\r
+ IdtEntry->Offset15To0 = (UINT16)S3DebugBuffer;\r
+ IdtEntry->SegmentSelector = (UINT16)AsmReadCs ();\r
+ IdtEntry->Attributes = (UINT16)INTERRUPT_GATE_ATTRIBUTE;\r
+ IdtEntry->Offset31To16 = (UINT16)(S3DebugBuffer >> 16);\r
+ IdtEntry->Offset63To32 = (UINT32)(S3DebugBuffer >> 32);\r
+ IdtEntry->Reserved = 0;\r
+ }\r
+ );\r
\r
IdtEntry = (INTERRUPT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (14 * sizeof (INTERRUPT_GATE_DESCRIPTOR)));\r
HookPageFaultHandler (IdtEntry);\r
-\r
- AsmWriteIdtr (IdtDescriptor);\r
}\r
\r
/**\r