ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
November 2020
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
18 participants
162 discussions
Start a n
N
ew thread
[reactos] 18/32: [NTOS:KD] Merge KdpTrap() with kd64 version
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a8662c73a59f3d9a416e8…
commit a8662c73a59f3d9a416e890108427f0ad8760b8a Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Mar 8 17:52:19 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Mon Nov 16 08:55:03 2020 +0100 [NTOS:KD] Merge KdpTrap() with kd64 version --- ntoskrnl/kd/kdmain.c | 160 +++++++++++------------------------------------- ntoskrnl/kd64/kdprint.c | 19 ------ ntoskrnl/kd64/kdtrap.c | 13 +++- 3 files changed, 47 insertions(+), 145 deletions(-) diff --git a/ntoskrnl/kd/kdmain.c b/ntoskrnl/kd/kdmain.c index f6edda85b6f..53df4366fdb 100644 --- a/ntoskrnl/kd/kdmain.c +++ b/ntoskrnl/kd/kdmain.c @@ -11,38 +11,6 @@ #define NDEBUG #include <debug.h> -// -// Retrieves the ComponentId and Level for BREAKPOINT_PRINT -// and OutputString and OutputStringLength for BREAKPOINT_PROMPT. -// -#if defined(_X86_) - -// -// EBX/EDI on x86 -// -#define KdpGetParameterThree(Context) ((Context)->Ebx) -#define KdpGetParameterFour(Context) ((Context)->Edi) - -#elif defined(_AMD64_) - -// -// R8/R9 on AMD64 -// -#define KdpGetParameterThree(Context) ((Context)->R8) -#define KdpGetParameterFour(Context) ((Context)->R9) - -#elif defined(_ARM_) - -// -// R3/R4 on ARM -// -#define KdpGetParameterThree(Context) ((Context)->R3) -#define KdpGetParameterFour(Context) ((Context)->R4) - -#else -#error Unsupported Architecture -#endif - /* VARIABLES ***************************************************************/ VOID NTAPI PspDumpThreads(BOOLEAN SystemThreads); @@ -52,109 +20,53 @@ extern ANSI_STRING KdpLogFileName; /* PRIVATE FUNCTIONS *********************************************************/ -BOOLEAN +VOID NTAPI -KdpTrap(IN PKTRAP_FRAME TrapFrame, - IN PKEXCEPTION_FRAME ExceptionFrame, - IN PEXCEPTION_RECORD ExceptionRecord, - IN PCONTEXT Context, - IN KPROCESSOR_MODE PreviousMode, - IN BOOLEAN SecondChance) +KdpReportCommandStringStateChange(IN PSTRING NameString, + IN PSTRING CommandString, + IN OUT PCONTEXT Context) { - KD_CONTINUE_TYPE Return = kdHandleException; - ULONG ExceptionCommand = ExceptionRecord->ExceptionInformation[0]; - - /* Check if this was a breakpoint due to DbgPrint or Load/UnloadSymbols */ - if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) && - (ExceptionRecord->NumberParameters > 0) && - ((ExceptionCommand == BREAKPOINT_LOAD_SYMBOLS) || - (ExceptionCommand == BREAKPOINT_UNLOAD_SYMBOLS) || - (ExceptionCommand == BREAKPOINT_COMMAND_STRING) || - (ExceptionCommand == BREAKPOINT_PRINT) || - (ExceptionCommand == BREAKPOINT_PROMPT))) - { - /* Check if this is a debug print */ - if (ExceptionCommand == BREAKPOINT_PRINT) - { - /* Call KDBG */ - NTSTATUS ReturnStatus; - BOOLEAN Handled; - ReturnStatus = KdpPrint((ULONG)KdpGetParameterThree(Context), - (ULONG)KdpGetParameterFour(Context), - (PCHAR)ExceptionRecord->ExceptionInformation[1], - (USHORT)ExceptionRecord->ExceptionInformation[2], - PreviousMode, - TrapFrame, - ExceptionFrame, - &Handled); - - /* Update the return value for the caller */ - KeSetContextReturnRegister(Context, ReturnStatus); - } -#ifdef KDBG - else if (ExceptionCommand == BREAKPOINT_LOAD_SYMBOLS) - { - PKD_SYMBOLS_INFO SymbolsInfo; - KD_SYMBOLS_INFO CapturedSymbolsInfo; - PLDR_DATA_TABLE_ENTRY LdrEntry; +} - SymbolsInfo = (PKD_SYMBOLS_INFO)ExceptionRecord->ExceptionInformation[2]; - if (PreviousMode != KernelMode) - { - _SEH2_TRY - { - ProbeForRead(SymbolsInfo, - sizeof(*SymbolsInfo), - 1); - KdpMoveMemory(&CapturedSymbolsInfo, - SymbolsInfo, - sizeof(*SymbolsInfo)); - SymbolsInfo = &CapturedSymbolsInfo; - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - SymbolsInfo = NULL; - } - _SEH2_END; - } +VOID +NTAPI +KdpReportLoadSymbolsStateChange(IN PSTRING PathName, + IN PKD_SYMBOLS_INFO SymbolInfo, + IN BOOLEAN Unload, + IN OUT PCONTEXT Context) +{ +#ifdef KDBG + PKD_SYMBOLS_INFO SymbolsInfo = SymbolInfo; + PLDR_DATA_TABLE_ENTRY LdrEntry; - if (SymbolsInfo != NULL) - { - /* Load symbols. Currently implemented only for KDBG! */ - if (KdbpSymFindModule(SymbolsInfo->BaseOfDll, NULL, -1, &LdrEntry)) - { - KdbSymProcessSymbols(LdrEntry); - } - } - } - else if (ExceptionCommand == BREAKPOINT_PROMPT) + if (SymbolsInfo != NULL && !Unload) + { + /* Load symbols. Currently implemented only for KDBG! */ + if (KdbpSymFindModule(SymbolsInfo->BaseOfDll, NULL, -1, &LdrEntry)) { - /* Call KDBG */ - ULONG ReturnLength; - ReturnLength = KdpPrompt((PCHAR)ExceptionRecord->ExceptionInformation[1], - (USHORT)ExceptionRecord->ExceptionInformation[2], - (PCHAR)KdpGetParameterThree(Context), - (USHORT)KdpGetParameterFour(Context), - PreviousMode, - TrapFrame, - ExceptionFrame); - - /* Update the return value for the caller */ - KeSetContextReturnRegister(Context, ReturnLength); + KdbSymProcessSymbols(LdrEntry); } + } #endif +} - /* This we can handle: simply bump the Program Counter */ - KeSetContextPc(Context, KeGetContextPc(Context) + KD_BREAKPOINT_SIZE); - return TRUE; - } +BOOLEAN +NTAPI +KdpReport(IN PKTRAP_FRAME TrapFrame, + IN PKEXCEPTION_FRAME ExceptionFrame, + IN PEXCEPTION_RECORD ExceptionRecord, + IN PCONTEXT ContextRecord, + IN KPROCESSOR_MODE PreviousMode, + IN BOOLEAN SecondChanceException) +{ + KD_CONTINUE_TYPE Return = kdHandleException; #ifdef KDBG /* Check if this is an assertion failure */ if (ExceptionRecord->ExceptionCode == STATUS_ASSERTION_FAILURE) { /* Bump EIP to the instruction following the int 2C */ - Context->Eip += 2; + ContextRecord->Eip += 2; } #endif @@ -165,15 +77,15 @@ KdpTrap(IN PKTRAP_FRAME TrapFrame, /* Call KDBG if available */ Return = KdbEnterDebuggerException(ExceptionRecord, PreviousMode, - Context, + ContextRecord, TrapFrame, - !SecondChance); + !SecondChanceException); #else /* not KDBG */ if (WrapperInitRoutine) { /* Call GDB */ Return = WrapperTable.KdpExceptionRoutine(ExceptionRecord, - Context, + ContextRecord, TrapFrame); } diff --git a/ntoskrnl/kd64/kdprint.c b/ntoskrnl/kd64/kdprint.c index 1d9caa87cea..9932798fbde 100644 --- a/ntoskrnl/kd64/kdprint.c +++ b/ntoskrnl/kd64/kdprint.c @@ -130,8 +130,6 @@ KdpPromptString( return FALSE; } -#ifdef _WINKD_ - VOID NTAPI KdpCommandString(IN PSTRING NameString, @@ -212,23 +210,6 @@ KdpSymbol(IN PSTRING DllPath, KdExitDebugger(Enable); } -#else - -extern -BOOLEAN -NTAPI -KdpPrintString( - _In_ PSTRING Output); - -extern -BOOLEAN -NTAPI -KdpPromptString( - _In_ PSTRING PromptString, - _In_ PSTRING ResponseString); - -#endif // _WINKD_ - USHORT NTAPI KdpPrompt( diff --git a/ntoskrnl/kd64/kdtrap.c b/ntoskrnl/kd64/kdtrap.c index 7cb266b70d1..42a04faa460 100644 --- a/ntoskrnl/kd64/kdtrap.c +++ b/ntoskrnl/kd64/kdtrap.c @@ -47,7 +47,16 @@ /* FUNCTIONS *****************************************************************/ -#ifdef _WINKD_ +#ifndef _WINKD_ +BOOLEAN +NTAPI +KdpReport(IN PKTRAP_FRAME TrapFrame, + IN PKEXCEPTION_FRAME ExceptionFrame, + IN PEXCEPTION_RECORD ExceptionRecord, + IN PCONTEXT ContextRecord, + IN KPROCESSOR_MODE PreviousMode, + IN BOOLEAN SecondChanceException); +#else BOOLEAN NTAPI KdpReport(IN PKTRAP_FRAME TrapFrame, @@ -130,6 +139,7 @@ KdpReport(IN PKTRAP_FRAME TrapFrame, KdpControlCPressed = FALSE; return Handled; } +#endif BOOLEAN NTAPI @@ -261,7 +271,6 @@ KdpTrap(IN PKTRAP_FRAME TrapFrame, /* Return TRUE or FALSE to caller */ return Handled; } -#endif BOOLEAN NTAPI
4 years, 1 month
1
0
0
0
[reactos] 17/32: [NTOS:KD] Merge KdpPrintString()/KdpPromptString() with kd64 version
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5730394bd09aa411bcf3a…
commit 5730394bd09aa411bcf3af0868e47772113f59a1 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 7 23:33:57 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Mon Nov 16 08:55:03 2020 +0100 [NTOS:KD] Merge KdpPrintString()/KdpPromptString() with kd64 version --- ntoskrnl/kd/kdio.c | 126 ++++++++++++++++++++++++------------------------ ntoskrnl/kd64/kdprint.c | 4 +- 2 files changed, 65 insertions(+), 65 deletions(-) diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c index 21d98615fe6..d76e3f55860 100644 --- a/ntoskrnl/kd/kdio.c +++ b/ntoskrnl/kd/kdio.c @@ -508,43 +508,59 @@ KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable, BOOLEAN NTAPI KdpPrintString( - _In_ PSTRING Output) -{ - PLIST_ENTRY CurrentEntry; - PKD_DISPATCH_TABLE CurrentTable; + _In_ PSTRING Output); - if (!KdpDebugMode.Value) return FALSE; +extern STRING KdbPromptString; - /* Call the registered handlers */ - CurrentEntry = KdProviders.Flink; - while (CurrentEntry != &KdProviders) +VOID +NTAPI +KdSendPacket( + IN ULONG PacketType, + IN PSTRING MessageHeader, + IN PSTRING MessageData, + IN OUT PKD_CONTEXT Context) +{ + if (PacketType == PACKET_TYPE_KD_DEBUG_IO) { - /* Get the current table */ - CurrentTable = CONTAINING_RECORD(CurrentEntry, - KD_DISPATCH_TABLE, - KdProvidersList); + PSTRING Output = MessageData; + PLIST_ENTRY CurrentEntry; + PKD_DISPATCH_TABLE CurrentTable; - /* Call it */ - CurrentTable->KdpPrintRoutine(Output->Buffer, Output->Length); + if (!KdpDebugMode.Value) return; - /* Next Table */ - CurrentEntry = CurrentEntry->Flink; - } + /* Call the registered handlers */ + CurrentEntry = KdProviders.Flink; + while (CurrentEntry != &KdProviders) + { + /* Get the current table */ + CurrentTable = CONTAINING_RECORD(CurrentEntry, + KD_DISPATCH_TABLE, + KdProvidersList); - /* Call the Wrapper Routine */ - if (WrapperTable.KdpPrintRoutine) - WrapperTable.KdpPrintRoutine(Output->Buffer, Output->Length); + /* Call it */ + CurrentTable->KdpPrintRoutine(Output->Buffer, Output->Length); - return FALSE; -} + /* Next Table */ + CurrentEntry = CurrentEntry->Flink; + } -extern STRING KdbPromptString; + /* Call the Wrapper Routine */ + if (WrapperTable.KdpPrintRoutine) + WrapperTable.KdpPrintRoutine(Output->Buffer, Output->Length); -BOOLEAN + return; + } + UNIMPLEMENTED; +} + +KDSTATUS NTAPI -KdpPromptString( - _In_ PSTRING PromptString, - _In_ PSTRING ResponseString) +KdReceivePacket( + IN ULONG PacketType, + OUT PSTRING MessageHeader, + OUT PSTRING MessageData, + OUT PULONG DataLength, + IN OUT PKD_CONTEXT Context) { #ifdef KDBG KIRQL OldIrql; @@ -552,12 +568,21 @@ KdpPromptString( CHAR Response; USHORT i; ULONG DummyScanCode; + CHAR MessageBuffer[100]; + STRING ResponseString; +#endif + if (PacketType != PACKET_TYPE_KD_DEBUG_IO) + return KdPacketTimedOut; + +#ifdef KDBG + ResponseString.Buffer = MessageBuffer; + ResponseString.Length = 0; + ResponseString.MaximumLength = min(sizeof(MessageBuffer), MessageData->MaximumLength); StringChar.Buffer = &Response; StringChar.Length = StringChar.MaximumLength = sizeof(Response); /* Display the string and print a new line for log neatness */ - KdpPrintString(PromptString); *StringChar.Buffer = '\n'; KdpPrintString(&StringChar); @@ -573,7 +598,7 @@ KdpPromptString( KbdDisableMouse(); /* Loop the whole string */ - for (i = 0; i < ResponseString->MaximumLength; i++) + for (i = 0; i < ResponseString.MaximumLength; i++) { /* Check if this is serial debugging mode */ if (KdbDebugState & KD_DEBUG_KDSERIAL) @@ -618,19 +643,24 @@ KdpPromptString( * Null terminate the output string -- documentation states that * DbgPrompt does not null terminate, but it does */ - *(PCHAR)(ResponseString->Buffer + i) = 0; + *(PCHAR)(ResponseString.Buffer + i) = 0; break; } /* Write it back and print it to the log */ - *(PCHAR)(ResponseString->Buffer + i) = Response; + *(PCHAR)(ResponseString.Buffer + i) = Response; KdpReleaseLock(&KdpSerialSpinLock, OldIrql); KdpPrintString(&StringChar); OldIrql = KdpAcquireLock(&KdpSerialSpinLock); } + /* Print a new line */ + *StringChar.Buffer = '\n'; + KdpPrintString(&StringChar); + /* Return the length */ - ResponseString->Length = i; + RtlCopyMemory(MessageData->Buffer, ResponseString.Buffer, i); + *DataLength = i; if (!(KdbDebugState & KD_DEBUG_KDSERIAL)) KbdEnableMouse(); @@ -638,38 +668,8 @@ KdpPromptString( /* Release the spinlock */ KdpReleaseLock(&KdpSerialSpinLock, OldIrql); - /* Print a new line */ - *StringChar.Buffer = '\n'; - KdpPrintString(&StringChar); #endif - - /* Success; we don't need to resend */ - return FALSE; -} - -VOID -NTAPI -KdSendPacket( - IN ULONG PacketType, - IN PSTRING MessageHeader, - IN PSTRING MessageData, - IN OUT PKD_CONTEXT Context) -{ - UNIMPLEMENTED; - return; -} - -KDSTATUS -NTAPI -KdReceivePacket( - IN ULONG PacketType, - OUT PSTRING MessageHeader, - OUT PSTRING MessageData, - OUT PULONG DataLength, - IN OUT PKD_CONTEXT Context) -{ - UNIMPLEMENTED; - return 0; + return KdPacketReceived; } /* EOF */ diff --git a/ntoskrnl/kd64/kdprint.c b/ntoskrnl/kd64/kdprint.c index 81da68b7ec1..1d9caa87cea 100644 --- a/ntoskrnl/kd64/kdprint.c +++ b/ntoskrnl/kd64/kdprint.c @@ -15,8 +15,6 @@ /* FUNCTIONS *****************************************************************/ -#ifdef _WINKD_ - BOOLEAN NTAPI KdpPrintString( @@ -132,6 +130,8 @@ KdpPromptString( return FALSE; } +#ifdef _WINKD_ + VOID NTAPI KdpCommandString(IN PSTRING NameString,
4 years, 1 month
1
0
0
0
[reactos] 16/32: [NTOS:KD] Merge KdpStub with kd64 version
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d5fe15e5e68db9b1c7280…
commit d5fe15e5e68db9b1c72808d1167e4ca110fd3b5d Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 7 19:32:45 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Mon Nov 16 08:55:03 2020 +0100 [NTOS:KD] Merge KdpStub with kd64 version --- ntoskrnl/kd/kdmain.c | 17 ----------------- ntoskrnl/kd64/kdtrap.c | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/ntoskrnl/kd/kdmain.c b/ntoskrnl/kd/kdmain.c index 01827ee07fb..f6edda85b6f 100644 --- a/ntoskrnl/kd/kdmain.c +++ b/ntoskrnl/kd/kdmain.c @@ -188,23 +188,6 @@ KdpTrap(IN PKTRAP_FRAME TrapFrame, return TRUE; } -BOOLEAN -NTAPI -KdpStub(IN PKTRAP_FRAME TrapFrame, - IN PKEXCEPTION_FRAME ExceptionFrame, - IN PEXCEPTION_RECORD ExceptionRecord, - IN PCONTEXT ContextRecord, - IN KPROCESSOR_MODE PreviousMode, - IN BOOLEAN SecondChanceException) -{ - return KdpTrap(TrapFrame, - ExceptionFrame, - ExceptionRecord, - ContextRecord, - PreviousMode, - SecondChanceException); -} - /* PUBLIC FUNCTIONS *********************************************************/ static PCHAR diff --git a/ntoskrnl/kd64/kdtrap.c b/ntoskrnl/kd64/kdtrap.c index c8cf539967f..7cb266b70d1 100644 --- a/ntoskrnl/kd64/kdtrap.c +++ b/ntoskrnl/kd64/kdtrap.c @@ -261,6 +261,7 @@ KdpTrap(IN PKTRAP_FRAME TrapFrame, /* Return TRUE or FALSE to caller */ return Handled; } +#endif BOOLEAN NTAPI @@ -312,7 +313,6 @@ KdpStub(IN PKTRAP_FRAME TrapFrame, return FALSE; } } -#endif BOOLEAN NTAPI
4 years, 1 month
1
0
0
0
[reactos] 15/32: [NTOS:KD] Remove some now useless tests on _WINKD_
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c2946ced9234d825297c5…
commit c2946ced9234d825297c59c2e492acd320fc153f Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 7 19:30:15 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Mon Nov 16 08:55:03 2020 +0100 [NTOS:KD] Remove some now useless tests on _WINKD_ --- ntoskrnl/ex/dbgctrl.c | 4 ---- ntoskrnl/ex/work.c | 2 -- ntoskrnl/include/internal/ex.h | 2 -- ntoskrnl/ke/amd64/trap.S | 6 ------ ntoskrnl/ke/i386/traphdlr.c | 2 -- ntoskrnl/mm/ARM3/mmdbg.c | 4 +--- 6 files changed, 1 insertion(+), 19 deletions(-) diff --git a/ntoskrnl/ex/dbgctrl.c b/ntoskrnl/ex/dbgctrl.c index f72774e3220..70280703a31 100644 --- a/ntoskrnl/ex/dbgctrl.c +++ b/ntoskrnl/ex/dbgctrl.c @@ -14,7 +14,6 @@ /* DATA **********************************************************************/ -// #ifdef _WINKD_ /* * WinDBG Debugger Worker State Machine data */ @@ -27,11 +26,9 @@ WINKD_WORKER_STATE ExpDebuggerWork; PEPROCESS ExpDebuggerProcessAttach; PEPROCESS ExpDebuggerProcessKill; ULONG_PTR ExpDebuggerPageIn; -// #endif /* _WINKD_ */ /* FUNCTIONS *****************************************************************/ -// #ifdef _WINKD_ /* * WinDBG Debugger Worker State Machine * @@ -142,7 +139,6 @@ ExpDebuggerWorker(IN PVOID Context) ObDereferenceObject(Process); } } -// #endif /* _WINKD_ */ /*++ * @name NtSystemDebugControl diff --git a/ntoskrnl/ex/work.c b/ntoskrnl/ex/work.c index 3884eb0b952..03ab0c4bfdf 100644 --- a/ntoskrnl/ex/work.c +++ b/ntoskrnl/ex/work.c @@ -483,7 +483,6 @@ ExpWorkerThreadBalanceManager(IN PVOID Context) PsTerminateSystemThread(STATUS_SYSTEM_SHUTDOWN); } -// #ifdef _WINKD_ /* * If WinDBG wants to attach or kill a user-mode process, and/or * page-in an address region, queue a debugger worker thread. @@ -494,7 +493,6 @@ ExpWorkerThreadBalanceManager(IN PVOID Context) ExpDebuggerWork = WinKdWorkerInitialized; ExQueueWorkItem(&ExpDebuggerWorkItem, DelayedWorkQueue); } -// #endif /* _WINKD_ */ } } diff --git a/ntoskrnl/include/internal/ex.h b/ntoskrnl/include/internal/ex.h index fae2026fc1c..3dcc38ff944 100644 --- a/ntoskrnl/include/internal/ex.h +++ b/ntoskrnl/include/internal/ex.h @@ -47,7 +47,6 @@ extern UNICODE_STRING CmVersionString; extern UNICODE_STRING CmCSDVersionString; extern CHAR NtBuildLab[]; -// #ifdef _WINKD_ /* * WinDBG Debugger Worker State Machine data (see dbgctrl.c) */ @@ -65,7 +64,6 @@ extern PEPROCESS ExpDebuggerProcessKill; extern ULONG_PTR ExpDebuggerPageIn; VOID NTAPI ExpDebuggerWorker(IN PVOID Context); -// #endif /* _WINKD_ */ #ifdef _WIN64 #define HANDLE_LOW_BITS (PAGE_SHIFT - 4) diff --git a/ntoskrnl/ke/amd64/trap.S b/ntoskrnl/ke/amd64/trap.S index 731e21b250a..2d7194b82de 100644 --- a/ntoskrnl/ke/amd64/trap.S +++ b/ntoskrnl/ke/amd64/trap.S @@ -24,9 +24,7 @@ EXTERN PsConvertToGuiThread:PROC EXTERN MmCreateKernelStack:PROC EXTERN MmDeleteKernelStack:PROC -#ifdef _WINKD_ EXTERN KdSetOwedBreakpoints:PROC -#endif /* Helper Macros *************************************************************/ @@ -430,9 +428,6 @@ FUNC KiPageFault /* Check for success */ test eax, eax -#ifndef _WINKD_ - jge PageFaultReturn -#else jl PageFaultError /* Check whether the kernel debugger has owed breakpoints to be inserted */ @@ -441,7 +436,6 @@ FUNC KiPageFault jmp PageFaultReturn PageFaultError: -#endif /* Disable interrupts again for the debugger */ cli diff --git a/ntoskrnl/ke/i386/traphdlr.c b/ntoskrnl/ke/i386/traphdlr.c index 0614efc398b..cf4dbdd92ee 100644 --- a/ntoskrnl/ke/i386/traphdlr.c +++ b/ntoskrnl/ke/i386/traphdlr.c @@ -1376,10 +1376,8 @@ KiTrap0EHandler(IN PKTRAP_FRAME TrapFrame) TrapFrame); if (NT_SUCCESS(Status)) { -#ifdef _WINKD_ /* Check whether the kernel debugger has owed breakpoints to be inserted */ KdSetOwedBreakpoints(); -#endif /* We succeeded, return */ KiEoiHelper(TrapFrame); } diff --git a/ntoskrnl/mm/ARM3/mmdbg.c b/ntoskrnl/mm/ARM3/mmdbg.c index 82fa5023cb6..c47b8cfe156 100644 --- a/ntoskrnl/mm/ARM3/mmdbg.c +++ b/ntoskrnl/mm/ARM3/mmdbg.c @@ -15,9 +15,7 @@ #define MODULE_INVOLVED_IN_ARM3 #include <mm/ARM3/miarm.h> -#ifndef _WINKD_ -#define KdpDprintf DPRINT -#elif defined(NDEBUG) +#ifdef NDEBUG #define KdpDprintf(...) #endif
4 years, 1 month
1
0
0
0
[reactos] 14/32: [NTOS:KD] Merge some more functions with kd64
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=660948ce6ff39c89aca57…
commit 660948ce6ff39c89aca576f1b65dcd7e8e13c543 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 7 19:14:09 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Mon Nov 16 08:55:03 2020 +0100 [NTOS:KD] Merge some more functions with kd64 Functions are KdIsThisAKdTrap, KdUpdateDataBlock, KdEnterDebugger, KdExitDebugger, KdRefreshDebuggerNotPresent, KdDisableDebugger, KdEnableDebuggerWithLock, KdEnableDebugger, KdSystemDebugControl --- ntoskrnl/kd/kdmain.c | 226 +------------------------------------------------ ntoskrnl/kd64/kdapi.c | 99 ++++++++++++++++++++-- ntoskrnl/kd64/kdinit.c | 4 +- ntoskrnl/kd64/kdtrap.c | 8 +- 4 files changed, 100 insertions(+), 237 deletions(-) diff --git a/ntoskrnl/kd/kdmain.c b/ntoskrnl/kd/kdmain.c index d411c83d53c..01827ee07fb 100644 --- a/ntoskrnl/kd/kdmain.c +++ b/ntoskrnl/kd/kdmain.c @@ -45,117 +45,13 @@ /* VARIABLES ***************************************************************/ -BOOLEAN KdDebuggerEnabled = FALSE; -BOOLEAN KdEnteredDebugger = FALSE; -BOOLEAN KdDebuggerNotPresent = TRUE; -BOOLEAN KdBreakAfterSymbolLoad = FALSE; -BOOLEAN KdPitchDebugger = TRUE; -BOOLEAN KdIgnoreUmExceptions = FALSE; - VOID NTAPI PspDumpThreads(BOOLEAN SystemThreads); -#if 0 -ULONG Kd_DEFAULT_MASK = 1 << DPFLTR_ERROR_LEVEL; -#endif - extern CPPORT PortInfo; extern ANSI_STRING KdpLogFileName; /* PRIVATE FUNCTIONS *********************************************************/ -ULONG -NTAPI -KdpServiceDispatcher(ULONG Service, - PVOID Buffer1, - ULONG Buffer1Length, - KPROCESSOR_MODE PreviousMode) -{ - ULONG Result = 0; - - switch (Service) - { - case BREAKPOINT_PRINT: /* DbgPrint */ - { - /* Call KDBG */ - BOOLEAN Handled; - Result = KdpPrint(MAXULONG, - DPFLTR_INFO_LEVEL, - (PCHAR)Buffer1, - (USHORT)Buffer1Length, - PreviousMode, - NULL, // TrapFrame, - NULL, // ExceptionFrame, - &Handled); - break; - } - -#if DBG - case ' soR': /* ROS-INTERNAL */ - { - switch ((ULONG_PTR)Buffer1) - { - case DumpAllThreads: - PspDumpThreads(TRUE); - break; - - case DumpUserThreads: - PspDumpThreads(FALSE); - break; - - case KdSpare3: - MmDumpArmPfnDatabase(FALSE); - break; - - default: - break; - } - break; - } - -#if defined(_M_IX86) && !defined(_WINKD_) // See ke/i386/traphdlr.c - /* Register a debug callback */ - case 'CsoR': - { - switch (Buffer1Length) - { - case ID_Win32PreServiceHook: - KeWin32PreServiceHook = Buffer1; - break; - - case ID_Win32PostServiceHook: - KeWin32PostServiceHook = Buffer1; - break; - - } - break; - } -#endif - - /* Special case for stack frame dumps */ - case 'DsoR': - { - KeRosDumpStackFrames((PULONG_PTR)Buffer1, Buffer1Length); - break; - } - -#if defined(KDBG) - /* Register KDBG CLI callback */ - case 'RbdK': - { - Result = KdbRegisterCliCallback(Buffer1, Buffer1Length); - break; - } -#endif /* KDBG */ -#endif /* DBG */ - default: - DPRINT1("Invalid debug service call!\n"); - HalDisplayString("Invalid debug service call!\r\n"); - break; - } - - return Result; -} - BOOLEAN NTAPI KdpTrap(IN PKTRAP_FRAME TrapFrame, @@ -309,129 +205,9 @@ KdpStub(IN PKTRAP_FRAME TrapFrame, SecondChanceException); } -BOOLEAN -NTAPI -KdIsThisAKdTrap(IN PEXCEPTION_RECORD ExceptionRecord, - IN PCONTEXT Context, - IN KPROCESSOR_MODE PreviousMode) -{ - /* KDBG has its own mechanism for ignoring user mode exceptions */ - return FALSE; -} - /* PUBLIC FUNCTIONS *********************************************************/ -VOID -NTAPI -KdUpdateDataBlock(VOID) -{ -} - -BOOLEAN -NTAPI -KdEnterDebugger(IN PKTRAP_FRAME TrapFrame, - IN PKEXCEPTION_FRAME ExceptionFrame) -{ - return FALSE; -} - -VOID -NTAPI -KdExitDebugger(IN BOOLEAN Enable) -{ -} - -/* - * @implemented - */ -BOOLEAN -NTAPI -KdRefreshDebuggerNotPresent(VOID) -{ - UNIMPLEMENTED; - - /* Just return whatever was set previously -- FIXME! */ - return KdDebuggerNotPresent; -} - -/* - * @implemented - */ -NTSTATUS -NTAPI -KdDisableDebugger(VOID) -{ - KIRQL OldIrql; - - /* Raise IRQL */ - KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); - - /* TODO: Disable any breakpoints */ - - /* Disable the Debugger */ - KdDebuggerEnabled = FALSE; - SharedUserData->KdDebuggerEnabled = FALSE; - - /* Lower the IRQL */ - KeLowerIrql(OldIrql); - - /* Return success */ - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI -KdEnableDebuggerWithLock(IN BOOLEAN NeedLock) -{ - return STATUS_ACCESS_DENIED; -} - -/* - * @implemented - */ -NTSTATUS -NTAPI -KdEnableDebugger(VOID) -{ - KIRQL OldIrql; - - /* Raise IRQL */ - KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); - - /* TODO: Re-enable any breakpoints */ - - /* Enable the Debugger */ - KdDebuggerEnabled = TRUE; - SharedUserData->KdDebuggerEnabled = TRUE; - - /* Lower the IRQL */ - KeLowerIrql(OldIrql); - - /* Return success */ - return STATUS_SUCCESS; -} - -/* - * @unimplemented - */ -NTSTATUS -NTAPI -KdSystemDebugControl(IN SYSDBG_COMMAND Command, - IN PVOID InputBuffer, - IN ULONG InputBufferLength, - OUT PVOID OutputBuffer, - IN ULONG OutputBufferLength, - IN OUT PULONG ReturnLength, - IN KPROCESSOR_MODE PreviousMode) -{ - /* HACK */ - return KdpServiceDispatcher(Command, - InputBuffer, - InputBufferLength, - PreviousMode); -} - -PCHAR +static PCHAR NTAPI KdpGetDebugMode(PCHAR Currentp2) { diff --git a/ntoskrnl/kd64/kdapi.c b/ntoskrnl/kd64/kdapi.c index 69fae2c450c..7e5b908a1e4 100644 --- a/ntoskrnl/kd64/kdapi.c +++ b/ntoskrnl/kd64/kdapi.c @@ -1874,12 +1874,14 @@ KdpQueryPerformanceCounter(IN PKTRAP_FRAME TrapFrame) /* Otherwise, do the call */ return KeQueryPerformanceCounter(NULL); } +#endif BOOLEAN NTAPI KdEnterDebugger(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame) { +#ifdef _WINKD_ BOOLEAN Enable; /* Check if we have a trap frame */ @@ -1926,12 +1928,16 @@ KdEnterDebugger(IN PKTRAP_FRAME TrapFrame, /* Return if interrupts needs to be re-enabled */ return Enable; +#else + return FALSE; +#endif } VOID NTAPI KdExitDebugger(IN BOOLEAN Enable) { +#ifdef _WINKD_ ULONG TimeSlip; /* Restore the state and unlock the port */ @@ -1961,12 +1967,14 @@ KdExitDebugger(IN BOOLEAN Enable) InterlockedIncrement(&KdpTimeSlipPending); KeInsertQueueDpc(&KdpTimeSlipDpc, NULL, NULL); // FIXME: this can trigger context switches! } +#endif } NTSTATUS NTAPI KdEnableDebuggerWithLock(IN BOOLEAN NeedLock) { +#ifdef _WINKD_ KIRQL OldIrql; #if defined(__GNUC__) @@ -2037,12 +2045,31 @@ KdEnableDebuggerWithLock(IN BOOLEAN NeedLock) /* We're done */ return STATUS_SUCCESS; +#else + KIRQL OldIrql; + + /* Raise IRQL */ + KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); + + /* TODO: Re-enable any breakpoints */ + + /* Enable the Debugger */ + KdDebuggerEnabled = TRUE; + SharedUserData->KdDebuggerEnabled = TRUE; + + /* Lower the IRQL */ + KeLowerIrql(OldIrql); + + /* Return success */ + return STATUS_SUCCESS; +#endif } NTSTATUS NTAPI KdDisableDebuggerWithLock(IN BOOLEAN NeedLock) { +#ifdef _WINKD_ KIRQL OldIrql; NTSTATUS Status; @@ -2127,13 +2154,32 @@ KdDisableDebuggerWithLock(IN BOOLEAN NeedLock) /* We're done */ return STATUS_SUCCESS; -} +#else + KIRQL OldIrql; -#endif // _WINKD_ + if (!NeedLock) + { + return STATUS_ACCESS_DENIED; + } -/* PUBLIC FUNCTIONS **********************************************************/ + /* Raise IRQL */ + KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); -#ifdef _WINKD_ + /* TODO: Disable any breakpoints */ + + /* Disable the Debugger */ + KdDebuggerEnabled = FALSE; + SharedUserData->KdDebuggerEnabled = FALSE; + + /* Lower the IRQL */ + KeLowerIrql(OldIrql); + + /* Return success */ + return STATUS_SUCCESS; +#endif +} + +/* PUBLIC FUNCTIONS **********************************************************/ /* * @implemented @@ -2174,6 +2220,21 @@ KdSystemDebugControl( /* Handle some internal commands */ switch ((ULONG)Command) { +#ifndef _WINKD_ + case BREAKPOINT_PRINT: /* DbgPrint */ + { + /* Call KDBG */ + BOOLEAN Handled; + return KdpPrint(MAXULONG, + DPFLTR_INFO_LEVEL, + (PCHAR)InputBuffer, + (USHORT)InputBufferLength, + PreviousMode, + NULL, // TrapFrame, + NULL, // ExceptionFrame, + &Handled); + } +#endif #if DBG case ' soR': /* ROS-INTERNAL */ { @@ -2197,12 +2258,38 @@ KdSystemDebugControl( return STATUS_SUCCESS; } +#if defined(_M_IX86) && !defined(_WINKD_) // See ke/i386/traphdlr.c + /* Register a debug callback */ + case 'CsoR': + { + switch (InputBufferLength) + { + case ID_Win32PreServiceHook: + KeWin32PreServiceHook = InputBuffer; + break; + + case ID_Win32PostServiceHook: + KeWin32PostServiceHook = InputBuffer; + break; + + } + break; + } +#endif + /* Special case for stack frame dumps */ case 'DsoR': { KeRosDumpStackFrames((PULONG_PTR)InputBuffer, InputBufferLength); break; } +#if defined(KDBG) + /* Register KDBG CLI callback */ + case 'RbdK': + { + return KdbRegisterCliCallback(InputBuffer, InputBufferLength); + } +#endif /* KDBG */ #endif default: break; @@ -2212,7 +2299,6 @@ KdSystemDebugControl( DbgPrint("KdSystemDebugControl is unimplemented!\n"); return STATUS_NOT_IMPLEMENTED; } -#endif /* * @implemented @@ -2299,7 +2385,6 @@ KdPowerTransition(IN DEVICE_POWER_STATE NewState) } } -#ifdef _WINKD_ /* * @implemented */ @@ -2333,8 +2418,6 @@ KdRefreshDebuggerNotPresent(VOID) return DebuggerNotPresent; } -#endif // _WINKD_ - /* * @implemented */ diff --git a/ntoskrnl/kd64/kdinit.c b/ntoskrnl/kd64/kdinit.c index 55f96609759..e3767d4f49f 100644 --- a/ntoskrnl/kd64/kdinit.c +++ b/ntoskrnl/kd64/kdinit.c @@ -84,16 +84,16 @@ KdpPrintBanner(IN SIZE_T MemSizeMBs) /* FUNCTIONS *****************************************************************/ -#ifdef _WINKD_ VOID NTAPI KdUpdateDataBlock(VOID) { +#ifdef _WINKD_ /* Update the KeUserCallbackDispatcher pointer */ KdDebuggerDataBlock.KeUserCallbackDispatcher = (ULONG_PTR)KeUserCallbackDispatcher; -} #endif +} BOOLEAN NTAPI diff --git a/ntoskrnl/kd64/kdtrap.c b/ntoskrnl/kd64/kdtrap.c index 7b7dd551223..c8cf539967f 100644 --- a/ntoskrnl/kd64/kdtrap.c +++ b/ntoskrnl/kd64/kdtrap.c @@ -312,6 +312,7 @@ KdpStub(IN PKTRAP_FRAME TrapFrame, return FALSE; } } +#endif BOOLEAN NTAPI @@ -319,6 +320,7 @@ KdIsThisAKdTrap(IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, IN KPROCESSOR_MODE PreviousMode) { +#ifdef _WINKD_ /* * Determine if this is a valid debug service call and make sure that * it isn't a software breakpoint @@ -335,6 +337,8 @@ KdIsThisAKdTrap(IN PEXCEPTION_RECORD ExceptionRecord, /* We don't have to handle it */ return FALSE; } -} - +#else + /* KDBG has its own mechanism for ignoring user mode exceptions */ + return FALSE; #endif +}
4 years, 1 month
1
0
0
0
[reactos] 13/32: [NTOS:KD] Rename KdpEnterDebuggerException to KdpTrap + add KdpStub forwarder
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d0e2fada23b6f84ee34b5…
commit d0e2fada23b6f84ee34b55048068d1fc60a3d8f1 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 7 18:54:21 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Mon Nov 16 08:55:02 2020 +0100 [NTOS:KD] Rename KdpEnterDebuggerException to KdpTrap + add KdpStub forwarder This removes somes uses of _WINKD_ macro. --- ntoskrnl/kd/kdmain.c | 22 ++++++++++++++++++---- ntoskrnl/kd64/kddata.c | 2 -- ntoskrnl/kd64/kdinit.c | 4 ---- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ntoskrnl/kd/kdmain.c b/ntoskrnl/kd/kdmain.c index b2ebe1b661f..d411c83d53c 100644 --- a/ntoskrnl/kd/kdmain.c +++ b/ntoskrnl/kd/kdmain.c @@ -158,7 +158,7 @@ KdpServiceDispatcher(ULONG Service, BOOLEAN NTAPI -KdpEnterDebuggerException(IN PKTRAP_FRAME TrapFrame, +KdpTrap(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, @@ -292,6 +292,23 @@ KdpEnterDebuggerException(IN PKTRAP_FRAME TrapFrame, return TRUE; } +BOOLEAN +NTAPI +KdpStub(IN PKTRAP_FRAME TrapFrame, + IN PKEXCEPTION_FRAME ExceptionFrame, + IN PEXCEPTION_RECORD ExceptionRecord, + IN PCONTEXT ContextRecord, + IN KPROCESSOR_MODE PreviousMode, + IN BOOLEAN SecondChanceException) +{ + return KdpTrap(TrapFrame, + ExceptionFrame, + ExceptionRecord, + ContextRecord, + PreviousMode, + SecondChanceException); +} + BOOLEAN NTAPI KdIsThisAKdTrap(IN PEXCEPTION_RECORD ExceptionRecord, @@ -414,9 +431,6 @@ KdSystemDebugControl(IN SYSDBG_COMMAND Command, PreviousMode); } -PKDEBUG_ROUTINE KiDebugRoutine = KdpEnterDebuggerException; - -CODE_SEG("INIT") PCHAR NTAPI KdpGetDebugMode(PCHAR Currentp2) diff --git a/ntoskrnl/kd64/kddata.c b/ntoskrnl/kd64/kddata.c index fb3e313733b..6d32ad6ec77 100644 --- a/ntoskrnl/kd64/kddata.c +++ b/ntoskrnl/kd64/kddata.c @@ -71,9 +71,7 @@ BOOLEAN KdpContextSent; // // Debug Trap Handlers // -#ifdef _WINKD_ PKDEBUG_ROUTINE KiDebugRoutine = KdpStub; -#endif PKDEBUG_SWITCH_ROUTINE KiDebugSwitchRoutine; // diff --git a/ntoskrnl/kd64/kdinit.c b/ntoskrnl/kd64/kdinit.c index fdf79aceba3..55f96609759 100644 --- a/ntoskrnl/kd64/kdinit.c +++ b/ntoskrnl/kd64/kdinit.c @@ -171,10 +171,8 @@ KdInitSystem(IN ULONG BootPhase, /* Check if we already initialized once */ if (KdDebuggerEnabled) return TRUE; -#ifdef _WINKD_ /* Set the Debug Routine as the Stub for now */ KiDebugRoutine = KdpStub; -#endif /* Disable break after symbol load for now */ KdBreakAfterSymbolLoad = FALSE; @@ -368,10 +366,8 @@ KdInitSystem(IN ULONG BootPhase, /* Initialize the debugger if requested */ if (EnableKd && (NT_SUCCESS(KdDebuggerInitialize0(LoaderBlock)))) { -#ifdef _WINKD_ /* Now set our real KD routine */ KiDebugRoutine = KdpTrap; -#endif /* Check if we've already initialized our structures */ if (!KdpDebuggerStructuresInitialized)
4 years, 1 month
1
0
0
0
[reactos] 12/32: [NTOS:KD] Merge KdInitDebugger with kd64 version + move variable declarations to kd64/kddata.c
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4d84c856ade7055476d2a…
commit 4d84c856ade7055476d2a429d20306dce3e1730e Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 7 18:07:05 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Mon Nov 16 08:55:02 2020 +0100 [NTOS:KD] Merge KdInitDebugger with kd64 version + move variable declarations to kd64/kddata.c Remove now unused file kd/kdinit.c --- ntoskrnl/kd/kdinit.c | 289 ------------------------------------------------- ntoskrnl/kd64/kddata.c | 23 ++++ ntoskrnl/kd64/kdinit.c | 21 +++- ntoskrnl/ntos.cmake | 1 - 4 files changed, 41 insertions(+), 293 deletions(-) diff --git a/ntoskrnl/kd/kdinit.c b/ntoskrnl/kd/kdinit.c deleted file mode 100644 index c5b4bf08c25..00000000000 --- a/ntoskrnl/kd/kdinit.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS Kernel - * FILE: ntoskrnl/kd/kdinit.c - * PURPOSE: Kernel Debugger Initializtion - * - * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) - */ - -#include <ntoskrnl.h> -#include <reactos/buildno.h> -#define NDEBUG -#include <debug.h> - -/* Make bochs debug output in the very early boot phase available */ -//#define AUTO_ENABLE_BOCHS - -/* VARIABLES ***************************************************************/ - -ULONG PortNumber = DEFAULT_DEBUG_PORT; -CPPORT PortInfo = {0, DEFAULT_DEBUG_BAUD_RATE, 0}; -ULONG KdpPortIrq; -#ifdef AUTO_ENABLE_BOCHS -KDP_DEBUG_MODE KdpDebugMode = {{{.Bochs=TRUE}}}; -#else -KDP_DEBUG_MODE KdpDebugMode; -#endif -PKDP_INIT_ROUTINE WrapperInitRoutine; -KD_DISPATCH_TABLE WrapperTable; -LIST_ENTRY KdProviders = {&KdProviders, &KdProviders}; -KD_DISPATCH_TABLE DispatchTable[KdMax]; - -PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit, - KdpSerialInit, - KdpDebugLogInit, - KdpBochsInit, - KdpKdbgInit}; - -extern ANSI_STRING KdpLogFileName; - -/* PRIVATE FUNCTIONS *********************************************************/ - -/* - * Get the total size of the memory before - * Mm is initialized, by counting the number - * of physical pages. Useful for debug logging. - * - * Strongly inspired by: - * mm\ARM3\mminit.c : MiScanMemoryDescriptors(...) - * - * See also: kd\kdio.c - */ -static CODE_SEG("INIT") -SIZE_T -KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock) -{ - PLIST_ENTRY ListEntry; - PMEMORY_ALLOCATION_DESCRIPTOR Descriptor; - SIZE_T NumberOfPhysicalPages = 0; - - /* Loop the memory descriptors */ - for (ListEntry = LoaderBlock->MemoryDescriptorListHead.Flink; - ListEntry != &LoaderBlock->MemoryDescriptorListHead; - ListEntry = ListEntry->Flink) - { - /* Get the descriptor */ - Descriptor = CONTAINING_RECORD(ListEntry, - MEMORY_ALLOCATION_DESCRIPTOR, - ListEntry); - - /* Check if this is invisible memory */ - if ((Descriptor->MemoryType == LoaderFirmwarePermanent) || - (Descriptor->MemoryType == LoaderSpecialMemory) || - (Descriptor->MemoryType == LoaderHALCachedMemory) || - (Descriptor->MemoryType == LoaderBBTMemory)) - { - /* Skip this descriptor */ - continue; - } - - /* Check if this is bad memory */ - if (Descriptor->MemoryType != LoaderBad) - { - /* Count this in the total of pages */ - NumberOfPhysicalPages += Descriptor->PageCount; - } - } - - /* Round size up. Assumed to better match actual physical RAM size */ - return ALIGN_UP_BY(NumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024); -} - -/* See also: kd\kdio.c */ -static CODE_SEG("INIT") -VOID -KdpPrintBanner(IN SIZE_T MemSizeMBs) -{ - DPRINT1("-----------------------------------------------------\n"); - DPRINT1("ReactOS " KERNEL_VERSION_STR " (Build " KERNEL_VERSION_BUILD_STR ") (Commit " KERNEL_VERSION_COMMIT_HASH ")\n"); - DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs); - - if (KeLoaderBlock) - { - DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions); - DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName, KeLoaderBlock->NtHalPathName, KeLoaderBlock->ArcHalDeviceName, KeLoaderBlock->NtBootPathName); - } -} -BOOLEAN -NTAPI -KdRegisterDebuggerDataBlock(IN ULONG Tag, - IN PDBGKD_DEBUG_DATA_HEADER64 DataHeader, - IN ULONG Size); - -BOOLEAN -NTAPI -KdInitSystem(IN ULONG BootPhase, - IN PLOADER_PARAMETER_BLOCK LoaderBlock) -{ - BOOLEAN EnableKd; - LPSTR DebugLine; - PLDR_DATA_TABLE_ENTRY LdrEntry; - ULONG i; - PCHAR CommandLine; - SIZE_T MemSizeMBs; - - /* Check if this is Phase 1 */ - if (BootPhase) - { - return TRUE; - } - - /* Check if we already initialized once */ - if (KdDebuggerEnabled) return TRUE; - - /* Disable break after symbol load for now */ - KdBreakAfterSymbolLoad = FALSE; - - /* Check if the Debugger Data Block was already initialized */ - if (!KdpDebuggerDataListHead.Flink) - { - /* It wasn't...Initialize the KD Data Listhead */ - InitializeListHead(&KdpDebuggerDataListHead); - - /* Register the Debugger Data Block */ - KdRegisterDebuggerDataBlock(KDBG_TAG, - &KdDebuggerDataBlock.Header, - sizeof(KdDebuggerDataBlock)); - - /* Fill out the KD Version Block */ - KdVersionBlock.MajorVersion = (USHORT)((DBGKD_MAJOR_NT << 8) | (NtBuildNumber >> 28)); - KdVersionBlock.MinorVersion = (USHORT)(NtBuildNumber & 0xFFFF); - -#ifdef CONFIG_SMP - /* This is an MP Build */ - KdVersionBlock.Flags |= DBGKD_VERS_FLAG_MP; -#endif - - /* Save Pointers to Loaded Module List and Debugger Data */ - KdVersionBlock.PsLoadedModuleList = (ULONG64)(LONG_PTR)&PsLoadedModuleList; - KdVersionBlock.DebuggerDataList = (ULONG64)(LONG_PTR)&KdpDebuggerDataListHead; - - /* Set protocol limits */ - KdVersionBlock.MaxStateChange = DbgKdMaximumStateChange - - DbgKdMinimumStateChange; - KdVersionBlock.MaxManipulate = DbgKdMaximumManipulate - - DbgKdMinimumManipulate; - KdVersionBlock.Unused[0] = 0; - - /* Link us in the KPCR */ - KeGetPcr()->KdVersionBlock = &KdVersionBlock; - } - - /* Check if we have a loader block */ - if (LoaderBlock) - { - /* Get the image entry */ - LdrEntry = CONTAINING_RECORD(LoaderBlock->LoadOrderListHead.Flink, - LDR_DATA_TABLE_ENTRY, - InLoadOrderLinks); - - /* Save the Kernel Base */ - PsNtosImageBase = (ULONG_PTR)LdrEntry->DllBase; - KdVersionBlock.KernBase = (ULONG64)(LONG_PTR)LdrEntry->DllBase; - - /* Check if we have a command line */ - CommandLine = LoaderBlock->LoadOptions; - if (CommandLine) - { - /* Upcase it */ - _strupr(CommandLine); - - /* Assume we'll disable KD */ - EnableKd = FALSE; - - /* Check for CRASHDEBUG, NODEBUG and just DEBUG */ - if (strstr(CommandLine, "CRASHDEBUG")) - { - /* Don't enable KD now, but allow it to be enabled later */ - KdPitchDebugger = FALSE; - } - else if (strstr(CommandLine, "NODEBUG")) - { - /* Don't enable KD and don't let it be enabled later */ - KdPitchDebugger = TRUE; - } - else if ((DebugLine = strstr(CommandLine, "DEBUG")) != NULL) - { - /* Enable KD */ - EnableKd = TRUE; - KdDebuggerNotPresent = FALSE; -#ifdef KDBG - /* Get the KDBG Settings */ - KdbpGetCommandLineSettings(LoaderBlock->LoadOptions); -#endif - } - } - else - { - /* No command line options? Disable debugger by default */ - KdPitchDebugger = TRUE; - EnableKd = FALSE; - } - } - else - { - /* Called from a bugcheck or a re-enable. Save the Kernel Base. */ - KdVersionBlock.KernBase = (ULONG64)(LONG_PTR)PsNtosImageBase; - - /* Unconditionally enable KD */ - EnableKd = TRUE; - } - - /* Set the Kernel Base in the Data Block */ - KdDebuggerDataBlock.KernBase = (ULONG_PTR)KdVersionBlock.KernBase; - - /* Initialize the debugger if requested */ - if (EnableKd && (NT_SUCCESS(KdDebuggerInitialize0(LoaderBlock)))) - { - /* Check if we've already initialized our structures */ - if (!KdpDebuggerStructuresInitialized) - { - /* Set the Debug Switch Routine and Retries */ - KdpContext.KdpDefaultRetries = 20; - KiDebugSwitchRoutine = KdpSwitchProcessor; - - /* Initialize breakpoints owed flag and table */ - KdpOweBreakpoint = FALSE; - for (i = 0; i < KD_BREAKPOINT_MAX; i++) - { - KdpBreakpointTable[i].Flags = 0; - KdpBreakpointTable[i].DirectoryTableBase = 0; - KdpBreakpointTable[i].Address = NULL; - } - - /* Initialize the Time Slip DPC */ - KeInitializeDpc(&KdpTimeSlipDpc, KdpTimeSlipDpcRoutine, NULL); - KeInitializeTimer(&KdpTimeSlipTimer); - ExInitializeWorkItem(&KdpTimeSlipWorkItem, KdpTimeSlipWork, NULL); - - /* First-time initialization done! */ - KdpDebuggerStructuresInitialized = TRUE; - } - - /* Initialize the timer */ - KdTimerStart.QuadPart = 0; - - /* Officially enable KD */ - KdPitchDebugger = FALSE; - KdDebuggerEnabled = TRUE; - - /* Let user-mode know that it's enabled as well */ - SharedUserData->KdDebuggerEnabled = TRUE; - - /* Display separator + ReactOS version at start of the debug log */ - MemSizeMBs = KdpGetMemorySizeInMBs(KeLoaderBlock); - KdpPrintBanner(MemSizeMBs); - - } - else - { - /* Disable debugger */ - KdDebuggerNotPresent = TRUE; - } - - /* Return initialized */ - return TRUE; -} - -/* EOF */ diff --git a/ntoskrnl/kd64/kddata.c b/ntoskrnl/kd64/kddata.c index b11ea0fa98e..fb3e313733b 100644 --- a/ntoskrnl/kd64/kddata.c +++ b/ntoskrnl/kd64/kddata.c @@ -139,6 +139,29 @@ PCHAR KdPrintCircularBuffer = KdPrintDefaultCircularBuffer; ULONG KdPrintBufferSize = sizeof(KdPrintDefaultCircularBuffer); ULONG KdPrintBufferChanges = 0; +#ifndef _WINKD_ +/* Make bochs debug output in the very early boot phase available */ +//#define AUTO_ENABLE_BOCHS +ULONG PortNumber = DEFAULT_DEBUG_PORT; +CPPORT PortInfo = {0, DEFAULT_DEBUG_BAUD_RATE, 0}; +ULONG KdpPortIrq; +#ifdef AUTO_ENABLE_BOCHS +KDP_DEBUG_MODE KdpDebugMode = {{{.Bochs=TRUE}}}; +#else +KDP_DEBUG_MODE KdpDebugMode; +#endif +PKDP_INIT_ROUTINE WrapperInitRoutine; +KD_DISPATCH_TABLE WrapperTable; +LIST_ENTRY KdProviders = {&KdProviders, &KdProviders}; +KD_DISPATCH_TABLE DispatchTable[KdMax]; + +PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit, + KdpSerialInit, + KdpDebugLogInit, + KdpBochsInit, + KdpKdbgInit}; +#endif + // // Debug Filter Masks // diff --git a/ntoskrnl/kd64/kdinit.c b/ntoskrnl/kd64/kdinit.c index 2561faefde2..fdf79aceba3 100644 --- a/ntoskrnl/kd64/kdinit.c +++ b/ntoskrnl/kd64/kdinit.c @@ -16,7 +16,6 @@ /* UTILITY FUNCTIONS *********************************************************/ -#ifdef _WINKD_ /* * Get the total size of the memory before * Mm is initialized, by counting the number @@ -85,6 +84,7 @@ KdpPrintBanner(IN SIZE_T MemSizeMBs) /* FUNCTIONS *****************************************************************/ +#ifdef _WINKD_ VOID NTAPI KdUpdateDataBlock(VOID) @@ -139,7 +139,6 @@ KdRegisterDebuggerDataBlock(IN ULONG Tag, return TRUE; } -#ifdef _WINKD_ BOOLEAN NTAPI KdInitSystem(IN ULONG BootPhase, @@ -172,8 +171,10 @@ KdInitSystem(IN ULONG BootPhase, /* Check if we already initialized once */ if (KdDebuggerEnabled) return TRUE; +#ifdef _WINKD_ /* Set the Debug Routine as the Stub for now */ KiDebugRoutine = KdpStub; +#endif /* Disable break after symbol load for now */ KdBreakAfterSymbolLoad = FALSE; @@ -251,6 +252,7 @@ KdInitSystem(IN ULONG BootPhase, /* Enable KD */ EnableKd = TRUE; +#ifdef _WINKD_ /* Check if there are any options */ if (DebugLine[5] == '=') { @@ -332,6 +334,16 @@ KdInitSystem(IN ULONG BootPhase, DebugOptionStart = DebugOptionEnd; } } +#else + (VOID)DebugOptionStart; + (VOID)DebugOptionEnd; + (VOID)DebugOptionLength; + KdDebuggerNotPresent = FALSE; +#ifdef KDBG + /* Get the KDBG Settings */ + KdbpGetCommandLineSettings(LoaderBlock->LoadOptions); +#endif +#endif } } else @@ -356,8 +368,10 @@ KdInitSystem(IN ULONG BootPhase, /* Initialize the debugger if requested */ if (EnableKd && (NT_SUCCESS(KdDebuggerInitialize0(LoaderBlock)))) { +#ifdef _WINKD_ /* Now set our real KD routine */ KiDebugRoutine = KdpTrap; +#endif /* Check if we've already initialized our structures */ if (!KdpDebuggerStructuresInitialized) @@ -440,9 +454,11 @@ KdInitSystem(IN ULONG BootPhase, /* Load symbols for image */ RtlInitString(&ImageName, NameBuffer); +#ifdef _WINKD_ DbgLoadImageSymbols(&ImageName, LdrEntry->DllBase, (ULONG_PTR)PsGetCurrentProcessId()); +#endif /* Go to the next entry */ NextEntry = NextEntry->Flink; @@ -462,4 +478,3 @@ KdInitSystem(IN ULONG BootPhase, /* Return initialized */ return TRUE; } -#endif diff --git a/ntoskrnl/ntos.cmake b/ntoskrnl/ntos.cmake index cced13d1d39..caeee0452b0 100644 --- a/ntoskrnl/ntos.cmake +++ b/ntoskrnl/ntos.cmake @@ -396,7 +396,6 @@ if(NOT _WINKD_) list(APPEND SOURCE ${REACTOS_SOURCE_DIR}/ntoskrnl/kd/wrappers/bochs.c ${REACTOS_SOURCE_DIR}/ntoskrnl/kd/wrappers/kdbg.c - ${REACTOS_SOURCE_DIR}/ntoskrnl/kd/kdinit.c ${REACTOS_SOURCE_DIR}/ntoskrnl/kd/kdio.c ${REACTOS_SOURCE_DIR}/ntoskrnl/kd/kdmain.c ${REACTOS_SOURCE_DIR}/ntoskrnl/kd64/kdapi.c
4 years, 1 month
1
0
0
0
[reactos] 11/32: [NTOS:KD] Import KdpCallInitRoutine() into KdDebuggerInitialize1()
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=777a2d94da285f9ab6126…
commit 777a2d94da285f9ab612680ebb9f5d412b74fb68 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 7 18:00:20 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Mon Nov 16 08:55:02 2020 +0100 [NTOS:KD] Import KdpCallInitRoutine() into KdDebuggerInitialize1() --- ntoskrnl/kd/kdinit.c | 31 ------------------------------- ntoskrnl/kd/kdmain.c | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/ntoskrnl/kd/kdinit.c b/ntoskrnl/kd/kdinit.c index d50f9fd0558..c5b4bf08c25 100644 --- a/ntoskrnl/kd/kdinit.c +++ b/ntoskrnl/kd/kdinit.c @@ -111,35 +111,6 @@ KdRegisterDebuggerDataBlock(IN ULONG Tag, IN PDBGKD_DEBUG_DATA_HEADER64 DataHeader, IN ULONG Size); -CODE_SEG("INIT") -VOID -NTAPI -KdpCallInitRoutine(ULONG BootPhase) -{ - PLIST_ENTRY CurrentEntry; - PKD_DISPATCH_TABLE CurrentTable; - - /* Call the registered handlers */ - CurrentEntry = KdProviders.Flink; - while (CurrentEntry != &KdProviders) - { - /* Get the current table */ - CurrentTable = CONTAINING_RECORD(CurrentEntry, - KD_DISPATCH_TABLE, - KdProvidersList); - - /* Call it */ - CurrentTable->KdpInitRoutine(CurrentTable, BootPhase); - - /* Next Table */ - CurrentEntry = CurrentEntry->Flink; - } - - /* Call the Wrapper Init Routine */ - if (WrapperInitRoutine) - WrapperTable.KdpInitRoutine(&WrapperTable, BootPhase); -} - BOOLEAN NTAPI KdInitSystem(IN ULONG BootPhase, @@ -155,8 +126,6 @@ KdInitSystem(IN ULONG BootPhase, /* Check if this is Phase 1 */ if (BootPhase) { - /* Call the Initialization Routines of the Registered Providers */ - KdpCallInitRoutine(BootPhase); return TRUE; } diff --git a/ntoskrnl/kd/kdmain.c b/ntoskrnl/kd/kdmain.c index 5cf6e00bd57..b2ebe1b661f 100644 --- a/ntoskrnl/kd/kdmain.c +++ b/ntoskrnl/kd/kdmain.c @@ -581,7 +581,29 @@ NTAPI KdDebuggerInitialize1( IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL) { - return STATUS_NOT_IMPLEMENTED; + PLIST_ENTRY CurrentEntry; + PKD_DISPATCH_TABLE CurrentTable; + + /* Call the registered handlers */ + CurrentEntry = KdProviders.Flink; + while (CurrentEntry != &KdProviders) + { + /* Get the current table */ + CurrentTable = CONTAINING_RECORD(CurrentEntry, + KD_DISPATCH_TABLE, + KdProvidersList); + + /* Call it */ + CurrentTable->KdpInitRoutine(CurrentTable, 1); + + /* Next Table */ + CurrentEntry = CurrentEntry->Flink; + } + + /* Call the Wrapper Init Routine */ + if (WrapperInitRoutine) + WrapperTable.KdpInitRoutine(&WrapperTable, 1); + return STATUS_SUCCESS; } /* EOF */
4 years, 1 month
1
0
0
0
[reactos] 10/32: [NTOS:KD] Move implementation of banner display from each debug output type to common code
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9b43a3a067965830ea217…
commit 9b43a3a067965830ea21757d1950439e5d8d4eaa Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 7 17:32:49 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Mon Nov 16 08:55:02 2020 +0100 [NTOS:KD] Move implementation of banner display from each debug output type to common code --- ntoskrnl/kd/kdinit.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++ ntoskrnl/kd/kdio.c | 81 ---------------------------------------------------- 2 files changed, 72 insertions(+), 81 deletions(-) diff --git a/ntoskrnl/kd/kdinit.c b/ntoskrnl/kd/kdinit.c index a2ed88ca6ee..d50f9fd0558 100644 --- a/ntoskrnl/kd/kdinit.c +++ b/ntoskrnl/kd/kdinit.c @@ -8,6 +8,7 @@ */ #include <ntoskrnl.h> +#include <reactos/buildno.h> #define NDEBUG #include <debug.h> @@ -39,6 +40,71 @@ extern ANSI_STRING KdpLogFileName; /* PRIVATE FUNCTIONS *********************************************************/ +/* + * Get the total size of the memory before + * Mm is initialized, by counting the number + * of physical pages. Useful for debug logging. + * + * Strongly inspired by: + * mm\ARM3\mminit.c : MiScanMemoryDescriptors(...) + * + * See also: kd\kdio.c + */ +static CODE_SEG("INIT") +SIZE_T +KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + PLIST_ENTRY ListEntry; + PMEMORY_ALLOCATION_DESCRIPTOR Descriptor; + SIZE_T NumberOfPhysicalPages = 0; + + /* Loop the memory descriptors */ + for (ListEntry = LoaderBlock->MemoryDescriptorListHead.Flink; + ListEntry != &LoaderBlock->MemoryDescriptorListHead; + ListEntry = ListEntry->Flink) + { + /* Get the descriptor */ + Descriptor = CONTAINING_RECORD(ListEntry, + MEMORY_ALLOCATION_DESCRIPTOR, + ListEntry); + + /* Check if this is invisible memory */ + if ((Descriptor->MemoryType == LoaderFirmwarePermanent) || + (Descriptor->MemoryType == LoaderSpecialMemory) || + (Descriptor->MemoryType == LoaderHALCachedMemory) || + (Descriptor->MemoryType == LoaderBBTMemory)) + { + /* Skip this descriptor */ + continue; + } + + /* Check if this is bad memory */ + if (Descriptor->MemoryType != LoaderBad) + { + /* Count this in the total of pages */ + NumberOfPhysicalPages += Descriptor->PageCount; + } + } + + /* Round size up. Assumed to better match actual physical RAM size */ + return ALIGN_UP_BY(NumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024); +} + +/* See also: kd\kdio.c */ +static CODE_SEG("INIT") +VOID +KdpPrintBanner(IN SIZE_T MemSizeMBs) +{ + DPRINT1("-----------------------------------------------------\n"); + DPRINT1("ReactOS " KERNEL_VERSION_STR " (Build " KERNEL_VERSION_BUILD_STR ") (Commit " KERNEL_VERSION_COMMIT_HASH ")\n"); + DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs); + + if (KeLoaderBlock) + { + DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions); + DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName, KeLoaderBlock->NtHalPathName, KeLoaderBlock->ArcHalDeviceName, KeLoaderBlock->NtBootPathName); + } +} BOOLEAN NTAPI KdRegisterDebuggerDataBlock(IN ULONG Tag, @@ -84,6 +150,7 @@ KdInitSystem(IN ULONG BootPhase, PLDR_DATA_TABLE_ENTRY LdrEntry; ULONG i; PCHAR CommandLine; + SIZE_T MemSizeMBs; /* Check if this is Phase 1 */ if (BootPhase) @@ -234,6 +301,11 @@ KdInitSystem(IN ULONG BootPhase, /* Let user-mode know that it's enabled as well */ SharedUserData->KdDebuggerEnabled = TRUE; + + /* Display separator + ReactOS version at start of the debug log */ + MemSizeMBs = KdpGetMemorySizeInMBs(KeLoaderBlock); + KdpPrintBanner(MemSizeMBs); + } else { diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c index 0e72108ec2c..21d98615fe6 100644 --- a/ntoskrnl/kd/kdio.c +++ b/ntoskrnl/kd/kdio.c @@ -46,70 +46,6 @@ volatile ULONG KdbDmesgTotalWritten = 0; volatile BOOLEAN KdbpIsInDmesgMode = FALSE; static KSPIN_LOCK KdpDmesgLogSpinLock; -/* UTILITY FUNCTIONS *********************************************************/ - -/* - * Get the total size of the memory before - * Mm is initialized, by counting the number - * of physical pages. Useful for debug logging. - * - * Strongly inspired by: - * mm\ARM3\mminit.c : MiScanMemoryDescriptors(...) - * - * See also: kd64\kdinit.c - */ -static CODE_SEG("INIT") -SIZE_T -KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock) -{ - PLIST_ENTRY ListEntry; - PMEMORY_ALLOCATION_DESCRIPTOR Descriptor; - SIZE_T NumberOfPhysicalPages = 0; - - /* Loop the memory descriptors */ - for (ListEntry = LoaderBlock->MemoryDescriptorListHead.Flink; - ListEntry != &LoaderBlock->MemoryDescriptorListHead; - ListEntry = ListEntry->Flink) - { - /* Get the descriptor */ - Descriptor = CONTAINING_RECORD(ListEntry, - MEMORY_ALLOCATION_DESCRIPTOR, - ListEntry); - - /* Check if this is invisible memory */ - if ((Descriptor->MemoryType == LoaderFirmwarePermanent) || - (Descriptor->MemoryType == LoaderSpecialMemory) || - (Descriptor->MemoryType == LoaderHALCachedMemory) || - (Descriptor->MemoryType == LoaderBBTMemory)) - { - /* Skip this descriptor */ - continue; - } - - /* Check if this is bad memory */ - if (Descriptor->MemoryType != LoaderBad) - { - /* Count this in the total of pages */ - NumberOfPhysicalPages += Descriptor->PageCount; - } - } - - /* Round size up. Assumed to better match actual physical RAM size */ - return ALIGN_UP_BY(NumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024); -} - -/* See also: kd64\kdinit.c */ -static CODE_SEG("INIT") -VOID -KdpPrintBanner(IN SIZE_T MemSizeMBs) -{ - DPRINT1("-----------------------------------------------------\n"); - DPRINT1("ReactOS " KERNEL_VERSION_STR " (Build " KERNEL_VERSION_BUILD_STR ") (Commit " KERNEL_VERSION_COMMIT_HASH ")\n"); - DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs); - DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions); - DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName, KeLoaderBlock->NtHalPathName, KeLoaderBlock->ArcHalDeviceName, KeLoaderBlock->NtBootPathName); -} - /* LOCKING FUNCTIONS *********************************************************/ KIRQL @@ -254,7 +190,6 @@ KdpDebugLogInit(PKD_DISPATCH_TABLE DispatchTable, IO_STATUS_BLOCK Iosb; HANDLE ThreadHandle; KPRIORITY Priority; - SIZE_T MemSizeMBs; if (!KdpDebugMode.File) return; @@ -277,11 +212,6 @@ KdpDebugLogInit(PKD_DISPATCH_TABLE DispatchTable, /* Initialize spinlock */ KeInitializeSpinLock(&KdpDebugLogSpinLock); - - /* Display separator + ReactOS version at start of the debug log */ - /* Round size up. Assumed to better match actual physical RAM size */ - MemSizeMBs = ALIGN_UP_BY(MmNumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024); - KdpPrintBanner(MemSizeMBs); } else if (BootPhase == 2) { @@ -374,7 +304,6 @@ NTAPI KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase) { - SIZE_T MemSizeMBs; if (!KdpDebugMode.Serial) return; if (BootPhase == 0) @@ -396,10 +325,6 @@ KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable, /* Register as a Provider */ InsertTailList(&KdProviders, &DispatchTable->KdProvidersList); - - /* Display separator + ReactOS version at start of the debug log */ - MemSizeMBs = KdpGetMemorySizeInMBs(KeLoaderBlock); - KdpPrintBanner(MemSizeMBs); } else if (BootPhase == 2) { @@ -545,7 +470,6 @@ NTAPI KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase) { - SIZE_T MemSizeMBs; if (!KdpDebugMode.Screen) return; if (BootPhase == 0) @@ -572,11 +496,6 @@ KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable, /* Initialize spinlock */ KeInitializeSpinLock(&KdpDmesgLogSpinLock); - - /* Display separator + ReactOS version at start of the debug log */ - /* Round size up. Assumed to better match actual physical RAM size */ - MemSizeMBs = ALIGN_UP_BY(MmNumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024); - KdpPrintBanner(MemSizeMBs); } else if (BootPhase == 2) {
4 years, 1 month
1
0
0
0
[reactos] 09/32: [NTOS:KD] Make implementation of KdInitSystem more similar with the kd64 one
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6025df33a572417841533…
commit 6025df33a57241784153307e98c7e765ba68a0a7 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 7 17:18:33 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Mon Nov 16 08:55:02 2020 +0100 [NTOS:KD] Make implementation of KdInitSystem more similar with the kd64 one Move some kd initializations into KdDebuggerInitialize0() function. --- ntoskrnl/kd/kdinit.c | 308 ++++++++++++++++++++++--------------------------- ntoskrnl/kd/kdmain.c | 157 ++++++++++++++++++++++++- ntoskrnl/kd64/kdapi.c | 7 ++ ntoskrnl/kd64/kddata.c | 2 +- 4 files changed, 305 insertions(+), 169 deletions(-) diff --git a/ntoskrnl/kd/kdinit.c b/ntoskrnl/kd/kdinit.c index 21e21162416..a2ed88ca6ee 100644 --- a/ntoskrnl/kd/kdinit.c +++ b/ntoskrnl/kd/kdinit.c @@ -39,76 +39,11 @@ extern ANSI_STRING KdpLogFileName; /* PRIVATE FUNCTIONS *********************************************************/ -CODE_SEG("INIT") -PCHAR +BOOLEAN NTAPI -KdpGetDebugMode(PCHAR Currentp2) -{ - PCHAR p1, p2 = Currentp2; - ULONG Value; - - /* Check for Screen Debugging */ - if (!_strnicmp(p2, "SCREEN", 6)) - { - /* Enable It */ - p2 += 6; - KdpDebugMode.Screen = TRUE; - } - /* Check for Serial Debugging */ - else if (!_strnicmp(p2, "COM", 3)) - { - /* Gheck for a valid Serial Port */ - p2 += 3; - if (*p2 != ':') - { - Value = (ULONG)atol(p2); - if (Value > 0 && Value < 5) - { - /* Valid port found, enable Serial Debugging */ - KdpDebugMode.Serial = TRUE; - - /* Set the port to use */ - SerialPortNumber = Value; - KdpPort = Value; - } - } - else - { - Value = strtoul(p2 + 1, NULL, 0); - if (Value) - { - KdpDebugMode.Serial = TRUE; - SerialPortInfo.Address = UlongToPtr(Value); - SerialPortNumber = 0; - KdpPort = 0; - } - } - } - /* Check for Debug Log Debugging */ - else if (!_strnicmp(p2, "FILE", 4)) - { - /* Enable It */ - p2 += 4; - KdpDebugMode.File = TRUE; - if (*p2 == ':') - { - p2++; - p1 = p2; - while (*p2 != '\0' && *p2 != ' ') p2++; - KdpLogFileName.MaximumLength = KdpLogFileName.Length = p2 - p1; - KdpLogFileName.Buffer = p1; - } - } - /* Check for BOCHS Debugging */ - else if (!_strnicmp(p2, "BOCHS", 5)) - { - /* Enable It */ - p2 += 5; - KdpDebugMode.Bochs = TRUE; - } - - return p2; -} +KdRegisterDebuggerDataBlock(IN ULONG Tag, + IN PDBGKD_DEBUG_DATA_HEADER64 DataHeader, + IN ULONG Size); CODE_SEG("INIT") VOID @@ -141,133 +76,172 @@ KdpCallInitRoutine(ULONG BootPhase) BOOLEAN NTAPI -KdInitSystem(ULONG BootPhase, - PLOADER_PARAMETER_BLOCK LoaderBlock) +KdInitSystem(IN ULONG BootPhase, + IN PLOADER_PARAMETER_BLOCK LoaderBlock) { - ULONG Value; + BOOLEAN EnableKd; + LPSTR DebugLine; + PLDR_DATA_TABLE_ENTRY LdrEntry; ULONG i; - PCHAR CommandLine, Port = NULL, BaudRate = NULL, Irq = NULL; + PCHAR CommandLine; - /* Set Default Port Options */ - if (BootPhase == 0) + /* Check if this is Phase 1 */ + if (BootPhase) { - /* Check if we have a loader block */ - if (LoaderBlock) - { - /* Check if we have a command line */ - CommandLine = LoaderBlock->LoadOptions; - if (CommandLine) - { - /* Upcase it */ - _strupr(CommandLine); - - /* XXX Check for settings that we support */ - if (strstr(CommandLine, "NODEBUG")) KdDebuggerEnabled = FALSE; - else if (strstr(CommandLine, "CRASHDEBUG")) KdDebuggerEnabled = FALSE; - else if (strstr(CommandLine, "DEBUG")) - { - /* Enable the kernel debugger */ - KdDebuggerNotPresent = FALSE; - KdDebuggerEnabled = TRUE; -#ifdef KDBG - /* Get the KDBG Settings */ - KdbpGetCommandLineSettings(LoaderBlock->LoadOptions); -#endif - } + /* Call the Initialization Routines of the Registered Providers */ + KdpCallInitRoutine(BootPhase); + return TRUE; + } - /* Get the port and baud rate */ - Port = strstr(CommandLine, "DEBUGPORT"); - BaudRate = strstr(CommandLine, "BAUDRATE"); - Irq = strstr(CommandLine, "IRQ"); - } - else - { - /* No command line options? Disable debugger by default */ - KdDebuggerEnabled = FALSE; - } - } - else - { - /* Called from a bugcheck or a re-enable. Unconditionally enable KD. */ - KdDebuggerEnabled = TRUE; - } + /* Check if we already initialized once */ + if (KdDebuggerEnabled) return TRUE; - /* Let user-mode know our state */ - SharedUserData->KdDebuggerEnabled = KdDebuggerEnabled; + /* Disable break after symbol load for now */ + KdBreakAfterSymbolLoad = FALSE; - /* Check if we got the /DEBUGPORT parameter(s) */ - while (Port) - { - /* Move past the actual string, to reach the port*/ - Port += sizeof("DEBUGPORT") - 1; + /* Check if the Debugger Data Block was already initialized */ + if (!KdpDebuggerDataListHead.Flink) + { + /* It wasn't...Initialize the KD Data Listhead */ + InitializeListHead(&KdpDebuggerDataListHead); - /* Now get past any spaces and skip the equal sign */ - while (*Port == ' ') Port++; - Port++; + /* Register the Debugger Data Block */ + KdRegisterDebuggerDataBlock(KDBG_TAG, + &KdDebuggerDataBlock.Header, + sizeof(KdDebuggerDataBlock)); - /* Get the debug mode and wrapper */ - Port = KdpGetDebugMode(Port); - Port = strstr(Port, "DEBUGPORT"); - } + /* Fill out the KD Version Block */ + KdVersionBlock.MajorVersion = (USHORT)((DBGKD_MAJOR_NT << 8) | (NtBuildNumber >> 28)); + KdVersionBlock.MinorVersion = (USHORT)(NtBuildNumber & 0xFFFF); + +#ifdef CONFIG_SMP + /* This is an MP Build */ + KdVersionBlock.Flags |= DBGKD_VERS_FLAG_MP; +#endif + + /* Save Pointers to Loaded Module List and Debugger Data */ + KdVersionBlock.PsLoadedModuleList = (ULONG64)(LONG_PTR)&PsLoadedModuleList; + KdVersionBlock.DebuggerDataList = (ULONG64)(LONG_PTR)&KdpDebuggerDataListHead; - /* Use serial port then */ - if (KdDebuggerEnabled && KdpDebugMode.Value == 0) - KdpDebugMode.Serial = TRUE; + /* Set protocol limits */ + KdVersionBlock.MaxStateChange = DbgKdMaximumStateChange - + DbgKdMinimumStateChange; + KdVersionBlock.MaxManipulate = DbgKdMaximumManipulate - + DbgKdMinimumManipulate; + KdVersionBlock.Unused[0] = 0; - /* Check if we got a baud rate */ - if (BaudRate) + /* Link us in the KPCR */ + KeGetPcr()->KdVersionBlock = &KdVersionBlock; + } + + /* Check if we have a loader block */ + if (LoaderBlock) + { + /* Get the image entry */ + LdrEntry = CONTAINING_RECORD(LoaderBlock->LoadOrderListHead.Flink, + LDR_DATA_TABLE_ENTRY, + InLoadOrderLinks); + + /* Save the Kernel Base */ + PsNtosImageBase = (ULONG_PTR)LdrEntry->DllBase; + KdVersionBlock.KernBase = (ULONG64)(LONG_PTR)LdrEntry->DllBase; + + /* Check if we have a command line */ + CommandLine = LoaderBlock->LoadOptions; + if (CommandLine) { - /* Move past the actual string, to reach the rate */ - BaudRate += sizeof("BAUDRATE") - 1; + /* Upcase it */ + _strupr(CommandLine); - /* Now get past any spaces */ - while (*BaudRate == ' ') BaudRate++; + /* Assume we'll disable KD */ + EnableKd = FALSE; - /* And make sure we have a rate */ - if (*BaudRate) + /* Check for CRASHDEBUG, NODEBUG and just DEBUG */ + if (strstr(CommandLine, "CRASHDEBUG")) + { + /* Don't enable KD now, but allow it to be enabled later */ + KdPitchDebugger = FALSE; + } + else if (strstr(CommandLine, "NODEBUG")) { - /* Read and set it */ - Value = atol(BaudRate + 1); - if (Value) PortInfo.BaudRate = SerialPortInfo.BaudRate = Value; + /* Don't enable KD and don't let it be enabled later */ + KdPitchDebugger = TRUE; + } + else if ((DebugLine = strstr(CommandLine, "DEBUG")) != NULL) + { + /* Enable KD */ + EnableKd = TRUE; + KdDebuggerNotPresent = FALSE; +#ifdef KDBG + /* Get the KDBG Settings */ + KdbpGetCommandLineSettings(LoaderBlock->LoadOptions); +#endif } } - - /* Check Serial Port Settings [IRQ] */ - if (Irq) + else { - /* Move past the actual string, to reach the rate */ - Irq += sizeof("IRQ") - 1; + /* No command line options? Disable debugger by default */ + KdPitchDebugger = TRUE; + EnableKd = FALSE; + } + } + else + { + /* Called from a bugcheck or a re-enable. Save the Kernel Base. */ + KdVersionBlock.KernBase = (ULONG64)(LONG_PTR)PsNtosImageBase; - /* Now get past any spaces */ - while (*Irq == ' ') Irq++; + /* Unconditionally enable KD */ + EnableKd = TRUE; + } + + /* Set the Kernel Base in the Data Block */ + KdDebuggerDataBlock.KernBase = (ULONG_PTR)KdVersionBlock.KernBase; - /* And make sure we have an IRQ */ - if (*Irq) + /* Initialize the debugger if requested */ + if (EnableKd && (NT_SUCCESS(KdDebuggerInitialize0(LoaderBlock)))) + { + /* Check if we've already initialized our structures */ + if (!KdpDebuggerStructuresInitialized) + { + /* Set the Debug Switch Routine and Retries */ + KdpContext.KdpDefaultRetries = 20; + KiDebugSwitchRoutine = KdpSwitchProcessor; + + /* Initialize breakpoints owed flag and table */ + KdpOweBreakpoint = FALSE; + for (i = 0; i < KD_BREAKPOINT_MAX; i++) { - /* Read and set it */ - Value = atol(Irq + 1); - if (Value) KdpPortIrq = Value; + KdpBreakpointTable[i].Flags = 0; + KdpBreakpointTable[i].DirectoryTableBase = 0; + KdpBreakpointTable[i].Address = NULL; } - } - /* Call Providers at Phase 0 */ - for (i = 0; i < KdMax; i++) - { - InitRoutines[i](&DispatchTable[i], 0); + /* Initialize the Time Slip DPC */ + KeInitializeDpc(&KdpTimeSlipDpc, KdpTimeSlipDpcRoutine, NULL); + KeInitializeTimer(&KdpTimeSlipTimer); + ExInitializeWorkItem(&KdpTimeSlipWorkItem, KdpTimeSlipWork, NULL); + + /* First-time initialization done! */ + KdpDebuggerStructuresInitialized = TRUE; } - /* Call Wrapper at Phase 0 */ - if (WrapperInitRoutine) WrapperInitRoutine(&WrapperTable, 0); - return TRUE; + /* Initialize the timer */ + KdTimerStart.QuadPart = 0; + + /* Officially enable KD */ + KdPitchDebugger = FALSE; + KdDebuggerEnabled = TRUE; + + /* Let user-mode know that it's enabled as well */ + SharedUserData->KdDebuggerEnabled = TRUE; } - else /* BootPhase > 0 */ + else { + /* Disable debugger */ + KdDebuggerNotPresent = TRUE; } - /* Call the Initialization Routines of the Registered Providers */ - KdpCallInitRoutine(BootPhase); - - /* Return success */ + /* Return initialized */ return TRUE; } diff --git a/ntoskrnl/kd/kdmain.c b/ntoskrnl/kd/kdmain.c index 92a47a9cc91..5cf6e00bd57 100644 --- a/ntoskrnl/kd/kdmain.c +++ b/ntoskrnl/kd/kdmain.c @@ -58,6 +58,9 @@ VOID NTAPI PspDumpThreads(BOOLEAN SystemThreads); ULONG Kd_DEFAULT_MASK = 1 << DPFLTR_ERROR_LEVEL; #endif +extern CPPORT PortInfo; +extern ANSI_STRING KdpLogFileName; + /* PRIVATE FUNCTIONS *********************************************************/ ULONG @@ -413,12 +416,164 @@ KdSystemDebugControl(IN SYSDBG_COMMAND Command, PKDEBUG_ROUTINE KiDebugRoutine = KdpEnterDebuggerException; +CODE_SEG("INIT") +PCHAR +NTAPI +KdpGetDebugMode(PCHAR Currentp2) +{ + PCHAR p1, p2 = Currentp2; + ULONG Value; + + /* Check for Screen Debugging */ + if (!_strnicmp(p2, "SCREEN", 6)) + { + /* Enable It */ + p2 += 6; + KdpDebugMode.Screen = TRUE; + } + /* Check for Serial Debugging */ + else if (!_strnicmp(p2, "COM", 3)) + { + /* Gheck for a valid Serial Port */ + p2 += 3; + if (*p2 != ':') + { + Value = (ULONG)atol(p2); + if (Value > 0 && Value < 5) + { + /* Valid port found, enable Serial Debugging */ + KdpDebugMode.Serial = TRUE; + + /* Set the port to use */ + SerialPortNumber = Value; + KdpPort = Value; + } + } + else + { + Value = strtoul(p2 + 1, NULL, 0); + if (Value) + { + KdpDebugMode.Serial = TRUE; + SerialPortInfo.Address = UlongToPtr(Value); + SerialPortNumber = 0; + KdpPort = 0; + } + } + } + /* Check for Debug Log Debugging */ + else if (!_strnicmp(p2, "FILE", 4)) + { + /* Enable It */ + p2 += 4; + KdpDebugMode.File = TRUE; + if (*p2 == ':') + { + p2++; + p1 = p2; + while (*p2 != '\0' && *p2 != ' ') p2++; + KdpLogFileName.MaximumLength = KdpLogFileName.Length = p2 - p1; + KdpLogFileName.Buffer = p1; + } + } + /* Check for BOCHS Debugging */ + else if (!_strnicmp(p2, "BOCHS", 5)) + { + /* Enable It */ + p2 += 5; + KdpDebugMode.Bochs = TRUE; + } + + return p2; +} + NTSTATUS NTAPI KdDebuggerInitialize0( IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL) { - return STATUS_NOT_IMPLEMENTED; + ULONG Value; + ULONG i; + PCHAR CommandLine, Port = NULL, BaudRate = NULL, Irq = NULL; + + if (LoaderBlock) + { + /* Check if we have a command line */ + CommandLine = LoaderBlock->LoadOptions; + if (CommandLine) + { + /* Upcase it */ + _strupr(CommandLine); + + /* Get the port and baud rate */ + Port = strstr(CommandLine, "DEBUGPORT"); + BaudRate = strstr(CommandLine, "BAUDRATE"); + Irq = strstr(CommandLine, "IRQ"); + } + } + + /* Check if we got the /DEBUGPORT parameter(s) */ + while (Port) + { + /* Move past the actual string, to reach the port*/ + Port += sizeof("DEBUGPORT") - 1; + + /* Now get past any spaces and skip the equal sign */ + while (*Port == ' ') Port++; + Port++; + + /* Get the debug mode and wrapper */ + Port = KdpGetDebugMode(Port); + Port = strstr(Port, "DEBUGPORT"); + } + + /* Use serial port then */ + if (KdpDebugMode.Value == 0) + KdpDebugMode.Serial = TRUE; + + /* Check if we got a baud rate */ + if (BaudRate) + { + /* Move past the actual string, to reach the rate */ + BaudRate += sizeof("BAUDRATE") - 1; + + /* Now get past any spaces */ + while (*BaudRate == ' ') BaudRate++; + + /* And make sure we have a rate */ + if (*BaudRate) + { + /* Read and set it */ + Value = atol(BaudRate + 1); + if (Value) PortInfo.BaudRate = SerialPortInfo.BaudRate = Value; + } + } + + /* Check Serial Port Settings [IRQ] */ + if (Irq) + { + /* Move past the actual string, to reach the rate */ + Irq += sizeof("IRQ") - 1; + + /* Now get past any spaces */ + while (*Irq == ' ') Irq++; + + /* And make sure we have an IRQ */ + if (*Irq) + { + /* Read and set it */ + Value = atol(Irq + 1); + if (Value) KdpPortIrq = Value; + } + } + + /* Call Providers at Phase 0 */ + for (i = 0; i < KdMax; i++) + { + InitRoutines[i](&DispatchTable[i], 0); + } + + return STATUS_SUCCESS; } NTSTATUS diff --git a/ntoskrnl/kd64/kdapi.c b/ntoskrnl/kd64/kdapi.c index f9205be480f..69fae2c450c 100644 --- a/ntoskrnl/kd64/kdapi.c +++ b/ntoskrnl/kd64/kdapi.c @@ -1726,6 +1726,7 @@ KdpReportCommandStringStateChange(IN PSTRING NameString, Context); } while (Status == ContinueProcessorReselected); } +#endif BOOLEAN NTAPI @@ -1733,6 +1734,7 @@ KdpReportExceptionStateChange(IN PEXCEPTION_RECORD ExceptionRecord, IN OUT PCONTEXT Context, IN BOOLEAN SecondChanceException) { +#ifdef _WINKD_ STRING Header, Data; DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange; KCONTINUE_STATUS Status; @@ -1780,6 +1782,10 @@ KdpReportExceptionStateChange(IN PEXCEPTION_RECORD ExceptionRecord, /* Return */ return Status; +#else + UNIMPLEMENTED; + return FALSE; +#endif } VOID @@ -1851,6 +1857,7 @@ KdpSwitchProcessor(IN PEXCEPTION_RECORD ExceptionRecord, return Status; } +#ifdef _WINKD_ LARGE_INTEGER NTAPI KdpQueryPerformanceCounter(IN PKTRAP_FRAME TrapFrame) diff --git a/ntoskrnl/kd64/kddata.c b/ntoskrnl/kd64/kddata.c index d0acd10a2af..b11ea0fa98e 100644 --- a/ntoskrnl/kd64/kddata.c +++ b/ntoskrnl/kd64/kddata.c @@ -73,8 +73,8 @@ BOOLEAN KdpContextSent; // #ifdef _WINKD_ PKDEBUG_ROUTINE KiDebugRoutine = KdpStub; -PKDEBUG_SWITCH_ROUTINE KiDebugSwitchRoutine; #endif +PKDEBUG_SWITCH_ROUTINE KiDebugSwitchRoutine; // // Debugger Configuration Settings
4 years, 1 month
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
17
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Results per page:
10
25
50
100
200