mirror of https://github.com/acidanthera/audk.git
SourceLevelDebugPkg: Remove X86 ASM and S files
NASM has replaced ASM and S files. 1. Remove ASM from all modules. 2. Remove S files from the drivers only. 3. https://bugzilla.tianocore.org/show_bug.cgi?id=881 After NASM is updated, S files can be removed from Library. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
parent
ccbd8d84a6
commit
ec51c05936
|
@ -1,422 +0,0 @@
|
|||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
; This program and the accompanying materials
|
||||
; are licensed and made available under the terms and conditions of the BSD License
|
||||
; which accompanies this distribution. The full text of the license may be found at
|
||||
; http://opensource.org/licenses/bsd-license.php.
|
||||
;
|
||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
;
|
||||
; Module Name:
|
||||
;
|
||||
; AsmFuncs.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; Debug interrupt handle functions.
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
#include "DebugException.h"
|
||||
|
||||
.686p
|
||||
.xmm
|
||||
.model flat,c
|
||||
|
||||
;
|
||||
; InterruptProcess()
|
||||
;
|
||||
InterruptProcess PROTO C
|
||||
|
||||
public Exception0Handle, TimerInterruptHandle, ExceptionStubHeaderSize
|
||||
|
||||
AGENT_HANDLER_SIGNATURE MACRO
|
||||
db 41h, 47h, 54h, 48h ; SIGNATURE_32('A','G','T','H')
|
||||
ENDM
|
||||
|
||||
.data
|
||||
|
||||
ExceptionStubHeaderSize DD Exception1Handle - Exception0Handle
|
||||
CommonEntryAddr DD CommonEntry
|
||||
|
||||
.code
|
||||
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception0Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 0
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception1Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 1
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception2Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 2
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception3Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 3
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception4Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 4
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception5Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 5
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception6Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 6
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception7Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 7
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception8Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 8
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception9Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 9
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception10Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 10
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception11Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 11
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception12Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 12
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception13Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 13
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception14Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 14
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception15Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 15
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception16Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 16
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception17Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 17
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception18Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 18
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception19Handle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 19
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
TimerInterruptHandle:
|
||||
cli
|
||||
push eax
|
||||
mov eax, 32
|
||||
jmp dword ptr [CommonEntryAddr]
|
||||
|
||||
CommonEntry:
|
||||
;
|
||||
; +---------------------+
|
||||
; + EFlags +
|
||||
; +---------------------+
|
||||
; + CS +
|
||||
; +---------------------+
|
||||
; + EIP +
|
||||
; +---------------------+
|
||||
; + Error Code +
|
||||
; +---------------------+
|
||||
; + EAX / Vector Number +
|
||||
; +---------------------+
|
||||
; + EBP +
|
||||
; +---------------------+ <-- EBP
|
||||
;
|
||||
cmp eax, DEBUG_EXCEPT_DOUBLE_FAULT
|
||||
je NoExtrPush
|
||||
cmp eax, DEBUG_EXCEPT_INVALID_TSS
|
||||
je NoExtrPush
|
||||
cmp eax, DEBUG_EXCEPT_SEG_NOT_PRESENT
|
||||
je NoExtrPush
|
||||
cmp eax, DEBUG_EXCEPT_STACK_FAULT
|
||||
je NoExtrPush
|
||||
cmp eax, DEBUG_EXCEPT_GP_FAULT
|
||||
je NoExtrPush
|
||||
cmp eax, DEBUG_EXCEPT_PAGE_FAULT
|
||||
je NoExtrPush
|
||||
cmp eax, DEBUG_EXCEPT_ALIGNMENT_CHECK
|
||||
je NoExtrPush
|
||||
|
||||
push [esp]
|
||||
mov dword ptr [esp + 4], 0
|
||||
|
||||
NoExtrPush:
|
||||
|
||||
push ebp
|
||||
mov ebp, esp ; save esp in ebp
|
||||
;
|
||||
; Make stack 16-byte alignment to make sure save fxrstor later
|
||||
;
|
||||
and esp, 0fffffff0h
|
||||
sub esp, 12
|
||||
|
||||
; store UINT32 Edi, Esi, Ebp, Ebx, Edx, Ecx, Eax;
|
||||
push dword ptr [ebp + 4] ; original eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
mov ebx, eax ; save vector in ebx
|
||||
mov eax, ebp
|
||||
add eax, 4 * 6
|
||||
push eax ; original ESP
|
||||
push dword ptr [ebp] ; EBP
|
||||
push esi
|
||||
push edi
|
||||
|
||||
;; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
|
||||
;; insure FXSAVE/FXRSTOR is enabled in CR4...
|
||||
;; ... while we're at it, make sure DE is also enabled...
|
||||
mov eax, 1
|
||||
push ebx ; temporarily save value of ebx on stack
|
||||
cpuid ; use CPUID to determine if FXSAVE/FXRESTOR and
|
||||
; DE are supported
|
||||
pop ebx ; retore value of ebx that was overwritten by CPUID
|
||||
mov eax, cr4
|
||||
push eax ; push cr4 firstly
|
||||
test edx, BIT24 ; Test for FXSAVE/FXRESTOR support
|
||||
jz @F
|
||||
or eax, BIT9 ; Set CR4.OSFXSR
|
||||
@@:
|
||||
test edx, BIT2 ; Test for Debugging Extensions support
|
||||
jz @F
|
||||
or eax, BIT3 ; Set CR4.DE
|
||||
@@:
|
||||
mov cr4, eax
|
||||
mov eax, cr3
|
||||
push eax
|
||||
mov eax, cr2
|
||||
push eax
|
||||
push 0 ; cr0 will not saved???
|
||||
mov eax, cr0
|
||||
push eax
|
||||
|
||||
xor ecx, ecx
|
||||
mov ecx, Ss
|
||||
push ecx
|
||||
mov ecx, Cs
|
||||
push ecx
|
||||
mov ecx, Ds
|
||||
push ecx
|
||||
mov ecx, Es
|
||||
push ecx
|
||||
mov ecx, Fs
|
||||
push ecx
|
||||
mov ecx, Gs
|
||||
push ecx
|
||||
|
||||
;; EIP
|
||||
mov ecx, [ebp + 4 * 3] ; EIP
|
||||
push ecx
|
||||
|
||||
;; UINT32 Gdtr[2], Idtr[2];
|
||||
sub esp, 8
|
||||
sidt fword ptr [esp]
|
||||
sub esp, 8
|
||||
sgdt fword ptr [esp]
|
||||
|
||||
;; UINT32 Ldtr, Tr;
|
||||
xor eax, eax
|
||||
str ax
|
||||
push eax
|
||||
sldt ax
|
||||
push eax
|
||||
|
||||
;; EFlags
|
||||
mov ecx, [ebp + 4 * 5]
|
||||
push ecx
|
||||
|
||||
;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
|
||||
mov eax, dr7
|
||||
push eax
|
||||
|
||||
;; clear Dr7 while executing debugger itself
|
||||
xor eax, eax
|
||||
mov dr7, eax
|
||||
|
||||
;; Dr6
|
||||
mov eax, dr6
|
||||
push eax
|
||||
|
||||
;; insure all status bits in dr6 are clear...
|
||||
xor eax, eax
|
||||
mov dr6, eax
|
||||
|
||||
mov eax, dr3
|
||||
push eax
|
||||
mov eax, dr2
|
||||
push eax
|
||||
mov eax, dr1
|
||||
push eax
|
||||
mov eax, dr0
|
||||
push eax
|
||||
|
||||
;; Clear Direction Flag
|
||||
cld
|
||||
|
||||
;; FX_SAVE_STATE_IA32 FxSaveState;
|
||||
sub esp, 512
|
||||
mov edi, esp
|
||||
;; Clear the buffer
|
||||
xor eax, eax
|
||||
mov ecx, 128 ;= 512 / 4
|
||||
rep stosd
|
||||
mov edi, esp
|
||||
|
||||
test edx, BIT24 ; Test for FXSAVE/FXRESTOR support.
|
||||
; edx still contains result from CPUID above
|
||||
jz @F
|
||||
db 0fh, 0aeh, 00000111y ;fxsave [edi]
|
||||
@@:
|
||||
|
||||
;; save the exception data
|
||||
push dword ptr [ebp + 8]
|
||||
|
||||
; call the C interrupt process function
|
||||
push esp ; Structure
|
||||
push ebx ; vector
|
||||
call InterruptProcess
|
||||
add esp, 8
|
||||
|
||||
; skip the exception data
|
||||
add esp, 4
|
||||
|
||||
;; FX_SAVE_STATE_IA32 FxSaveState;
|
||||
mov esi, esp
|
||||
mov eax, 1
|
||||
cpuid ; use CPUID to determine if FXSAVE/FXRESTOR are supported
|
||||
test edx, BIT24 ; Test for FXSAVE/FXRESTOR support
|
||||
jz @F
|
||||
db 0fh, 0aeh, 00001110y ; fxrstor [esi]
|
||||
@@:
|
||||
add esp, 512
|
||||
|
||||
;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
|
||||
pop eax
|
||||
mov dr0, eax
|
||||
pop eax
|
||||
mov dr1, eax
|
||||
pop eax
|
||||
mov dr2, eax
|
||||
pop eax
|
||||
mov dr3, eax
|
||||
;; skip restore of dr6. We cleared dr6 during the context save.
|
||||
add esp, 4
|
||||
pop eax
|
||||
mov dr7, eax
|
||||
|
||||
;; set EFlags
|
||||
pop dword ptr [ebp + 4 * 5] ; set EFLAGS in stack
|
||||
|
||||
;; UINT32 Ldtr, Tr;
|
||||
;; UINT32 Gdtr[2], Idtr[2];
|
||||
;; Best not let anyone mess with these particular registers...
|
||||
add esp, 24
|
||||
|
||||
;; UINT32 Eip;
|
||||
pop dword ptr [ebp + 4 * 3] ; set EIP in stack
|
||||
|
||||
;; UINT32 Gs, Fs, Es, Ds, Cs, Ss;
|
||||
;; NOTE - modified segment registers could hang the debugger... We
|
||||
;; could attempt to insulate ourselves against this possibility,
|
||||
;; but that poses risks as well.
|
||||
;;
|
||||
pop gs
|
||||
pop fs
|
||||
pop es
|
||||
pop ds
|
||||
pop dword ptr [ebp + 4 * 4] ; set CS in stack
|
||||
pop ss
|
||||
|
||||
;; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
|
||||
pop eax
|
||||
mov cr0, eax
|
||||
add esp, 4 ; skip for Cr1
|
||||
pop eax
|
||||
mov cr2, eax
|
||||
pop eax
|
||||
mov cr3, eax
|
||||
pop eax
|
||||
mov cr4, eax
|
||||
|
||||
;; restore general register
|
||||
pop edi
|
||||
pop esi
|
||||
pop dword ptr [ebp] ; save updated ebp
|
||||
pop dword ptr [ebp + 4] ; save updated esp
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
|
||||
mov esp, ebp
|
||||
pop ebp ; restore ebp maybe updated
|
||||
pop esp ; restore esp maybe updated
|
||||
sub esp, 4 * 3 ; restore interupt pushced stack
|
||||
|
||||
iretd
|
||||
|
||||
END
|
|
@ -1,405 +0,0 @@
|
|||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
; This program and the accompanying materials
|
||||
; are licensed and made available under the terms and conditions of the BSD License
|
||||
; which accompanies this distribution. The full text of the license may be found at
|
||||
; http://opensource.org/licenses/bsd-license.php.
|
||||
;
|
||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
;
|
||||
; Module Name:
|
||||
;
|
||||
; AsmFuncs.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; Debug interrupt handle functions.
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
#include "DebugException.h"
|
||||
|
||||
|
||||
externdef InterruptProcess:near
|
||||
|
||||
data SEGMENT
|
||||
|
||||
public Exception0Handle, TimerInterruptHandle, ExceptionStubHeaderSize
|
||||
|
||||
AGENT_HANDLER_SIGNATURE MACRO
|
||||
db 41h, 47h, 54h, 48h ; SIGNATURE_32('A','G','T','H')
|
||||
ENDM
|
||||
|
||||
ExceptionStubHeaderSize dd Exception1Handle - Exception0Handle ;
|
||||
CommonEntryAddr dq CommonEntry ;
|
||||
|
||||
.code
|
||||
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception0Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 0
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception1Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 1
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception2Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 2
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception3Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 3
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception4Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 4
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception5Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 5
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception6Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 6
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception7Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 7
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception8Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 8
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception9Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 9
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception10Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 10
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception11Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 11
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception12Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 12
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception13Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 13
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception14Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 14
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception15Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 15
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception16Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 16
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception17Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 17
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception18Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 18
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
Exception19Handle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 19
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
AGENT_HANDLER_SIGNATURE
|
||||
TimerInterruptHandle:
|
||||
cli
|
||||
push rcx
|
||||
mov rcx, 32
|
||||
jmp qword ptr [CommonEntryAddr]
|
||||
|
||||
CommonEntry:
|
||||
; We need to determine if any extra data was pushed by the exception
|
||||
cmp rcx, DEBUG_EXCEPT_DOUBLE_FAULT
|
||||
je NoExtrPush
|
||||
cmp rcx, DEBUG_EXCEPT_INVALID_TSS
|
||||
je NoExtrPush
|
||||
cmp rcx, DEBUG_EXCEPT_SEG_NOT_PRESENT
|
||||
je NoExtrPush
|
||||
cmp rcx, DEBUG_EXCEPT_STACK_FAULT
|
||||
je NoExtrPush
|
||||
cmp rcx, DEBUG_EXCEPT_GP_FAULT
|
||||
je NoExtrPush
|
||||
cmp rcx, DEBUG_EXCEPT_PAGE_FAULT
|
||||
je NoExtrPush
|
||||
cmp rcx, DEBUG_EXCEPT_ALIGNMENT_CHECK
|
||||
je NoExtrPush
|
||||
|
||||
push [rsp]
|
||||
mov qword ptr [rsp + 8], 0
|
||||
|
||||
NoExtrPush:
|
||||
push rbp
|
||||
mov rbp, rsp
|
||||
|
||||
; store UINT64 r8, r9, r10, r11, r12, r13, r14, r15;
|
||||
push r15
|
||||
push r14
|
||||
push r13
|
||||
push r12
|
||||
push r11
|
||||
push r10
|
||||
push r9
|
||||
push r8
|
||||
|
||||
mov r8, cr8
|
||||
push r8
|
||||
|
||||
; store UINT64 Rdi, Rsi, Rbp, Rsp, Rdx, Rcx, Rbx, Rax;
|
||||
push rax
|
||||
push rbx
|
||||
push qword ptr [rbp + 8] ; original rcx
|
||||
push rdx
|
||||
push qword ptr [rbp + 6 * 8] ; original rsp
|
||||
push qword ptr [rbp] ; original rbp
|
||||
push rsi
|
||||
push rdi
|
||||
|
||||
;; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
|
||||
;; insure FXSAVE/FXRSTOR is enabled in CR4...
|
||||
;; ... while we're at it, make sure DE is also enabled...
|
||||
mov rax, cr4
|
||||
or rax, 208h
|
||||
mov cr4, rax
|
||||
push rax
|
||||
mov rax, cr3
|
||||
push rax
|
||||
mov rax, cr2
|
||||
push rax
|
||||
push 0
|
||||
mov rax, cr0
|
||||
push rax
|
||||
|
||||
xor rax, rax
|
||||
mov rax, Ss
|
||||
push rax
|
||||
mov rax, Cs
|
||||
push rax
|
||||
mov rax, Ds
|
||||
push rax
|
||||
mov rax, Es
|
||||
push rax
|
||||
mov rax, Fs
|
||||
push rax
|
||||
mov rax, Gs
|
||||
push rax
|
||||
|
||||
;; EIP
|
||||
mov rax, [rbp + 8 * 3] ; EIP
|
||||
push rax
|
||||
|
||||
;; UINT64 Gdtr[2], Idtr[2];
|
||||
sub rsp, 16
|
||||
sidt fword ptr [rsp]
|
||||
sub rsp, 16
|
||||
sgdt fword ptr [rsp]
|
||||
|
||||
;; UINT64 Ldtr, Tr;
|
||||
xor rax, rax
|
||||
str ax
|
||||
push rax
|
||||
sldt ax
|
||||
push rax
|
||||
|
||||
;; EFlags
|
||||
mov rax, [rbp + 8 * 5]
|
||||
push rax
|
||||
|
||||
;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
|
||||
mov rax, dr7
|
||||
push rax
|
||||
|
||||
;; clear Dr7 while executing debugger itself
|
||||
xor rax, rax
|
||||
mov dr7, rax
|
||||
|
||||
;; Dr6
|
||||
mov rax, dr6
|
||||
push rax
|
||||
|
||||
;; insure all status bits in dr6 are clear...
|
||||
xor rax, rax
|
||||
mov dr6, rax
|
||||
|
||||
mov rax, dr3
|
||||
push rax
|
||||
mov rax, dr2
|
||||
push rax
|
||||
mov rax, dr1
|
||||
push rax
|
||||
mov rax, dr0
|
||||
push rax
|
||||
|
||||
;; Clear Direction Flag
|
||||
cld
|
||||
|
||||
sub rsp, 512
|
||||
mov rdi, rsp
|
||||
;; Clear the buffer
|
||||
xor rax, rax
|
||||
push rcx
|
||||
mov rcx, 64 ;= 512 / 8
|
||||
rep stosq
|
||||
pop rcx
|
||||
mov rdi, rsp
|
||||
db 0fh, 0aeh, 00000111y ;fxsave [rdi]
|
||||
|
||||
;; save the exception data
|
||||
push qword ptr [rbp + 16]
|
||||
|
||||
; call the C interrupt process function
|
||||
mov rdx, rsp ; Structure
|
||||
mov r15, rcx ; save vector in r15
|
||||
|
||||
;
|
||||
; Per X64 calling convention, allocate maximum parameter stack space
|
||||
; and make sure RSP is 16-byte aligned
|
||||
;
|
||||
sub rsp, 32 + 8
|
||||
call InterruptProcess
|
||||
add rsp, 32 + 8
|
||||
|
||||
;; skip the exception data
|
||||
add rsp, 8
|
||||
|
||||
mov rsi, rsp
|
||||
db 0fh, 0aeh, 00001110y ; fxrstor [rsi]
|
||||
add rsp, 512
|
||||
|
||||
;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
|
||||
pop rax
|
||||
mov dr0, rax
|
||||
pop rax
|
||||
mov dr1, rax
|
||||
pop rax
|
||||
mov dr2, rax
|
||||
pop rax
|
||||
mov dr3, rax
|
||||
;; skip restore of dr6. We cleared dr6 during the context save.
|
||||
add rsp, 8
|
||||
pop rax
|
||||
mov dr7, rax
|
||||
|
||||
;; set EFlags
|
||||
pop qword ptr [rbp + 8 * 5]
|
||||
|
||||
;; UINT64 Ldtr, Tr;
|
||||
;; UINT64 Gdtr[2], Idtr[2];
|
||||
;; Best not let anyone mess with these particular registers...
|
||||
add rsp, 24 * 2
|
||||
|
||||
;; UINT64 Eip;
|
||||
pop qword ptr [rbp + 8 * 3] ; set EIP in stack
|
||||
|
||||
;; UINT64 Gs, Fs, Es, Ds, Cs, Ss;
|
||||
;; NOTE - modified segment registers could hang the debugger... We
|
||||
;; could attempt to insulate ourselves against this possibility,
|
||||
;; but that poses risks as well.
|
||||
;;
|
||||
pop rax
|
||||
pop rax
|
||||
pop rax
|
||||
mov es, rax
|
||||
pop rax
|
||||
mov ds, rax
|
||||
pop qword ptr [rbp + 8 * 4] ; Set CS in stack
|
||||
pop rax
|
||||
mov ss, rax
|
||||
|
||||
;; UINT64 Cr0, Cr1, Cr2, Cr3, Cr4;
|
||||
pop rax
|
||||
mov cr0, rax
|
||||
add rsp, 8 ; skip for Cr1
|
||||
pop rax
|
||||
mov cr2, rax
|
||||
pop rax
|
||||
mov cr3, rax
|
||||
pop rax
|
||||
mov cr4, rax
|
||||
|
||||
;; restore general register
|
||||
pop rdi
|
||||
pop rsi
|
||||
add rsp, 8 ; skip rbp
|
||||
add rsp, 8 ; skip rsp
|
||||
pop rdx
|
||||
pop rcx
|
||||
pop rbx
|
||||
pop rax
|
||||
|
||||
pop r8
|
||||
mov cr8, r8
|
||||
|
||||
; store UINT64 r8, r9, r10, r11, r12, r13, r14, r15;
|
||||
pop r8
|
||||
pop r9
|
||||
pop r10
|
||||
pop r11
|
||||
pop r12
|
||||
pop r13
|
||||
pop r14
|
||||
pop r15
|
||||
|
||||
mov rsp, rbp
|
||||
pop rbp
|
||||
add rsp, 16 ; skip rcx and error code
|
||||
|
||||
iretq
|
||||
|
||||
END
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# Debug Agent library instance for Dxe Core and Dxe modules.
|
||||
#
|
||||
# Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -43,7 +43,6 @@
|
|||
|
||||
[Sources.Ia32]
|
||||
DebugAgentCommon/Ia32/AsmFuncs.S
|
||||
DebugAgentCommon/Ia32/AsmFuncs.asm
|
||||
DebugAgentCommon/Ia32/AsmFuncs.nasm
|
||||
DebugAgentCommon/Ia32/ArchDebugSupport.h
|
||||
DebugAgentCommon/Ia32/ArchDebugSupport.c
|
||||
|
@ -51,7 +50,6 @@
|
|||
|
||||
[Sources.X64]
|
||||
DebugAgentCommon/X64/AsmFuncs.S
|
||||
DebugAgentCommon/X64/AsmFuncs.asm
|
||||
DebugAgentCommon/X64/AsmFuncs.nasm
|
||||
DebugAgentCommon/X64/ArchDebugSupport.h
|
||||
DebugAgentCommon/X64/ArchDebugSupport.c
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# Debug Agent library instance for SEC Core and PEI modules.
|
||||
#
|
||||
# Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -40,7 +40,6 @@
|
|||
|
||||
[Sources.Ia32]
|
||||
DebugAgentCommon/Ia32/AsmFuncs.S
|
||||
DebugAgentCommon/Ia32/AsmFuncs.asm
|
||||
DebugAgentCommon/Ia32/AsmFuncs.nasm
|
||||
DebugAgentCommon/Ia32/ArchDebugSupport.h
|
||||
DebugAgentCommon/Ia32/ArchDebugSupport.c
|
||||
|
@ -48,7 +47,6 @@
|
|||
|
||||
[Sources.X64]
|
||||
DebugAgentCommon/X64/AsmFuncs.S
|
||||
DebugAgentCommon/X64/AsmFuncs.asm
|
||||
DebugAgentCommon/X64/AsmFuncs.nasm
|
||||
DebugAgentCommon/X64/ArchDebugSupport.h
|
||||
DebugAgentCommon/X64/ArchDebugSupport.c
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# Debug Agent library instance for SMM modules.
|
||||
#
|
||||
# Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -40,7 +40,6 @@
|
|||
|
||||
[Sources.Ia32]
|
||||
DebugAgentCommon/Ia32/AsmFuncs.S
|
||||
DebugAgentCommon/Ia32/AsmFuncs.asm
|
||||
DebugAgentCommon/Ia32/AsmFuncs.nasm
|
||||
DebugAgentCommon/Ia32/ArchDebugSupport.h
|
||||
DebugAgentCommon/Ia32/ArchDebugSupport.c
|
||||
|
@ -48,7 +47,6 @@
|
|||
|
||||
[Sources.X64]
|
||||
DebugAgentCommon/X64/AsmFuncs.S
|
||||
DebugAgentCommon/X64/AsmFuncs.asm
|
||||
DebugAgentCommon/X64/AsmFuncs.nasm
|
||||
DebugAgentCommon/X64/ArchDebugSupport.h
|
||||
DebugAgentCommon/X64/ArchDebugSupport.c
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
|
||||
; This program and the accompanying materials
|
||||
; are licensed and made available under the terms and conditions of the BSD License
|
||||
; which accompanies this distribution. The full text of the license may be found at
|
||||
; http://opensource.org/licenses/bsd-license.php.
|
||||
;
|
||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
;
|
||||
; Module Name:
|
||||
;
|
||||
; IntHandler.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; Assembly interrupt handler function.
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
|
||||
.686p
|
||||
.model flat,c
|
||||
|
||||
public AsmInterruptHandle
|
||||
|
||||
.code
|
||||
AsmInterruptHandle:
|
||||
cli
|
||||
mov al, 1
|
||||
iretd
|
||||
END
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# PeCoffExtraAction Library to support source level debug.
|
||||
#
|
||||
# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -34,13 +34,11 @@
|
|||
|
||||
[Sources.IA32]
|
||||
Ia32/IntHandlerFuncs.c
|
||||
Ia32/IntHandler.asm
|
||||
Ia32/IntHandler.nasm
|
||||
Ia32/IntHandler.S
|
||||
|
||||
[Sources.X64]
|
||||
X64/IntHandlerFuncs.c
|
||||
X64/IntHandler.asm
|
||||
X64/IntHandler.nasm
|
||||
X64/IntHandler.S
|
||||
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
|
||||
; This program and the accompanying materials
|
||||
; are licensed and made available under the terms and conditions of the BSD License
|
||||
; which accompanies this distribution. The full text of the license may be found at
|
||||
; http://opensource.org/licenses/bsd-license.php.
|
||||
;
|
||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
;
|
||||
; Module Name:
|
||||
;
|
||||
; IntHandler.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; Assembly interrupt handler function.
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
public AsmInterruptHandle
|
||||
|
||||
.code
|
||||
AsmInterruptHandle:
|
||||
cli
|
||||
mov al, 1
|
||||
iretq
|
||||
END
|
Loading…
Reference in New Issue