mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
[NTOS:KDBG] Nuke KdbEnter and KdbpCliModuleLoaded
They are not used anymore. Also clean up some obsolete prototypes.
This commit is contained in:
parent
6778fa157f
commit
fe777bb52f
5 changed files with 1 additions and 277 deletions
|
@ -33,11 +33,8 @@ KdPortPutByteEx(
|
|||
|
||||
#ifdef KDBG
|
||||
# define KdbInit() KdbpCliInit()
|
||||
# define KdbModuleLoaded(FILENAME) KdbpCliModuleLoaded(FILENAME)
|
||||
#else
|
||||
# define KdbInit() do { } while (0)
|
||||
# define KdbEnter() do { } while (0)
|
||||
# define KdbModuleLoaded(X) do { } while (0)
|
||||
#endif
|
||||
|
||||
/* KD ROUTINES ***************************************************************/
|
||||
|
|
|
@ -5,138 +5,6 @@
|
|||
|
||||
.code64
|
||||
|
||||
EXTERN KdbEnterDebuggerException : PROC
|
||||
|
||||
PUBLIC KdbEnter
|
||||
FUNC KdbEnter
|
||||
|
||||
/* save flags */
|
||||
pushfq
|
||||
.allocstack 8
|
||||
|
||||
/* Make room for a KTRAP_FRAME */
|
||||
sub rsp, KTRAP_FRAME_LENGTH
|
||||
.allocstack KTRAP_FRAME_LENGTH
|
||||
.ENDPROLOG
|
||||
|
||||
/* Save rbp */
|
||||
mov [rsp + KTRAP_FRAME_Rbp], rbp
|
||||
|
||||
/* Save non-volatile registers */
|
||||
mov [rsp + KTRAP_FRAME_Rbx], rbx
|
||||
mov [rsp + KTRAP_FRAME_Rdi], rdi
|
||||
mov [rsp + KTRAP_FRAME_Rsi], rsi
|
||||
|
||||
/* Save volatile registers */
|
||||
mov [rsp + KTRAP_FRAME_Rax], rax
|
||||
mov [rsp + KTRAP_FRAME_Rcx], rcx
|
||||
mov [rsp + KTRAP_FRAME_Rdx], rdx
|
||||
mov [rsp + KTRAP_FRAME_R8], r8
|
||||
mov [rsp + KTRAP_FRAME_R9], r9
|
||||
mov [rsp + KTRAP_FRAME_R10], r10
|
||||
mov [rsp + KTRAP_FRAME_R11], r11
|
||||
|
||||
/* Save xmm registers */
|
||||
movdqa [rsp + KTRAP_FRAME_Xmm0], xmm0
|
||||
movdqa [rsp + KTRAP_FRAME_Xmm1], xmm1
|
||||
movdqa [rsp + KTRAP_FRAME_Xmm2], xmm2
|
||||
movdqa [rsp + KTRAP_FRAME_Xmm3], xmm3
|
||||
movdqa [rsp + KTRAP_FRAME_Xmm4], xmm4
|
||||
movdqa [rsp + KTRAP_FRAME_Xmm5], xmm5
|
||||
|
||||
/* Save cs and previous mode */
|
||||
mov ax, cs
|
||||
mov [rsp + KTRAP_FRAME_SegCs], ax
|
||||
and ax, 1
|
||||
mov [rsp + KTRAP_FRAME_PreviousMode], al
|
||||
|
||||
/* Save segment selectors */
|
||||
mov ax, ds
|
||||
mov [rsp + KTRAP_FRAME_SegDs], ax
|
||||
mov ax, es
|
||||
mov [rsp + KTRAP_FRAME_SegEs], ax
|
||||
mov ax, fs
|
||||
mov [rsp + KTRAP_FRAME_SegFs], ax
|
||||
mov ax, gs
|
||||
mov [rsp + KTRAP_FRAME_SegGs], ax
|
||||
|
||||
/* Save previous irql */
|
||||
mov rax, cr8
|
||||
mov [rsp + KTRAP_FRAME_PreviousIrql], al
|
||||
|
||||
/* Save debug registers */
|
||||
mov rax, dr0
|
||||
mov [rsp + KTRAP_FRAME_Dr0], rax
|
||||
mov rax, dr1
|
||||
mov [rsp + KTRAP_FRAME_Dr1], rax
|
||||
mov rax, dr2
|
||||
mov [rsp + KTRAP_FRAME_Dr2], rax
|
||||
mov rax, dr3
|
||||
mov [rsp + KTRAP_FRAME_Dr3], rax
|
||||
mov rax, dr6
|
||||
mov [rsp + KTRAP_FRAME_Dr6], rax
|
||||
mov rax, dr7
|
||||
mov [rsp + KTRAP_FRAME_Dr7], rax
|
||||
|
||||
/* Point rbp, where rsp was before */
|
||||
lea rbp, [rsp + KTRAP_FRAME_LENGTH]
|
||||
mov [rsp + KTRAP_FRAME_Rsp], rbp
|
||||
|
||||
/* Store the EFLAGS we previously pushed on the stack */
|
||||
mov rax, [rbp + 8]
|
||||
mov [rsp + KTRAP_FRAME_EFlags], rax
|
||||
|
||||
/* Get RIP from the stack */
|
||||
mov rax, [rbp + 16]
|
||||
mov [rsp + KTRAP_FRAME_Rip], rax
|
||||
|
||||
/* Make sure the direction flag is cleared */
|
||||
cld
|
||||
|
||||
/* Clear all breakpoint enables in dr7. */
|
||||
mov rax, dr7
|
||||
and rax, HEX(ffffffffFFFF0000)
|
||||
mov dr7, rax
|
||||
|
||||
/* Call KDB */
|
||||
mov byte ptr [rsp + KTRAP_FRAME_P5], 1 /* FirstChance */
|
||||
mov r9, rsp /* Pointer to the trap frame */
|
||||
mov r8, 0 /* Context */
|
||||
mov dl, 0 /* PreviousMode (KernelMode) */
|
||||
mov rcx, 0 /* ExceptionRecord */
|
||||
call KdbEnterDebuggerException
|
||||
|
||||
/* Restore segment selectors */
|
||||
mov ax, [rsp + KTRAP_FRAME_SegDs]
|
||||
mov ds, ax
|
||||
mov ax, [rsp + KTRAP_FRAME_SegEs]
|
||||
mov es, ax
|
||||
mov ax, [rsp + KTRAP_FRAME_SegFs]
|
||||
mov fs, ax
|
||||
|
||||
/* Restore non-volatile registers */
|
||||
mov rbx, [rsp + KTRAP_FRAME_Rbx]
|
||||
mov rdi, [rsp + KTRAP_FRAME_Rdi]
|
||||
mov rsi, [rsp + KTRAP_FRAME_Rsi]
|
||||
|
||||
/* Restore volatile registers */
|
||||
mov rax, [rsp + KTRAP_FRAME_Rax]
|
||||
mov rcx, [rsp + KTRAP_FRAME_Rcx]
|
||||
mov rdx, [rsp + KTRAP_FRAME_Rdx]
|
||||
mov r8, [rsp + KTRAP_FRAME_R8]
|
||||
mov r9, [rsp + KTRAP_FRAME_R9]
|
||||
mov r10, [rsp + KTRAP_FRAME_R10]
|
||||
mov r11, [rsp + KTRAP_FRAME_R11]
|
||||
|
||||
/* Restore RSP */
|
||||
mov rsp, [rsp + KTRAP_FRAME_Rsp]
|
||||
|
||||
/* Restore EFLAGS */
|
||||
popfq
|
||||
|
||||
ret
|
||||
ENDFUNC
|
||||
|
||||
PUBLIC KdbpStackSwitchAndCall
|
||||
KdbpStackSwitchAndCall:
|
||||
|
||||
|
|
|
@ -2,119 +2,8 @@
|
|||
#include <asm.inc>
|
||||
#include <ks386.inc>
|
||||
|
||||
EXTERN _KdbEnterDebuggerFirstChanceException:PROC
|
||||
|
||||
.code
|
||||
|
||||
PUBLIC _KdbEnter
|
||||
_KdbEnter:
|
||||
/*
|
||||
* Set up a trap frame
|
||||
*/
|
||||
pushf /* Eflags */
|
||||
push cs /* Cs */
|
||||
push 0 /* ErrorCode */
|
||||
push ebp /* Ebp */
|
||||
push ebx /* Ebx */
|
||||
mov ebp, [esp + 20] /* Eip */
|
||||
mov ebx, [esp + 16] /* Eflags */
|
||||
mov [esp + 20], ebx
|
||||
mov ebx, [esp + 12] /* Cs */
|
||||
mov [esp + 16], ebx
|
||||
mov [esp + 12], ebp
|
||||
push esi /* Esi */
|
||||
push edi /* Edi */
|
||||
push fs /* Fs */
|
||||
push 0 /* ExceptionList */
|
||||
push 0 /* PreviousMode */
|
||||
push eax /* Eax */
|
||||
push ecx /* Ecx */
|
||||
push edx /* Edx */
|
||||
push ds /* Ds */
|
||||
push es /* Es */
|
||||
push gs /* Gs */
|
||||
mov eax, dr7
|
||||
push eax /* Dr7 */
|
||||
|
||||
/* Clear all breakpoint enables in dr7. */
|
||||
and eax, HEX(0FFFF0000)
|
||||
mov dr7, eax
|
||||
mov eax, dr6
|
||||
push eax /* Dr6 */
|
||||
mov eax, dr3
|
||||
push eax /* Dr3 */
|
||||
mov eax, dr2
|
||||
push eax /* Dr2 */
|
||||
mov eax, dr1
|
||||
push eax /* Dr1 */
|
||||
mov eax, dr0
|
||||
push eax /* Dr0 */
|
||||
lea eax, [esp + HEX(58)]
|
||||
push eax /* TempEsp */
|
||||
push ss /* TempSegSs */
|
||||
push 0 /* DebugPointer */
|
||||
push 3 /* DebugArgMark (Exception number) */
|
||||
push [esp + HEX(60)] /* DebugEip */
|
||||
push ebp /* DebugEbp */
|
||||
|
||||
/*
|
||||
* Call KDB
|
||||
*/
|
||||
mov eax, esp
|
||||
push eax /* Push a pointer to the trap frame */
|
||||
call _KdbEnterDebuggerFirstChanceException
|
||||
|
||||
/*
|
||||
* Pop the arguments and unused portions of the trap frame:
|
||||
* DebugEbp
|
||||
* DebugEip
|
||||
* DebugArgMark
|
||||
* DebugPointer
|
||||
* TempSegSs
|
||||
* TempEsp
|
||||
*/
|
||||
add esp, 11*4
|
||||
|
||||
/*
|
||||
* Restore/update debugging registers.
|
||||
*/
|
||||
pop eax /* Dr0 */
|
||||
mov dr0, eax
|
||||
pop eax /* Dr1 */
|
||||
mov dr1, eax
|
||||
pop eax /* Dr2 */
|
||||
mov dr2, eax
|
||||
pop eax /* Dr3 */
|
||||
mov dr3, eax
|
||||
pop eax /* Dr6 */
|
||||
mov dr6, eax
|
||||
pop eax /* Dr7 */
|
||||
mov dr7, eax
|
||||
|
||||
/*
|
||||
* Restore registers including any that might have been changed
|
||||
* inside the debugger.
|
||||
*/
|
||||
pop gs /* Gs */
|
||||
pop es /* Es */
|
||||
pop ds /* Ds */
|
||||
pop edx /* Edx */
|
||||
pop ecx /* Ecx */
|
||||
pop eax /* Eax */
|
||||
add esp, 8 /* PreviousMode, ExceptionList */
|
||||
pop fs /* Fs */
|
||||
pop edi /* Edi */
|
||||
pop esi /* Esi */
|
||||
pop ebx /* Ebx */
|
||||
pop ebp /* Ebp */
|
||||
add esp, 4 /* ErrorCode */
|
||||
|
||||
/*
|
||||
* Return to the caller.
|
||||
*/
|
||||
iretd
|
||||
|
||||
|
||||
PUBLIC _KdbpStackSwitchAndCall@8
|
||||
_KdbpStackSwitchAndCall@8:
|
||||
push ebp
|
||||
|
|
|
@ -95,10 +95,6 @@ VOID
|
|||
KdbpCliMainLoop(
|
||||
IN BOOLEAN EnteredOnSingleStep);
|
||||
|
||||
VOID
|
||||
KdbpCliModuleLoaded(
|
||||
IN PUNICODE_STRING Name);
|
||||
|
||||
VOID
|
||||
KdbpCliInterpretInitFile(VOID);
|
||||
|
||||
|
@ -266,17 +262,8 @@ KdbpTryGetCharKeyboard(PULONG ScanCode, ULONG Retry);
|
|||
CHAR
|
||||
KdbpTryGetCharSerial(ULONG Retry);
|
||||
|
||||
VOID
|
||||
KdbEnter(VOID);
|
||||
VOID
|
||||
DbgRDebugInit(VOID);
|
||||
VOID
|
||||
DbgShowFiles(VOID);
|
||||
VOID
|
||||
DbgEnableFile(PCH Filename);
|
||||
VOID
|
||||
DbgDisableFile(PCH Filename);
|
||||
VOID
|
||||
KbdDisableMouse(VOID);
|
||||
|
||||
VOID
|
||||
KbdEnableMouse(VOID);
|
||||
|
|
|
@ -3876,23 +3876,6 @@ KdbpCliMainLoop(
|
|||
while (Continue);
|
||||
}
|
||||
|
||||
/*!\brief Called when a module is loaded.
|
||||
*
|
||||
* \param Name Filename of the module which was loaded.
|
||||
*/
|
||||
VOID
|
||||
KdbpCliModuleLoaded(
|
||||
IN PUNICODE_STRING Name)
|
||||
{
|
||||
if (!KdbBreakOnModuleLoad)
|
||||
return;
|
||||
|
||||
KdbpPrint("Module ");
|
||||
KdbpPrintUnicodeString(Name);
|
||||
KdbpPrint(" loaded.\n");
|
||||
DbgBreakPointWithStatus(DBG_STATUS_CONTROL_C);
|
||||
}
|
||||
|
||||
/*!\brief This function is called by KdbEnterDebuggerException...
|
||||
*
|
||||
* Used to interpret the init file in a context with a trapframe setup
|
||||
|
|
Loading…
Reference in a new issue