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
March 2005
----- 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
26 participants
609 discussions
Start a n
N
ew thread
[blight] 13846: Rename KDB.init to KDBinit - it was not an ISO9660 conforming name.
by blight@svn.reactos.com
Rename KDB.init to KDBinit - it was not an ISO9660 conforming name. Modified: trunk/reactos/Makefile Deleted: trunk/reactos/media/drivers/etc/KDB.init Added: trunk/reactos/media/drivers/etc/KDBinit Modified: trunk/reactos/ntoskrnl/dbg/kdb_cli.c _____ Modified: trunk/reactos/Makefile --- trunk/reactos/Makefile 2005-03-06 02:06:11 UTC (rev 13845) +++ trunk/reactos/Makefile 2005-03-06 02:34:18 UTC (rev 13846) @@ -216,8 +216,8 @@ $(CP) media/nls/l_intl.nls $(BOOTCD_DIR)/reactos/l_intl.nls $(HALFVERBOSEECHO) [COPY] media/drivers/etc/services to $(BOOTCD_DIR)/reactos/services $(CP) media/drivers/etc/services $(BOOTCD_DIR)/reactos/services - $(HALFVERBOSEECHO) [COPY] media/drivers/etc/KDB.init to $(BOOTCD_DIR)/reactos/KDB.init - $(CP) media/drivers/etc/KDB.init $(BOOTCD_DIR)/reactos/KDB.init + $(HALFVERBOSEECHO) [COPY] media/drivers/etc/KDBinit to $(BOOTCD_DIR)/reactos/KDBinit + $(CP) media/drivers/etc/KDBinit $(BOOTCD_DIR)/reactos/KDBinit bootcd_basic: bootcd_directory_layout bootcd_bootstrap_files bootcd_install_before @@ -1045,8 +1045,8 @@ $(CP) media/nls/l_intl.nls $(INSTALL_DIR)/system32/casemap.nls $(HALFVERBOSEECHO) [INSTALL] media/drivers/etc/services to $(INSTALL_DIR)/system32/drivers/etc/services $(CP) media/drivers/etc/services $(INSTALL_DIR)/system32/drivers/etc/services - $(HALFVERBOSEECHO) [INSTALL] media/drivers/etc/KDB.init to $(INSTALL_DIR)/system32/drivers/etc/KDB.init - $(CP) media/drivers/etc/KDB.init $(INSTALL_DIR)/system32/drivers/etc/KDB.init + $(HALFVERBOSEECHO) [INSTALL] media/drivers/etc/KDBinit to $(INSTALL_DIR)/system32/drivers/etc/KDBinit + $(CP) media/drivers/etc/KDBinit $(INSTALL_DIR)/system32/drivers/etc/KDBinit .PHONY: install_clean install_dirs install_before _____ Deleted: trunk/reactos/media/drivers/etc/KDB.init --- trunk/reactos/media/drivers/etc/KDB.init 2005-03-06 02:06:11 UTC (rev 13845) +++ trunk/reactos/media/drivers/etc/KDB.init 2005-03-06 02:34:18 UTC (rev 13846) @@ -1,15 +0,0 @@ -# Example KDB.init file -# -# The disassembly flavor is set to "intel" (default is "at&t") and the -# - -# Set the disassembly flavor to "intel" (default is "at&t") -set syntax intel - -# Change the condition to enter KDB on INT3 to "always" (default is "kmode") -set condition INT3 first always - -# This is a special command available only in the KDB.init file - it breaks into -# KDB when it is interpreting the init file at startup. -#break - _____ Copied: trunk/reactos/media/drivers/etc/KDBinit (from rev 13845, trunk/reactos/media/drivers/etc/KDB.init) _____ Modified: trunk/reactos/ntoskrnl/dbg/kdb_cli.c --- trunk/reactos/ntoskrnl/dbg/kdb_cli.c 2005-03-06 02:06:11 UTC (rev 13845) +++ trunk/reactos/ntoskrnl/dbg/kdb_cli.c 2005-03-06 02:34:18 UTC (rev 13846) @@ -97,7 +97,7 @@ STATIC LONG KdbNumberOfRowsTerminal = -1; STATIC LONG KdbNumberOfColsTerminal = -1; -PCHAR KdbInitFileBuffer = NULL; /* Buffer where KDB.init file is loaded into during initialization */ +PCHAR KdbInitFileBuffer = NULL; /* Buffer where KDBinit file is loaded into during initialization */ STATIC CONST struct { @@ -2206,7 +2206,7 @@ CHAR c; /* Execute the commands in the init file */ - DbgPrint("KDB: Executing KDB.init file...\n"); + DbgPrint("KDB: Executing KDBinit file...\n"); p1 = KdbInitFileBuffer; while (p1[0] != '\0') { @@ -2237,12 +2237,12 @@ while (p1[0] == '\r' || p1[0] == '\n') p1++; } - DbgPrint("KDB: KDB.init executed\n"); + DbgPrint("KDB: KDBinit executed\n"); } /*!\brief Called when KDB is initialized * - * Reads the KDB.init file from the SystemRoot\system32\drivers\etc directory and executes it. + * Reads the KDBinit file from the SystemRoot\system32\drivers\etc directory and executes it. */ VOID KdbpCliInit() @@ -2258,7 +2258,7 @@ ULONG OldEflags; /* Initialize the object attributes */ - RtlInitUnicodeString(&FileName, L"\\SystemRoot\\system32\\drivers\\etc\\KDB.init"); + RtlInitUnicodeString(&FileName, L"\\SystemRoot\\system32\\drivers\\etc\\KDBinit"); InitializeObjectAttributes(&ObjectAttributes, &FileName, 0, NULL, NULL); /* Open the file */ @@ -2267,7 +2267,7 @@ FILE_NO_INTERMEDIATE_BUFFERING); if (!NT_SUCCESS(Status)) { - DPRINT("Could not open \\SystemRoot\\system32\\drivers\\etc\\KDB.init (Status 0x%x)", Status); + DPRINT("Could not open \\SystemRoot\\system32\\drivers\\etc\\KDBinit (Status 0x%x)", Status); return; } @@ -2277,7 +2277,7 @@ if (!NT_SUCCESS(Status)) { ZwClose(hFile); - DPRINT("Could not query size of \\SystemRoot\\system32\\drivers\\etc\\KDB.init (Status 0x%x)", Status); + DPRINT("Could not query size of \\SystemRoot\\system32\\drivers\\etc\\KDBinit (Status 0x%x)", Status); return; } FileSize = FileStdInfo.EndOfFile.u.LowPart; @@ -2287,7 +2287,7 @@ if (FileBuffer == NULL) { ZwClose(hFile); - DPRINT("Could not allocate %d bytes for KDB.init file\n", FileSize); + DPRINT("Could not allocate %d bytes for KDBinit file\n", FileSize); return; } @@ -2297,7 +2297,7 @@ if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE) { ExFreePool(FileBuffer); - DPRINT("Could not read KDB.init file into memory (Status 0x%lx)\n", Status); + DPRINT("Could not read KDBinit file into memory (Status 0x%lx)\n", Status); return; } FileSize = min(FileSize, Iosb.Information);
19 years, 9 months
1
0
0
0
[blight] 13845: Hopefully fix some input problems. If input does not work for you please let me know.
by blight@svn.reactos.com
Hopefully fix some input problems. If input does not work for you please let me know. Modified: trunk/reactos/ntoskrnl/dbg/kdb.h Modified: trunk/reactos/ntoskrnl/dbg/kdb_cli.c Modified: trunk/reactos/ntoskrnl/dbg/kdb_keyboard.c Modified: trunk/reactos/ntoskrnl/dbg/kdb_serial.c _____ Modified: trunk/reactos/ntoskrnl/dbg/kdb.h --- trunk/reactos/ntoskrnl/dbg/kdb.h 2005-03-06 00:50:48 UTC (rev 13844) +++ trunk/reactos/ntoskrnl/dbg/kdb.h 2005-03-06 02:06:11 UTC (rev 13845) @@ -272,10 +272,15 @@ #define KdbpSafeReadMemory(dst, src, size) MmSafeCopyFromUser(dst, src, size) #define KdbpSafeWriteMemory(dst, src, size) MmSafeCopyToUser(dst, src, size) + +#define KdbpGetCharKeyboard(ScanCode) KdbpTryGetCharKeyboard(ScanCode, 0) CHAR -KdbpTryGetCharKeyboard(PULONG ScanCode); -ULONG -KdbpTryGetCharSerial(VOID); +KdbpTryGetCharKeyboard(PULONG ScanCode, UINT Retry); + +#define KdbpGetCharSerial() KdbpTryGetCharSerial(0) +CHAR +KdbpTryGetCharSerial(UINT Retry); + VOID KdbEnter(VOID); VOID _____ Modified: trunk/reactos/ntoskrnl/dbg/kdb_cli.c --- trunk/reactos/ntoskrnl/dbg/kdb_cli.c 2005-03-06 00:50:48 UTC (rev 13844) +++ trunk/reactos/ntoskrnl/dbg/kdb_cli.c 2005-03-06 02:06:11 UTC (rev 13845) @@ -1682,6 +1682,7 @@ INT Length; INT i; INT RowsPrintedByTerminal; + ULONG ScanCode; va_list ap; /* Check if the user has aborted output of the current command */ @@ -1703,20 +1704,17 @@ { /* Try to query number of rows from terminal. A reply looks like "\x1b[8;24;80t" */ TerminalReportsSize = FALSE; - DbgPrint("\x1b[18t"); - i = 10; - while ((i-- > 0) && ((c = KdbpTryGetCharSerial()) == -1)); + //DbgPrint("\x1b[18t"); + c = KdbpTryGetCharSerial(10); if (c == KEY_ESC) { - i = 5; - while ((i-- > 0) && ((c = KdbpTryGetCharSerial()) == -1)); + c = KdbpTryGetCharSerial(5); if (c == '[') { Length = 0; for (;;) { - i = 5; - while ((i-- > 0) && ((c = KdbpTryGetCharSerial()) == -1)); + c = KdbpTryGetCharSerial(5); if (c == -1) break; Buffer[Length++] = c; @@ -1781,13 +1779,19 @@ if (KdbNumberOfColsPrinted > 0) DbgPrint("\n"); DbgPrint("--- Press q to abort, any other key to continue ---"); - while ((c = KdbpTryGetCharSerial()) == -1); + if (KdDebugState & KD_DEBUG_KDSERIAL) + c = KdbpGetCharSerial(); + else + c = KdbpGetCharKeyboard(&ScanCode); if (c == '\r') { - /* Ignore \r and wait for \n or another \r - if \n is not received here + /* Try to read '\n' which might follow '\r' - if \n is not received here * it will be interpreted as "return" when the next command should be read. */ - while ((c = KdbpTryGetCharSerial()) == -1); + if (KdDebugState & KD_DEBUG_KDSERIAL) + c = KdbpTryGetCharSerial(5); + else + c = KdbpTryGetCharKeyboard(&ScanCode, 5); } DbgPrint("\n"); if (c == 'q') @@ -1914,7 +1918,7 @@ OUT PCHAR Buffer, IN ULONG Size) { - CHAR Key; + CHAR Key, NextKey; PCHAR Orig = Buffer; ULONG ScanCode = 0; BOOLEAN EchoOn; @@ -1929,14 +1933,14 @@ { if (KdDebugState & KD_DEBUG_KDSERIAL) { - while ((Key = KdbpTryGetCharSerial()) == -1); + Key = KdbpGetCharSerial(); ScanCode = 0; if (Key == KEY_ESC) /* ESC */ { - while ((Key = KdbpTryGetCharSerial()) == -1); + Key = KdbpGetCharSerial(); if (Key == '[') { - while ((Key = KdbpTryGetCharSerial()) == -1); + Key = KdbpGetCharSerial(); switch (Key) { case 'A': @@ -1954,7 +1958,9 @@ } } else - while ((Key = KdbpTryGetCharKeyboard(&ScanCode)) == -1); + { + Key = KdbpGetCharKeyboard(&ScanCode); + } if ((Buffer - Orig) >= (Size - 1)) { @@ -1965,10 +1971,13 @@ if (Key == '\r') { - /* Ignore this key... */ - } - else if (Key == '\n') - { + /* Read the next char - this is to throw away a \n which most clients should + * send after \r. + */ + if (KdDebugState & KD_DEBUG_KDSERIAL) + NextKey = KdbpTryGetCharSerial(5); + else + NextKey = KdbpTryGetCharKeyboard(&ScanCode, 5); DbgPrint("\n"); /* * Repeat the last command if the user presses enter. Reduces the _____ Modified: trunk/reactos/ntoskrnl/dbg/kdb_keyboard.c --- trunk/reactos/ntoskrnl/dbg/kdb_keyboard.c 2005-03-06 00:50:48 UTC (rev 13844) +++ trunk/reactos/ntoskrnl/dbg/kdb_keyboard.c 2005-03-06 02:06:11 UTC (rev 13845) @@ -62,12 +62,13 @@ } CHAR -KdbpTryGetCharKeyboard(PULONG ScanCode) +KdbpTryGetCharKeyboard(PULONG ScanCode, UINT Retry) { static byte_t last_key = 0; static byte_t shift = 0; char c; - while(1) { + BOOLEAN KeepRetrying = (Retry == 0); + while (KeepRetrying || Retry-- > 0) { unsigned char status = kbd_read_status(); while (status & KBD_STAT_OBF) { byte_t scancode; @@ -91,6 +92,8 @@ } } } + + return -1; } #endif _____ Modified: trunk/reactos/ntoskrnl/dbg/kdb_serial.c --- trunk/reactos/ntoskrnl/dbg/kdb_serial.c 2005-03-06 00:50:48 UTC (rev 13844) +++ trunk/reactos/ntoskrnl/dbg/kdb_serial.c 2005-03-06 02:06:11 UTC (rev 13845) @@ -20,11 +20,14 @@ CHAR -KdbpTryGetCharSerial() +KdbpTryGetCharSerial(UINT Retry) { - UCHAR Result; + CHAR Result = -1; - while( !KdPortGetByteEx (&LogPortInfo, &Result) ); + if (Retry == 0) + while (!KdPortGetByteEx(&LogPortInfo, (PUCHAR)&Result)); + else + while (!KdPortGetByteEx(&LogPortInfo, (PUCHAR)&Result) && Retry-- > 0); return Result; }
19 years, 9 months
1
0
0
0
[ion] 13844: Merge with 13841:13843. Blight's rewrite adds a bug with ENTER in qemu, waiting on his fix.
by ion@svn.reactos.com
Merge with 13841:13843. Blight's rewrite adds a bug with ENTER in qemu, waiting on his fix. Modified: branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb_cli.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/iomgr.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/kthread.c _____ Modified: branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb_cli.c --- branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb_cli.c 2005-03-06 00:20:32 UTC (rev 13843) +++ branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb_cli.c 2005-03-06 00:50:48 UTC (rev 13844) @@ -873,7 +873,8 @@ PEPROCESS Process = NULL; PULONG Esp; PULONG Ebp; - ULONG Eip, ul; + ULONG Eip; + ULONG ul = 0; PCHAR State, pend, str1, str2; STATIC CONST PCHAR ThreadStateToString[THREAD_STATE_MAX] = { "Initialized", "Ready", "Running", @@ -1224,14 +1225,15 @@ } KdbpPrint("IDT Base: 0x%08x Limit: 0x%04x\n", Reg.Base, Reg.Limit); KdbpPrint(" Idx Type Seg. Sel. Offset DPL\n"); - for ( ; (i + sizeof(SegDesc) - 1) <= Reg.Limit; i += 8) + for (i = 0; (i + sizeof(SegDesc) - 1) <= Reg.Limit; i += 8) { if (!NT_SUCCESS(KdbpSafeReadMemory(SegDesc, (PVOID)(Reg.Base + i), sizeof(SegDesc)))) { KdbpPrint("Couldn't access memory at 0x%08x!\n", Reg.Base + i); return TRUE; } - + + Dpl = ((SegDesc[1] >> 13) & 3); if ((SegDesc[1] & 0x1f00) == 0x0500) /* Task gate */ SegType = "TASKGATE"; else if ((SegDesc[1] & 0x1fe0) == 0x0e00) /* 32 bit Interrupt gate */ @@ -1242,6 +1244,8 @@ SegType = "TRAPGATE32"; else if ((SegDesc[1] & 0x1fe0) == 0x0700) /* 16 bit Trap gate */ SegType = "TRAPGATE16"; + else + SegType = "UNKNOWN"; if ((SegDesc[1] & (1 << 15)) == 0) /* not present */ { @@ -1432,7 +1436,7 @@ " InterruptMode: 0x%08x\n", Pcr->Tib.ExceptionList, Pcr->Tib.StackBase, Pcr->Tib.StackLimit, Pcr->Tib.SubSystemTib, Pcr->Tib.FiberData, Pcr->Tib.ArbitraryUserPointer, - Pcr->Tib.Self, Pcr->Self, Pcr->PCRCB, Pcr->Irql, Pcr->IRR, Pcr->IrrActive, + Pcr->Tib.Self, Pcr->Self, Pcr->Prcb, Pcr->Irql, Pcr->IRR, Pcr->IrrActive, Pcr->IDR, Pcr->KdVersionBlock, Pcr->IDT, Pcr->GDT, Pcr->TSS, Pcr->MajorVersion, Pcr->MinorVersion, Pcr->SetMember, Pcr->StallScaleFactor, Pcr->DebugActive, Pcr->ProcessorNumber, Pcr->L2CacheAssociativity, @@ -1673,7 +1677,7 @@ STATIC CHAR Buffer[4096]; STATIC BOOLEAN TerminalInitialized = FALSE; STATIC BOOLEAN TerminalReportsSize = TRUE; - CHAR c; + CHAR c = '\0'; PCHAR p; INT Length; INT i; _____ Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/iomgr.c --- branches/alex_devel_branch/reactos/ntoskrnl/io/iomgr.c 2005-03-06 00:20:32 UTC (rev 13843) +++ branches/alex_devel_branch/reactos/ntoskrnl/io/iomgr.c 2005-03-06 00:50:48 UTC (rev 13844) @@ -11,7 +11,7 @@ /* INCLUDES ****************************************************************/ #include <ntoskrnl.h> -#include <internal/kdb.h> +#include "../dbg/kdb.h" #define NDEBUG #include <internal/debug.h> _____ Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/kthread.c --- branches/alex_devel_branch/reactos/ntoskrnl/ke/kthread.c 2005-03-06 00:20:32 UTC (rev 13843) +++ branches/alex_devel_branch/reactos/ntoskrnl/ke/kthread.c 2005-03-06 00:50:48 UTC (rev 13844) @@ -251,7 +251,7 @@ Thread->ApcStatePointer[AttachedApcEnvironment] = &Thread->SavedApcState; Thread->ApcStateIndex = OriginalApcEnvironment; Thread->ApcQueueable = TRUE; - RtlZeroMemory(&Thread->SavedApcState, 0, sizeof(KAPC_STATE)); + RtlZeroMemory(&Thread->SavedApcState, sizeof(KAPC_STATE)); KeInitializeSpinLock(&Thread->ApcQueueLock); /* Setup Wait Fields */ @@ -263,8 +263,8 @@ Thread->WaitListEntry.Blink = NULL; Thread->WaitTime = 0; Thread->WaitBlockList = NULL; - RtlZeroMemory(Thread->WaitBlock, 0, sizeof(KWAIT_BLOCK) * 4); - RtlZeroMemory(&Thread->Timer, 0, sizeof(KTIMER)); + RtlZeroMemory(Thread->WaitBlock, sizeof(KWAIT_BLOCK) * 4); + RtlZeroMemory(&Thread->Timer, sizeof(KTIMER)); KeInitializeTimer(&Thread->Timer); /* Setup scheduler Fields */
19 years, 9 months
1
0
0
0
[blight] 13843: Fix build with optimizations and one or two bugs - should have tested with optimizations before committing :-/
by blight@svn.reactos.com
Fix build with optimizations and one or two bugs - should have tested with optimizations before committing :-/ Modified: trunk/reactos/ntoskrnl/dbg/kdb_cli.c _____ Modified: trunk/reactos/ntoskrnl/dbg/kdb_cli.c --- trunk/reactos/ntoskrnl/dbg/kdb_cli.c 2005-03-05 23:58:25 UTC (rev 13842) +++ trunk/reactos/ntoskrnl/dbg/kdb_cli.c 2005-03-06 00:20:32 UTC (rev 13843) @@ -873,7 +873,8 @@ PEPROCESS Process = NULL; PULONG Esp; PULONG Ebp; - ULONG Eip, ul; + ULONG Eip; + ULONG ul = 0; PCHAR State, pend, str1, str2; STATIC CONST PCHAR ThreadStateToString[THREAD_STATE_MAX] = { "Initialized", "Ready", "Running", @@ -1224,14 +1225,15 @@ } KdbpPrint("IDT Base: 0x%08x Limit: 0x%04x\n", Reg.Base, Reg.Limit); KdbpPrint(" Idx Type Seg. Sel. Offset DPL\n"); - for ( ; (i + sizeof(SegDesc) - 1) <= Reg.Limit; i += 8) + for (i = 0; (i + sizeof(SegDesc) - 1) <= Reg.Limit; i += 8) { if (!NT_SUCCESS(KdbpSafeReadMemory(SegDesc, (PVOID)(Reg.Base + i), sizeof(SegDesc)))) { KdbpPrint("Couldn't access memory at 0x%08x!\n", Reg.Base + i); return TRUE; } - + + Dpl = ((SegDesc[1] >> 13) & 3); if ((SegDesc[1] & 0x1f00) == 0x0500) /* Task gate */ SegType = "TASKGATE"; else if ((SegDesc[1] & 0x1fe0) == 0x0e00) /* 32 bit Interrupt gate */ @@ -1242,6 +1244,8 @@ SegType = "TRAPGATE32"; else if ((SegDesc[1] & 0x1fe0) == 0x0700) /* 16 bit Trap gate */ SegType = "TRAPGATE16"; + else + SegType = "UNKNOWN"; if ((SegDesc[1] & (1 << 15)) == 0) /* not present */ { @@ -1673,7 +1677,7 @@ STATIC CHAR Buffer[4096]; STATIC BOOLEAN TerminalInitialized = FALSE; STATIC BOOLEAN TerminalReportsSize = TRUE; - CHAR c; + CHAR c = '\0'; PCHAR p; INT Length; INT i;
19 years, 9 months
1
0
0
0
[ion] 13842: Merge with blight's rewrite
by ion@svn.reactos.com
Merge with blight's rewrite Modified: branches/alex_devel_branch/reactos/Makefile Modified: branches/alex_devel_branch/reactos/drivers/input/keyboard/keyboard.c Added: branches/alex_devel_branch/reactos/media/drivers/etc/KDB.init Modified: branches/alex_devel_branch/reactos/ntoskrnl/Makefile Modified: branches/alex_devel_branch/reactos/ntoskrnl/dbg/i386/i386-dis.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/dbg/i386/kdb_help.S Added: branches/alex_devel_branch/reactos/ntoskrnl/dbg/i386/longjmp.S Added: branches/alex_devel_branch/reactos/ntoskrnl/dbg/i386/setjmp.S Modified: branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb.h Added: branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb_cli.c Added: branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb_expr.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb_keyboard.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb_serial.c Added: branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb_string.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb_symbols.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/include/internal/i386/ke.h Modified: branches/alex_devel_branch/reactos/ntoskrnl/include/internal/kd.h Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/iomgr.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/catch.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/i386/trap.s Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/i386/tskswitch.S Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/kthread.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/main.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/ps/w32call.c _____ Modified: branches/alex_devel_branch/reactos/Makefile --- branches/alex_devel_branch/reactos/Makefile 2005-03-05 23:35:08 UTC (rev 13841) +++ branches/alex_devel_branch/reactos/Makefile 2005-03-05 23:58:25 UTC (rev 13842) @@ -216,6 +216,8 @@ $(CP) media/nls/l_intl.nls $(BOOTCD_DIR)/reactos/l_intl.nls $(HALFVERBOSEECHO) [COPY] media/drivers/etc/services to $(BOOTCD_DIR)/reactos/services $(CP) media/drivers/etc/services $(BOOTCD_DIR)/reactos/services + $(HALFVERBOSEECHO) [COPY] media/drivers/etc/KDB.init to $(BOOTCD_DIR)/reactos/KDB.init + $(CP) media/drivers/etc/KDB.init $(BOOTCD_DIR)/reactos/KDB.init bootcd_basic: bootcd_directory_layout bootcd_bootstrap_files bootcd_install_before @@ -1043,6 +1045,8 @@ $(CP) media/nls/l_intl.nls $(INSTALL_DIR)/system32/casemap.nls $(HALFVERBOSEECHO) [INSTALL] media/drivers/etc/services to $(INSTALL_DIR)/system32/drivers/etc/services $(CP) media/drivers/etc/services $(INSTALL_DIR)/system32/drivers/etc/services + $(HALFVERBOSEECHO) [INSTALL] media/drivers/etc/KDB.init to $(INSTALL_DIR)/system32/drivers/etc/KDB.init + $(CP) media/drivers/etc/KDB.init $(INSTALL_DIR)/system32/drivers/etc/KDB.init .PHONY: install_clean install_dirs install_before _____ Modified: branches/alex_devel_branch/reactos/drivers/input/keyboard/keyboard.c --- branches/alex_devel_branch/reactos/drivers/input/keyboard/keyboard.c 2005-03-05 23:35:08 UTC (rev 13841) +++ branches/alex_devel_branch/reactos/drivers/input/keyboard/keyboard.c 2005-03-05 23:58:25 UTC (rev 13842) @@ -38,6 +38,7 @@ static DWORD ctrlKeyState; static PKINTERRUPT KbdInterrupt; static KDPC KbdDpc; +static PIO_WORKITEM KbdWorkItem = NULL; static BOOLEAN AlreadyOpened = FALSE; /* @@ -408,6 +409,24 @@ /* + * Debug request handler + */ + +static VOID STDCALL +KbdWorkItemRoutine(IN PDEVICE_OBJECT DeviceObject, + IN PVOID Context) +{ + LONG Debug; + + Debug = InterlockedExchange(&DoSystemDebug, -1); + if (Debug != -1) + { + KdSystemDebugControl(Debug); + } +} + + +/* * Keyboard IRQ handler */ @@ -419,14 +438,21 @@ { PIRP Irp = (PIRP)SystemArgument2; PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)SystemArgument1; - + if (SystemArgument1 == NULL && DoSystemDebug != -1) { - KdSystemDebugControl(DoSystemDebug); - DoSystemDebug = -1; + if (KbdWorkItem != NULL) + { + IoQueueWorkItem(KbdWorkItem, (PIO_WORKITEM_ROUTINE)KbdWorkItemRoutine, DelayedWorkQueue, NULL); + } + else + { + KdSystemDebugControl(DoSystemDebug); + DoSystemDebug = -1; + } return; } - + CHECKPOINT; DPRINT("KbdDpcRoutine(DeviceObject %x, Irp %x)\n", DeviceObject,Irp); @@ -436,6 +462,7 @@ IoStartNextPacket(DeviceObject,FALSE); } + static BOOLEAN STDCALL KeyboardHandler(PKINTERRUPT Interrupt, PVOID Context) @@ -538,7 +565,7 @@ else if (InSysRq == TRUE && ScanToVirtual(thisKey) >= VK_A && ScanToVirtual(thisKey) <= VK_Z && isDown) { - DoSystemDebug = ScanToVirtual(thisKey) - VK_A; + InterlockedExchange(&DoSystemDebug, ScanToVirtual(thisKey) - VK_A); KeInsertQueueDpc(&KbdDpc, NULL, NULL); return(TRUE); } @@ -659,6 +686,11 @@ KbdClearInput(); KeyboardConnectInterrupt(DeviceObject); KeInitializeDpc(&KbdDpc,KbdDpcRoutine,NULL); + KbdWorkItem = IoAllocateWorkItem(DeviceObject); + if (KbdWorkItem == NULL) + { + DPRINT("Warning: Couldn't allocate work item!\n"); + } return 0; } _____ Copied: branches/alex_devel_branch/reactos/media/drivers/etc/KDB.init (from rev 13841, trunk/reactos/media/drivers/etc/KDB.init) _____ Modified: branches/alex_devel_branch/reactos/ntoskrnl/Makefile --- branches/alex_devel_branch/reactos/ntoskrnl/Makefile 2005-03-05 23:35:08 UTC (rev 13841) +++ branches/alex_devel_branch/reactos/ntoskrnl/Makefile 2005-03-05 23:58:25 UTC (rev 13842) @@ -25,14 +25,10 @@ STRIP_FLAGS := -Wl,-s ifeq ($(KDBG), 1) -OBJECTS_KDBG := dbg/kdb.o dbg/kdb_serial.o dbg/kdb_keyboard.o dbg/rdebug.o \ - dbg/i386/kdb_help.o \ - ../dk/w32/lib/libkjs.a dbg/i386/i386-dis.o -CFLAGS_KDBG := -I../lib/kjs/include +OBJECTS_KDBG := dbg/kdb.o dbg/kdb_cli.o dbg/kdb_expr.o dbg/kdb_keyboard.o \ + dbg/kdb_serial.o dbg/kdb_string.o dbg/rdebug.o dbg/i386/kdb_help.o \ + dbg/i386/i386-dis.o dbg/i386/longjmp.o dbg/i386/setjmp.o preall: all - -../dk/w32/lib/libkjs.a: - $(MAKE) -C ../lib/kjs else OBJECTS_KDBG := endif _____ Modified: branches/alex_devel_branch/reactos/ntoskrnl/dbg/i386/i386-dis.c --- branches/alex_devel_branch/reactos/ntoskrnl/dbg/i386/i386-dis.c 2005-03-05 23:35:08 UTC (rev 13841) +++ branches/alex_devel_branch/reactos/ntoskrnl/dbg/i386/i386-dis.c 2005-03-05 23:58:25 UTC (rev 13842) @@ -1,4 +1,4 @@ -/* $Id:$ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -52,10 +52,10 @@ int -print_insn_i386_att (bfd_vma pc, struct disassemble_info *info); +print_insn_i386 (bfd_vma pc, struct disassemble_info *info); int -KdbPrintDisasm(void* Ignored, const char* fmt, ...) +KdbpPrintDisasm(void* Ignored, const char* fmt, ...) { va_list ap; static char buffer[256]; @@ -69,46 +69,46 @@ } int -KdbNopPrintDisasm(void* Ignored, const char* fmt, ...) +KdbpNopPrintDisasm(void* Ignored, const char* fmt, ...) { return(0); } int static -KdbReadMemory(unsigned int Addr, unsigned char* Data, unsigned int Length, - struct disassemble_info * Ignored) +KdbpReadMemory(unsigned int Addr, unsigned char* Data, unsigned int Length, + struct disassemble_info * Ignored) { return KdbpSafeReadMemory(Data, (void *)Addr, Length); /* 0 means no error */ } void static -KdbMemoryError(int Status, unsigned int Addr, - struct disassemble_info * Ignored) +KdbpMemoryError(int Status, unsigned int Addr, + struct disassemble_info * Ignored) { } void static -KdbPrintAddressInCode(unsigned int Addr, struct disassemble_info * Ignored) +KdbpPrintAddressInCode(unsigned int Addr, struct disassemble_info * Ignored) { if (!KdbSymPrintAddress((void*)Addr)) { - DbgPrint("<0x%X>", Addr); + DbgPrint("<%08x>", Addr); } } void static -KdbNopPrintAddress(unsigned int Addr, struct disassemble_info * Ignored) +KdbpNopPrintAddress(unsigned int Addr, struct disassemble_info * Ignored) { } #include "dis-asm.h" long -KdbGetInstLength(unsigned int Address) +KdbpGetInstLength(unsigned int Address) { disassemble_info info; - info.fprintf_func = KdbNopPrintDisasm; + info.fprintf_func = KdbpNopPrintDisasm; info.stream = NULL; info.application_data = NULL; info.flavour = bfd_target_unknown_flavour; @@ -116,9 +116,9 @@ info.mach = bfd_mach_i386_i386; info.insn_sets = 0; info.flags = 0; - info.read_memory_func = KdbReadMemory; - info.memory_error_func = KdbMemoryError; - info.print_address_func = KdbNopPrintAddress; + info.read_memory_func = KdbpReadMemory; + info.memory_error_func = KdbpMemoryError; + info.print_address_func = KdbpNopPrintAddress; info.symbol_at_address_func = NULL; info.buffer = NULL; info.buffer_vma = info.buffer_length = 0; @@ -126,25 +126,25 @@ info.display_endian = BIG_ENDIAN_LITTLE; info.disassembler_options = NULL; - return(print_insn_i386_att(Address, &info)); + return(print_insn_i386(Address, &info)); } long -KdbDisassemble(unsigned int Address) +KdbpDisassemble(unsigned int Address, unsigned long IntelSyntax) { disassemble_info info; - info.fprintf_func = KdbPrintDisasm; + info.fprintf_func = KdbpPrintDisasm; info.stream = NULL; info.application_data = NULL; info.flavour = bfd_target_unknown_flavour; info.arch = bfd_arch_i386; - info.mach = bfd_mach_i386_i386; + info.mach = IntelSyntax ? bfd_mach_i386_i386_intel_syntax : bfd_mach_i386_i386; info.insn_sets = 0; info.flags = 0; - info.read_memory_func = KdbReadMemory; - info.memory_error_func = KdbMemoryError; - info.print_address_func = KdbPrintAddressInCode; + info.read_memory_func = KdbpReadMemory; + info.memory_error_func = KdbpMemoryError; + info.print_address_func = KdbpPrintAddressInCode; info.symbol_at_address_func = NULL; info.buffer = NULL; info.buffer_vma = info.buffer_length = 0; @@ -152,7 +152,7 @@ info.display_endian = BIG_ENDIAN_LITTLE; info.disassembler_options = NULL; - return(print_insn_i386_att(Address, &info)); + return(print_insn_i386(Address, &info)); } /* Print i386 instructions for GDB, the GNU debugger. @@ -2113,7 +2113,7 @@ #else mode_64bit = 0; priv.orig_sizeflag = AFLAG | DFLAG; - intel_syntax = 0; + /*intel_syntax = 0;*/ #endif if (intel_syntax) _____ Modified: branches/alex_devel_branch/reactos/ntoskrnl/dbg/i386/kdb_help.S --- branches/alex_devel_branch/reactos/ntoskrnl/dbg/i386/kdb_help.S 2005-03-05 23:35:08 UTC (rev 13841) +++ branches/alex_devel_branch/reactos/ntoskrnl/dbg/i386/kdb_help.S 2005-03-05 23:58:25 UTC (rev 13842) @@ -1,29 +1,19 @@ #include <internal/ke.h> #include <internal/i386/segment.h> - .data -_KdbEipTemp: - .int 0 +.text - .text -.globl _KdbEnter +.globl _KdbEnter _KdbEnter: /* - * Record when we are inside the debugger. - */ - incl _KdbEntryCount - - /* - * Save the callers eip. - */ - popl _KdbEipTemp - - /* * Set up a trap frame */ + /* Ss - space already reserved by return EIP */ + pushl %esp /* Esp */ pushfl /* Eflags */ pushl %cs /* Cs */ - pushl _KdbEipTemp /* Eip */ + pushl 12(%esp) /* Eip */ + movl %ss, 16(%esp) /* Save Ss */ pushl $0 /* ErrorCode */ pushl %ebp /* Ebp */ pushl %ebx /* Ebx */ @@ -56,34 +46,35 @@ pushl $0 /* TempEip */ pushl $0 /* TempCs */ pushl $0 /* DebugPointer */ - pushl $0 /* DebugArgMark */ - pushl _KdbEipTemp /* DebugEip */ + pushl $3 /* DebugArgMark (Exception number) */ + pushl 0x60(%esp) /* DebugEip */ pushl %ebp /* DebugEbp */ /* - * Push a pointer to the trap frame - */ - pushl %esp - - /* * Call KDB */ - call _KdbInternalEnter + movl %esp, %eax + pushl $1 /* FirstChance */ + pushl %eax /* Push a pointer to the trap frame */ + pushl $0 /* Context */ + pushl $0 /* PreviousMode (KernelMode) */ + pushl $0 /* ExceptionRecord */ + call _KdbEnterDebuggerException /* - * Pop the argument + * Pop the arguments and unused portions of the trap frame: + * DebugEbp + * DebugEip + * DebugArgMark + * DebugPointer + * TempCs + * TempEip */ - popl %eax + addl $(11*4), %esp /* - * Ignore unused portions of the trap frame. + * Restore/update debugging registers. */ - popl %eax /* DebugEbp */ - popl %eax /* DebugEip */ - popl %eax /* DebugArgMark */ - popl %eax /* DebugPointer */ - popl %eax /* TempCs */ - popl %eax /* TempEip */ popl %eax /* Dr0 */ movl %eax, %dr0 popl %eax /* Dr1 */ @@ -113,19 +104,44 @@ popl %edi /* Edi */ popl %esi /* Esi */ popl %ebx /* Ebx */ + + /* Remove SS:ESP from the stack */ + movl 16(%esp), %ebp + movl %ebp, 24(%esp) + movl 12(%esp), %ebp + movl %ebp, 20(%esp) + movl 8(%esp), %ebp + movl %ebp, 16(%esp) + popl %ebp /* Ebp */ - addl $4, %esp /* ErrorCode */ + addl $12, %esp /* ErrorCode and SS:ESP */ /* - * Record when we are in the debugger. - */ - decl _KdbEntryCount - - /* * Return to the caller. */ iret +.globl _KdbpStackSwitchAndCall@8 +_KdbpStackSwitchAndCall@8: + pushl %ebp + movl %esp, %ebp + + movl 0x8(%esp), %eax /* New stack */ + movl 0xC(%esp), %ecx /* Function to call */ + movl %esp, %edx /* Old stack */ - + /* Switch stack */ + movl %eax, %esp + pushl %edx + + /* Call function */ + call *%ecx + + /* Switch back to old stack */ + popl %esp + + /* Return */ + popl %ebp + ret $8 + _____ Copied: branches/alex_devel_branch/reactos/ntoskrnl/dbg/i386/longjmp.S (from rev 13841, trunk/reactos/ntoskrnl/dbg/i386/longjmp.S) _____ Copied: branches/alex_devel_branch/reactos/ntoskrnl/dbg/i386/setjmp.S (from rev 13841, trunk/reactos/ntoskrnl/dbg/i386/setjmp.S) _____ Modified: branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb.c --- branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb.c 2005-03-05 23:35:08 UTC (rev 13841) +++ branches/alex_devel_branch/reactos/ntoskrnl/dbg/kdb.c 2005-03-05 23:58:25 UTC (rev 13842) @@ -12,1786 +12,1495 @@ #include <ntoskrnl.h> #include "kdb.h" -#include "kjs.h" #define NDEBUG #include <internal/debug.h> /* TYPES *********************************************************************/ -/* GLOBALS *******************************************************************/ +/* DEFINES *******************************************************************/ -#define BS 8 -#define DEL 127 +#define KDB_STACK_SIZE (4096*3) +#define KDB_MAXIMUM_BREAKPOINT_COUNT 256 +#define KDB_MAXIMUM_HW_BREAKPOINT_COUNT 4 +#define KDB_MAXIMUM_SW_BREAKPOINT_COUNT 256 -BOOL KbdEchoOn = TRUE; +#define __STRING(x) #x +#define _STRING(x) __STRING(x) -typedef struct -{ - BOOLEAN Enabled; - BOOLEAN Temporary; - BOOLEAN Assigned; - ULONG Address; - UCHAR SavedInst; -} KDB_ACTIVE_BREAKPOINT; +/* GLOBALS *******************************************************************/ -#define KDB_MAXIMUM_BREAKPOINT_COUNT (255) +STATIC LONG KdbEntryCount = 0; +STATIC CHAR KdbStack[KDB_STACK_SIZE]; -static ULONG KdbBreakPointCount = 0; -static KDB_ACTIVE_BREAKPOINT - KdbActiveBreakPoints[KDB_MAXIMUM_BREAKPOINT_COUNT]; +STATIC ULONG KdbBreakPointCount = 0; /* Number of used breakpoints in the array */ +STATIC KDB_BREAKPOINT KdbBreakPoints[KDB_MAXIMUM_BREAKPOINT_COUNT] = {{0}}; /* Breakpoint array */ +STATIC ULONG KdbSwBreakPointCount = 0; /* Number of enabled software breakpoints */ +STATIC ULONG KdbHwBreakPointCount = 0; /* Number of enabled hardware breakpoints */ +STATIC PKDB_BREAKPOINT KdbSwBreakPoints[KDB_MAXIMUM_SW_BREAKPOINT_COUNT]; /* Enabled software breakpoints, orderless */ +STATIC PKDB_BREAKPOINT KdbHwBreakPoints[KDB_MAXIMUM_HW_BREAKPOINT_COUNT]; /* Enabled hardware breakpoints, orderless */ +STATIC PKDB_BREAKPOINT KdbBreakPointToReenable = NULL; /* Set to a breakpoint struct when single stepping after + a software breakpoint was hit, to reenable it */ +LONG KdbLastBreakPointNr = -1; /* Index of the breakpoint which cause KDB to be entered */ +ULONG KdbNumSingleSteps = 0; /* How many single steps to do */ +BOOLEAN KdbSingleStepOver = FALSE; /* Whether to step over calls/reps. */ -static BOOLEAN KdbHandleUmode = FALSE; -static BOOLEAN KdbHandleHandled = FALSE; -static BOOLEAN KdbBreakOnModuleLoad = FALSE; +STATIC BOOLEAN KdbEnteredOnSingleStep = FALSE; /* Set to true when KDB was entered because of single step */ +PEPROCESS KdbCurrentProcess = NULL; /* The current process context in which KDB runs */ +PEPROCESS KdbOriginalProcess = NULL; /* The process in whichs context KDB was intered */ +PETHREAD KdbCurrentThread = NULL; /* The current thread context in which KDB runs */ +PETHREAD KdbOriginalThread = NULL; /* The thread in whichs context KDB was entered */ +PKDB_KTRAP_FRAME KdbCurrentTrapFrame = NULL; /* Pointer to the current trapframe */ +STATIC KDB_KTRAP_FRAME KdbTrapFrame = { { 0 } }; /* The trapframe which was passed to KdbEnterDebuggerException */ +STATIC KDB_KTRAP_FRAME KdbThreadTrapFrame = { { 0 } }; /* The trapframe of the current thread (KdbCurrentThread) */ +STATIC KAPC_STATE KdbApcState; -static BOOLEAN KdbIgnoreNextSingleStep = FALSE; -static ULONG KdbLastSingleStepFrom = 0xFFFFFFFF; -static BOOLEAN KdbEnteredOnSingleStep = FALSE; - -ULONG KdbEntryCount = 0; - -int isalpha( int ); -VOID -PsDumpThreads(BOOLEAN System); -ULONG -DbgContCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgStopCondition(ULONG Aargc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgModuleLoadedAction(ULONG Aargc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgEchoToggle(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgRegsCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgDRegsCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgCRegsCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgBugCheckCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgBackTraceCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgAddrCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgXCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgScriptCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgThreadListCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgProcessListCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgProcessHelpCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgShowFilesCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgEnableFileCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgDisableFileCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgDisassemble(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgSetBreakPoint(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgDeleteBreakPoint(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgSetMemoryBreakPoint(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgStep(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgStepOver(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgFinish(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); - -struct +/* Array of conditions when to enter KDB */ +STATIC KDB_ENTER_CONDITION KdbEnterConditions[][2] = { - PCH Name; - PCH Syntax; - PCH Help; - ULONG (*Fn)(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -} DebuggerCommands[] = { - {"cont", "cont", "Exit the debugger", DbgContCommand}, - {"echo", "echo", "Toggle serial echo", DbgEchoToggle}, - {"condition", "condition [all|umode|kmode]", "Kdbg enter condition", DbgStopCondition}, - {"module-loaded", "module-loaded [break|continue]", "Module-loaded action", DbgModuleLoadedAction}, + /* First chance Last chance */ + { KdbDoNotEnter, KdbEnterFromKmode }, /* Zero devide */ + { KdbEnterAlways, KdbDoNotEnter }, /* Debug trap */ + { KdbDoNotEnter, KdbEnterAlways }, /* NMI */ + { KdbEnterFromKmode, KdbDoNotEnter }, /* INT3 */ + { KdbDoNotEnter, KdbEnterFromKmode }, /* Overflow */ + { KdbDoNotEnter, KdbEnterFromKmode }, + { KdbDoNotEnter, KdbEnterFromKmode }, /* Invalid opcode */ + { KdbDoNotEnter, KdbEnterFromKmode }, /* No math coprocessor fault */ + { KdbEnterAlways, KdbEnterAlways }, + { KdbEnterAlways, KdbEnterAlways }, + { KdbDoNotEnter, KdbEnterFromKmode }, + { KdbDoNotEnter, KdbEnterFromKmode }, + { KdbDoNotEnter, KdbEnterFromKmode }, /* Stack fault */ + { KdbDoNotEnter, KdbEnterFromKmode }, /* General protection fault */ + { KdbDoNotEnter, KdbEnterFromKmode }, /* Page fault */ + { KdbEnterAlways, KdbEnterAlways }, /* Reserved (15) */ + { KdbDoNotEnter, KdbEnterFromKmode }, /* FPU fault */ + { KdbDoNotEnter, KdbEnterFromKmode }, + { KdbDoNotEnter, KdbEnterFromKmode }, + { KdbDoNotEnter, KdbEnterFromKmode }, /* SIMD fault */ + { KdbDoNotEnter, KdbEnterFromKmode } /* Last entry: used for unknown exceptions */ +}; - {"regs", "regs", "Display general purpose registers", DbgRegsCommand}, - {"dregs", "dregs", "Display debug registers", DbgDRegsCommand}, - {"cregs", "cregs", "Display control registers", DbgCRegsCommand}, - {"bugcheck", "bugcheck", "Bugcheck the system", DbgBugCheckCommand}, - {"bt", "bt [*frame-address]|[thread-id]","Do a backtrace", DbgBackTraceCommand}, - {"addr", "addr <address>", "Displays symbol info", DbgAddrCommand}, - {"x", "x <addr> <words>", "Displays <addr> for <words>", DbgXCommand}, - {"plist", "plist", "Display processes in the system", DbgProcessListCommand}, - {"tlist", "tlist [sys]", "Display threads in the system", DbgThreadListCommand}, - {"sfiles", "sfiles", "Show files that print debug prints", DbgShowFilesCommand}, - {"efile", "efile <filename>", "Enable debug prints from file", DbgEnableFileCommand}, - {"dfile", "dfile <filename>", "Disable debug prints from file", DbgDisableFileCommand}, - {"js", "js", "Script mode", DbgScriptCommand}, - {"disasm", "disasm <address>", "Disables 10 instructions at <address> or " - "eip", DbgDisassemble}, - {"bp", "bp <address>", "Sets an int3 breakpoint at a given address", - DbgSetBreakPoint}, - {"bc", "bc <breakpoint number>", "Deletes a breakpoint", - DbgDeleteBreakPoint}, - {"ba", "ba <debug register> <access type> <length> <address>", - "Sets a breakpoint using a debug register", DbgSetMemoryBreakPoint}, - {"t", "t", "Steps forward a single instructions", DbgStep}, - {"p", "p", "Steps forward a single instructions skipping calls", - DbgStepOver}, - {"finish", "finish", "Runs until the current function exits", DbgFinish}, - {"help", "help", "Display help screen", DbgProcessHelpCommand}, - {NULL, NULL, NULL} +/* Exception descriptions */ +STATIC CONST PCHAR ExceptionNrToString[] = +{ + "Divide Error", + "Debug Trap", + "NMI", + "Breakpoint", + "Overflow", + "BOUND range exceeded", + "Invalid Opcode", + "No Math Coprocessor", + "Double Fault", + "Unknown(9)", + "Invalid TSS", + "Segment Not Present", + "Stack Segment Fault", + "General Protection", + "Page Fault", + "Reserved(15)", + "Math Fault", + "Alignment Check", + "Machine Check", + "SIMD Fault" }; -static const char *ExceptionTypeStrings[] = - { - "Divide Error", - "Debug Trap", - "NMI", - "Breakpoint", - "Overflow", - "BOUND range exceeded", - "Invalid Opcode", - "No Math Coprocessor", - "Double Fault", - "Unknown(9)", - "Invalid TSS", - "Segment Not Present", - "Stack Segment Fault", - "General Protection", - "Page Fault", - "Reserved(15)", - "Math Fault", - "Alignment Check", - "Machine Check", - "SIMD Fault" - }; - -volatile DWORD x_dr0 = 0, x_dr1 = 0, x_dr2 = 0, x_dr3 = 0, x_dr7 = 0; - -extern LONG KdbDisassemble(ULONG Address); -extern LONG KdbGetInstLength(ULONG Address); - /* FUNCTIONS *****************************************************************/ -/* - * Convert a string to an unsigned long integer. +/*!\brief Overwrites the instruction at \a Address with \a NewInst and stores + * the old instruction in *OldInst. * - * Ignores `locale' stuff. Assumes that the upper and lower case - * alphabets and digits are each contiguous. + * \param Process Process in which's context to overwrite the instruction. + * \param Address Address at which to overwrite the instruction. + * \param NewInst New instruction (written to \a Address) + * \param OldInst Old instruction (read from \a Address) + * + * \returns NTSTATUS */ -unsigned long -strtoul(const char *nptr, char **endptr, int base) +STATIC NTSTATUS +KdbpOverwriteInstruction( + IN PEPROCESS Process, + IN ULONG_PTR Address, + IN UCHAR NewInst, + OUT PUCHAR OldInst OPTIONAL) { - const char *s = nptr; - unsigned long acc; - int c; - unsigned long cutoff; - int neg = 0, any, cutlim; + NTSTATUS Status; + ULONG Protect; + PEPROCESS CurrentProcess = PsGetCurrentProcess(); + KAPC_STATE ApcState; - /* - * See strtol for comments as to the logic used. - */ - do { - c = *s++; - } while (isspace(c)); - if (c == '-') - { - neg = 1; - c = *s++; - } - else if (c == '+') - c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) - { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; - cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; - for (acc = 0, any = 0;; c = *s++) - { - if (isdigit(c)) - c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) - { - acc = ULONG_MAX; - } - else if (neg) - acc = -acc; - if (endptr != 0) - *endptr = any ? (char *)s - 1 : (char *)nptr; - return acc; -} + /* Get the protection for the address. */ + Protect = MmGetPageProtect(Process, (PVOID)PAGE_ROUND_DOWN(Address)); + + /* Return if that page isn't present. */ + if (Protect & PAGE_NOACCESS) + { + return STATUS_MEMORY_NOT_ALLOCATED; + } + + /* Attach to the process */ + if (CurrentProcess != Process) + { + KeStackAttachProcess(EPROCESS_TO_KPROCESS(Process), &ApcState); + } + /* Make the page writeable if it is read only. */ + if (Protect & (PAGE_READONLY|PAGE_EXECUTE|PAGE_EXECUTE_READ)) + { + MmSetPageProtect(Process, (PVOID)PAGE_ROUND_DOWN(Address), + (Protect & ~(PAGE_READONLY|PAGE_EXECUTE|PAGE_EXECUTE_READ)) | PAGE_READWRITE); + } + + /* Copy the old instruction back to the caller. */ + if (OldInst != NULL) + { + Status = KdbpSafeReadMemory(OldInst, (PUCHAR)Address, 1); + if (!NT_SUCCESS(Status)) + { + if (Protect & (PAGE_READONLY|PAGE_EXECUTE|PAGE_EXECUTE_READ)) + { + MmSetPageProtect(Process, (PVOID)PAGE_ROUND_DOWN(Address), Protect); + } + /* Detach from process */ + if (CurrentProcess != Process) + { + KeDetachProcess(); + } + return Status; + } + } + + /* Copy the new instruction in its place. */ + Status = KdbpSafeWriteMemory((PUCHAR)Address, &NewInst, 1); + + /* Restore the page protection. */ + if (Protect & (PAGE_READONLY|PAGE_EXECUTE|PAGE_EXECUTE_READ)) + { + MmSetPageProtect(Process, (PVOID)PAGE_ROUND_DOWN(Address), Protect); + } + + /* Detach from process */ + if (CurrentProcess != Process) + { + KeUnstackDetachProcess(&ApcState); + } -char* -strpbrk(const char* s, const char* accept) -{ - int i; - for (; (*s) != 0; s++) - { - for (i = 0; accept[i] != 0; i++) - { - if (accept[i] == (*s)) - { - return((char *)s); - } - } - } - return(NULL); + return Status; } - -#if 0 -NTSTATUS -KdbpSafeReadMemory(PVOID dst, PVOID src, INT size) +/*!\brief Checks whether the given instruction can be single stepped or has to be + * stepped over using a temporary breakpoint. + * + * \retval TRUE Instruction is a call. + * \retval FALSE Instruction is not a call. + */ +BOOLEAN +KdbpShouldStepOverInstruction(ULONG_PTR Eip) { - INT page, page_end; - - /* check source */ - page_end = (((ULONG_PTR)src + size) / PAGE_SIZE); - for (page = ((ULONG_PTR)src / PAGE_SIZE); page <= page_end; page++) - { - if (!MmIsPagePresent(NULL, (PVOID)(page * PAGE_SIZE))) - return STATUS_UNSUCCESSFUL; - } + UCHAR Mem[3]; + INT i = 0; - /* copy memory */ - RtlCopyMemory(dst, src, size); - return STATUS_SUCCESS; + if (!NT_SUCCESS(KdbpSafeReadMemory(Mem, (PVOID)Eip, sizeof (Mem)))) + { + KdbpPrint("Couldn't access memory at 0x%x\n", (UINT)Eip); + return FALSE; + } + + /* Check if the current instruction is a call. */ + while ((i < sizeof (Mem)) && (Mem[i] == 0x66 || Mem[i] == 0x67)) + i++; + if (i == sizeof (Mem)) + return FALSE; + if (Mem[i] == 0xE8 || Mem[i] == 0x9A || Mem[i] == 0xF2 || Mem[i] == 0xF3 || + (((i + 1) < sizeof (Mem)) && Mem[i] == 0xFF && (Mem[i+1] & 0x38) == 0x10)) + { + return TRUE; + } + return FALSE; } - -NTSTATUS -KdbpSafeWriteMemory(PVOID dst, PVOID src, INT size) +/*!\brief Steps over an instruction + * + * If the given instruction should be stepped over, this function inserts a + * temporary breakpoint after the instruction and returns TRUE, otherwise it + * returns FALSE. + * + * \retval TRUE Temporary breakpoint set after instruction. + * \retval FALSE No breakpoint was set. + */ +BOOLEAN +KdbpStepOverInstruction(ULONG_PTR Eip) { - return KdbpSafeWriteMemory(dst, src, size); - INT page, page_end; + LONG InstLen; - /* check destination */ - page_end = (((ULONG_PTR)dst + size) / PAGE_SIZE); - for (page = ((ULONG_PTR)dst / PAGE_SIZE); page <= page_end; page++) - { - if (!MmIsPagePresent(NULL, (PVOID)(page * PAGE_SIZE))) - return STATUS_UNSUCCESSFUL; - } + if (!KdbpShouldStepOverInstruction(Eip)) + return FALSE; - /* copy memory */ - RtlCopyMemory(dst, src, size); - return STATUS_SUCCESS; -} -#endif /* unused */ + InstLen = KdbpGetInstLength(Eip); + if (InstLen < 1) + return FALSE; + if (!NT_SUCCESS(KdbpInsertBreakPoint(Eip + InstLen, KdbBreakPointTemporary, 0, 0, NULL, FALSE, NULL))) + return FALSE; -VOID -KdbGetCommand(PCH Buffer) -{ - CHAR Key; - PCH Orig = Buffer; - static CHAR LastCommand[256] = ""; - ULONG ScanCode = 0; - static CHAR LastKey = '\0'; - - KbdEchoOn = !((KdDebugState & KD_DEBUG_KDNOECHO) != 0); - - for (;;) - { - if (KdDebugState & KD_DEBUG_KDSERIAL) - while ((Key = KdbTryGetCharSerial()) == -1); - else - while ((Key = KdbTryGetCharKeyboard(&ScanCode)) == -1); - - if (Key == '\n' && LastKey == '\r') - { - /* Ignore this key... */ - } - else if (Key == '\r' || Key == '\n') - { - DbgPrint("\n"); - /* - Repeat the last command if the user presses enter. Reduces the - risk of RSI when single-stepping. - */ - if (Buffer == Orig) - { - strcpy(Buffer, LastCommand); - } - else - { - *Buffer = 0; - strcpy(LastCommand, Orig); - } - LastKey = Key; - return; - } - else if (Key == BS || Key == DEL) - { - if (Buffer > Orig) - { - Buffer--; - *Buffer = 0; - if (KbdEchoOn) - DbgPrint("%c %c", BS, BS); - else - DbgPrint(" %c", BS); - } - } - else if (ScanCode == 72) - { - ULONG i; - while (Buffer > Orig) - { - Buffer--; - *Buffer = 0; - if (KbdEchoOn) - DbgPrint("%c %c", BS, BS); - else - DbgPrint(" %c", BS); - } - for (i = 0; LastCommand[i] != 0; i++) - { - if (KbdEchoOn) - DbgPrint("%c", LastCommand[i]); - *Buffer = LastCommand[i]; - Buffer++; - } - } - else - { [truncated at 1000 lines; 3359 more skipped]
19 years, 9 months
1
0
0
0
[blight] 13841: Little KDB update ; -) If you have any problems and/or questions let me know. I hope it was tested enough and works well enough for everybody.
by blight@svn.reactos.com
Little KDB update ;-) If you have any problems and/or questions let me know. I hope it was tested enough and works well enough for everybody. Modified: trunk/reactos/Makefile Modified: trunk/reactos/drivers/input/keyboard/keyboard.c Added: trunk/reactos/media/drivers/etc/KDB.init Modified: trunk/reactos/ntoskrnl/Makefile Modified: trunk/reactos/ntoskrnl/dbg/i386/i386-dis.c Modified: trunk/reactos/ntoskrnl/dbg/i386/kdb_help.S Added: trunk/reactos/ntoskrnl/dbg/i386/longjmp.S Added: trunk/reactos/ntoskrnl/dbg/i386/setjmp.S Modified: trunk/reactos/ntoskrnl/dbg/kdb.c Modified: trunk/reactos/ntoskrnl/dbg/kdb.h Added: trunk/reactos/ntoskrnl/dbg/kdb_cli.c Added: trunk/reactos/ntoskrnl/dbg/kdb_expr.c Modified: trunk/reactos/ntoskrnl/dbg/kdb_keyboard.c Modified: trunk/reactos/ntoskrnl/dbg/kdb_serial.c Added: trunk/reactos/ntoskrnl/dbg/kdb_string.c Modified: trunk/reactos/ntoskrnl/dbg/kdb_symbols.c Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h Modified: trunk/reactos/ntoskrnl/include/internal/kd.h Modified: trunk/reactos/ntoskrnl/ke/catch.c Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s Modified: trunk/reactos/ntoskrnl/ke/i386/tskswitch.S Modified: trunk/reactos/ntoskrnl/ke/kthread.c Modified: trunk/reactos/ntoskrnl/ke/main.c Modified: trunk/reactos/ntoskrnl/ps/w32call.c _____ Modified: trunk/reactos/Makefile --- trunk/reactos/Makefile 2005-03-05 23:22:44 UTC (rev 13840) +++ trunk/reactos/Makefile 2005-03-05 23:35:08 UTC (rev 13841) @@ -216,6 +216,8 @@ $(CP) media/nls/l_intl.nls $(BOOTCD_DIR)/reactos/l_intl.nls $(HALFVERBOSEECHO) [COPY] media/drivers/etc/services to $(BOOTCD_DIR)/reactos/services $(CP) media/drivers/etc/services $(BOOTCD_DIR)/reactos/services + $(HALFVERBOSEECHO) [COPY] media/drivers/etc/KDB.init to $(BOOTCD_DIR)/reactos/KDB.init + $(CP) media/drivers/etc/KDB.init $(BOOTCD_DIR)/reactos/KDB.init bootcd_basic: bootcd_directory_layout bootcd_bootstrap_files bootcd_install_before @@ -1043,6 +1045,8 @@ $(CP) media/nls/l_intl.nls $(INSTALL_DIR)/system32/casemap.nls $(HALFVERBOSEECHO) [INSTALL] media/drivers/etc/services to $(INSTALL_DIR)/system32/drivers/etc/services $(CP) media/drivers/etc/services $(INSTALL_DIR)/system32/drivers/etc/services + $(HALFVERBOSEECHO) [INSTALL] media/drivers/etc/KDB.init to $(INSTALL_DIR)/system32/drivers/etc/KDB.init + $(CP) media/drivers/etc/KDB.init $(INSTALL_DIR)/system32/drivers/etc/KDB.init .PHONY: install_clean install_dirs install_before _____ Modified: trunk/reactos/drivers/input/keyboard/keyboard.c --- trunk/reactos/drivers/input/keyboard/keyboard.c 2005-03-05 23:22:44 UTC (rev 13840) +++ trunk/reactos/drivers/input/keyboard/keyboard.c 2005-03-05 23:35:08 UTC (rev 13841) @@ -38,6 +38,7 @@ static DWORD ctrlKeyState; static PKINTERRUPT KbdInterrupt; static KDPC KbdDpc; +static PIO_WORKITEM KbdWorkItem = NULL; static BOOLEAN AlreadyOpened = FALSE; /* @@ -408,6 +409,24 @@ /* + * Debug request handler + */ + +static VOID STDCALL +KbdWorkItemRoutine(IN PDEVICE_OBJECT DeviceObject, + IN PVOID Context) +{ + LONG Debug; + + Debug = InterlockedExchange(&DoSystemDebug, -1); + if (Debug != -1) + { + KdSystemDebugControl(Debug); + } +} + + +/* * Keyboard IRQ handler */ @@ -419,14 +438,21 @@ { PIRP Irp = (PIRP)SystemArgument2; PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)SystemArgument1; - + if (SystemArgument1 == NULL && DoSystemDebug != -1) { - KdSystemDebugControl(DoSystemDebug); - DoSystemDebug = -1; + if (KbdWorkItem != NULL) + { + IoQueueWorkItem(KbdWorkItem, (PIO_WORKITEM_ROUTINE)KbdWorkItemRoutine, DelayedWorkQueue, NULL); + } + else + { + KdSystemDebugControl(DoSystemDebug); + DoSystemDebug = -1; + } return; } - + CHECKPOINT; DPRINT("KbdDpcRoutine(DeviceObject %x, Irp %x)\n", DeviceObject,Irp); @@ -436,6 +462,7 @@ IoStartNextPacket(DeviceObject,FALSE); } + static BOOLEAN STDCALL KeyboardHandler(PKINTERRUPT Interrupt, PVOID Context) @@ -538,7 +565,7 @@ else if (InSysRq == TRUE && ScanToVirtual(thisKey) >= VK_A && ScanToVirtual(thisKey) <= VK_Z && isDown) { - DoSystemDebug = ScanToVirtual(thisKey) - VK_A; + InterlockedExchange(&DoSystemDebug, ScanToVirtual(thisKey) - VK_A); KeInsertQueueDpc(&KbdDpc, NULL, NULL); return(TRUE); } @@ -659,6 +686,11 @@ KbdClearInput(); KeyboardConnectInterrupt(DeviceObject); KeInitializeDpc(&KbdDpc,KbdDpcRoutine,NULL); + KbdWorkItem = IoAllocateWorkItem(DeviceObject); + if (KbdWorkItem == NULL) + { + DPRINT("Warning: Couldn't allocate work item!\n"); + } return 0; } _____ Added: trunk/reactos/media/drivers/etc/KDB.init --- trunk/reactos/media/drivers/etc/KDB.init 2005-03-05 23:22:44 UTC (rev 13840) +++ trunk/reactos/media/drivers/etc/KDB.init 2005-03-05 23:35:08 UTC (rev 13841) @@ -0,0 +1,15 @@ +# Example KDB.init file +# +# The disassembly flavor is set to "intel" (default is "at&t") and the +# + +# Set the disassembly flavor to "intel" (default is "at&t") +set syntax intel + +# Change the condition to enter KDB on INT3 to "always" (default is "kmode") +set condition INT3 first always + +# This is a special command available only in the KDB.init file - it breaks into +# KDB when it is interpreting the init file at startup. +#break + _____ Modified: trunk/reactos/ntoskrnl/Makefile --- trunk/reactos/ntoskrnl/Makefile 2005-03-05 23:22:44 UTC (rev 13840) +++ trunk/reactos/ntoskrnl/Makefile 2005-03-05 23:35:08 UTC (rev 13841) @@ -25,14 +25,10 @@ STRIP_FLAGS := -Wl,-s ifeq ($(KDBG), 1) -OBJECTS_KDBG := dbg/kdb.o dbg/kdb_serial.o dbg/kdb_keyboard.o dbg/rdebug.o \ - dbg/i386/kdb_help.o \ - ../dk/w32/lib/libkjs.a dbg/i386/i386-dis.o -CFLAGS_KDBG := -I../lib/kjs/include +OBJECTS_KDBG := dbg/kdb.o dbg/kdb_cli.o dbg/kdb_expr.o dbg/kdb_keyboard.o \ + dbg/kdb_serial.o dbg/kdb_string.o dbg/rdebug.o dbg/i386/kdb_help.o \ + dbg/i386/i386-dis.o dbg/i386/longjmp.o dbg/i386/setjmp.o preall: all - -../dk/w32/lib/libkjs.a: - $(MAKE) -C ../lib/kjs else OBJECTS_KDBG := endif _____ Modified: trunk/reactos/ntoskrnl/dbg/i386/i386-dis.c --- trunk/reactos/ntoskrnl/dbg/i386/i386-dis.c 2005-03-05 23:22:44 UTC (rev 13840) +++ trunk/reactos/ntoskrnl/dbg/i386/i386-dis.c 2005-03-05 23:35:08 UTC (rev 13841) @@ -1,4 +1,4 @@ -/* $Id:$ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -52,10 +52,10 @@ int -print_insn_i386_att (bfd_vma pc, struct disassemble_info *info); +print_insn_i386 (bfd_vma pc, struct disassemble_info *info); int -KdbPrintDisasm(void* Ignored, const char* fmt, ...) +KdbpPrintDisasm(void* Ignored, const char* fmt, ...) { va_list ap; static char buffer[256]; @@ -69,46 +69,46 @@ } int -KdbNopPrintDisasm(void* Ignored, const char* fmt, ...) +KdbpNopPrintDisasm(void* Ignored, const char* fmt, ...) { return(0); } int static -KdbReadMemory(unsigned int Addr, unsigned char* Data, unsigned int Length, - struct disassemble_info * Ignored) +KdbpReadMemory(unsigned int Addr, unsigned char* Data, unsigned int Length, + struct disassemble_info * Ignored) { return KdbpSafeReadMemory(Data, (void *)Addr, Length); /* 0 means no error */ } void static -KdbMemoryError(int Status, unsigned int Addr, - struct disassemble_info * Ignored) +KdbpMemoryError(int Status, unsigned int Addr, + struct disassemble_info * Ignored) { } void static -KdbPrintAddressInCode(unsigned int Addr, struct disassemble_info * Ignored) +KdbpPrintAddressInCode(unsigned int Addr, struct disassemble_info * Ignored) { if (!KdbSymPrintAddress((void*)Addr)) { - DbgPrint("<0x%X>", Addr); + DbgPrint("<%08x>", Addr); } } void static -KdbNopPrintAddress(unsigned int Addr, struct disassemble_info * Ignored) +KdbpNopPrintAddress(unsigned int Addr, struct disassemble_info * Ignored) { } #include "dis-asm.h" long -KdbGetInstLength(unsigned int Address) +KdbpGetInstLength(unsigned int Address) { disassemble_info info; - info.fprintf_func = KdbNopPrintDisasm; + info.fprintf_func = KdbpNopPrintDisasm; info.stream = NULL; info.application_data = NULL; info.flavour = bfd_target_unknown_flavour; @@ -116,9 +116,9 @@ info.mach = bfd_mach_i386_i386; info.insn_sets = 0; info.flags = 0; - info.read_memory_func = KdbReadMemory; - info.memory_error_func = KdbMemoryError; - info.print_address_func = KdbNopPrintAddress; + info.read_memory_func = KdbpReadMemory; + info.memory_error_func = KdbpMemoryError; + info.print_address_func = KdbpNopPrintAddress; info.symbol_at_address_func = NULL; info.buffer = NULL; info.buffer_vma = info.buffer_length = 0; @@ -126,25 +126,25 @@ info.display_endian = BIG_ENDIAN_LITTLE; info.disassembler_options = NULL; - return(print_insn_i386_att(Address, &info)); + return(print_insn_i386(Address, &info)); } long -KdbDisassemble(unsigned int Address) +KdbpDisassemble(unsigned int Address, unsigned long IntelSyntax) { disassemble_info info; - info.fprintf_func = KdbPrintDisasm; + info.fprintf_func = KdbpPrintDisasm; info.stream = NULL; info.application_data = NULL; info.flavour = bfd_target_unknown_flavour; info.arch = bfd_arch_i386; - info.mach = bfd_mach_i386_i386; + info.mach = IntelSyntax ? bfd_mach_i386_i386_intel_syntax : bfd_mach_i386_i386; info.insn_sets = 0; info.flags = 0; - info.read_memory_func = KdbReadMemory; - info.memory_error_func = KdbMemoryError; - info.print_address_func = KdbPrintAddressInCode; + info.read_memory_func = KdbpReadMemory; + info.memory_error_func = KdbpMemoryError; + info.print_address_func = KdbpPrintAddressInCode; info.symbol_at_address_func = NULL; info.buffer = NULL; info.buffer_vma = info.buffer_length = 0; @@ -152,7 +152,7 @@ info.display_endian = BIG_ENDIAN_LITTLE; info.disassembler_options = NULL; - return(print_insn_i386_att(Address, &info)); + return(print_insn_i386(Address, &info)); } /* Print i386 instructions for GDB, the GNU debugger. @@ -2113,7 +2113,7 @@ #else mode_64bit = 0; priv.orig_sizeflag = AFLAG | DFLAG; - intel_syntax = 0; + /*intel_syntax = 0;*/ #endif if (intel_syntax) _____ Modified: trunk/reactos/ntoskrnl/dbg/i386/kdb_help.S --- trunk/reactos/ntoskrnl/dbg/i386/kdb_help.S 2005-03-05 23:22:44 UTC (rev 13840) +++ trunk/reactos/ntoskrnl/dbg/i386/kdb_help.S 2005-03-05 23:35:08 UTC (rev 13841) @@ -1,29 +1,19 @@ #include <internal/ke.h> #include <internal/i386/segment.h> - .data -_KdbEipTemp: - .int 0 +.text - .text -.globl _KdbEnter +.globl _KdbEnter _KdbEnter: /* - * Record when we are inside the debugger. - */ - incl _KdbEntryCount - - /* - * Save the callers eip. - */ - popl _KdbEipTemp - - /* * Set up a trap frame */ + /* Ss - space already reserved by return EIP */ + pushl %esp /* Esp */ pushfl /* Eflags */ pushl %cs /* Cs */ - pushl _KdbEipTemp /* Eip */ + pushl 12(%esp) /* Eip */ + movl %ss, 16(%esp) /* Save Ss */ pushl $0 /* ErrorCode */ pushl %ebp /* Ebp */ pushl %ebx /* Ebx */ @@ -56,34 +46,35 @@ pushl $0 /* TempEip */ pushl $0 /* TempCs */ pushl $0 /* DebugPointer */ - pushl $0 /* DebugArgMark */ - pushl _KdbEipTemp /* DebugEip */ + pushl $3 /* DebugArgMark (Exception number) */ + pushl 0x60(%esp) /* DebugEip */ pushl %ebp /* DebugEbp */ /* - * Push a pointer to the trap frame - */ - pushl %esp - - /* * Call KDB */ - call _KdbInternalEnter + movl %esp, %eax + pushl $1 /* FirstChance */ + pushl %eax /* Push a pointer to the trap frame */ + pushl $0 /* Context */ + pushl $0 /* PreviousMode (KernelMode) */ + pushl $0 /* ExceptionRecord */ + call _KdbEnterDebuggerException /* - * Pop the argument + * Pop the arguments and unused portions of the trap frame: + * DebugEbp + * DebugEip + * DebugArgMark + * DebugPointer + * TempCs + * TempEip */ - popl %eax + addl $(11*4), %esp /* - * Ignore unused portions of the trap frame. + * Restore/update debugging registers. */ - popl %eax /* DebugEbp */ - popl %eax /* DebugEip */ - popl %eax /* DebugArgMark */ - popl %eax /* DebugPointer */ - popl %eax /* TempCs */ - popl %eax /* TempEip */ popl %eax /* Dr0 */ movl %eax, %dr0 popl %eax /* Dr1 */ @@ -113,19 +104,44 @@ popl %edi /* Edi */ popl %esi /* Esi */ popl %ebx /* Ebx */ + + /* Remove SS:ESP from the stack */ + movl 16(%esp), %ebp + movl %ebp, 24(%esp) + movl 12(%esp), %ebp + movl %ebp, 20(%esp) + movl 8(%esp), %ebp + movl %ebp, 16(%esp) + popl %ebp /* Ebp */ - addl $4, %esp /* ErrorCode */ + addl $12, %esp /* ErrorCode and SS:ESP */ /* - * Record when we are in the debugger. - */ - decl _KdbEntryCount - - /* * Return to the caller. */ iret +.globl _KdbpStackSwitchAndCall@8 +_KdbpStackSwitchAndCall@8: + pushl %ebp + movl %esp, %ebp + + movl 0x8(%esp), %eax /* New stack */ + movl 0xC(%esp), %ecx /* Function to call */ + movl %esp, %edx /* Old stack */ - + /* Switch stack */ + movl %eax, %esp + pushl %edx + + /* Call function */ + call *%ecx + + /* Switch back to old stack */ + popl %esp + + /* Return */ + popl %ebp + ret $8 + _____ Added: trunk/reactos/ntoskrnl/dbg/i386/longjmp.S --- trunk/reactos/ntoskrnl/dbg/i386/longjmp.S 2005-03-05 23:22:44 UTC (rev 13840) +++ trunk/reactos/ntoskrnl/dbg/i386/longjmp.S 2005-03-05 23:35:08 UTC (rev 13841) @@ -0,0 +1,70 @@ + .file "longjmp.S" +/* + * Copyright (C) 1998, 1999, Jonathan S. Shapiro. + * + * This file is part of the EROS Operating System. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + /* + * typedef struct { + * unsigned long ebx, esi, edi; + * unsigned long ebp; + * unsigned long sp; + * unsigned long pc; + * } jmp_buf[1]; + */ + + /* + * On entry, the stack to longjmp looks like: + * + * value + * ptr to jmp_buf + * return PC + */ + +.globl _longjmp +_longjmp: + pushl %ebp + movl %esp,%ebp + + movl 8(%ebp),%ecx /* address of jmp_buf to ecx */ + movl 12(%ebp),%eax /* return value to %eax */ + testl %eax,%eax + jne 1f + incl %eax /* return 1 if handed 0 */ + +1: + movl (%ecx),%ebx /* restore %ebx */ + movl 4(%ecx),%esi /* restore %esi */ + movl 8(%ecx),%edi /* restore %edi */ + + /* + * From this instant on we are not running in a valid frame + */ + + movl 12(%ecx),%ebp /* restore %ebp */ + movl 16(%ecx),%esp /* restore %esp */ + /* movl 20(%ecx),%eax return PC */ + + /* + * Since we are abandoning the stack in any case, + * there isn't much point in doing the usual return + * discipline. + */ + + jmpl *20(%ecx) + _____ Added: trunk/reactos/ntoskrnl/dbg/i386/setjmp.S --- trunk/reactos/ntoskrnl/dbg/i386/setjmp.S 2005-03-05 23:22:44 UTC (rev 13840) +++ trunk/reactos/ntoskrnl/dbg/i386/setjmp.S 2005-03-05 23:35:08 UTC (rev 13841) @@ -0,0 +1,59 @@ + .file "setjmp.S" +/* + * Copyright (C) 1998, 1999, Jonathan S. Shapiro. + * + * This file is part of the EROS Operating System. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* #include <eros/i486/asm.h> */ + + + /* + * typedef struct { + * unsigned long ebx, esi, edi; + * unsigned long ebp; + * unsigned long sp; + * unsigned long pc; + * } jmp_buf[1]; + */ + + /* + * On entry, the stack to setjmp looks like: + * + * ptr to jmp_buf + * return PC + */ +.globl _setjmp +_setjmp: + pushl %ebp + movl %esp,%ebp + + movl 0x8(%ebp),%eax /* address of jmp_buf to eax */ + movl %ebx,(%eax) /* save %ebx */ + movl %esi,4(%eax) /* save %esi */ + movl %edi,8(%eax) /* save %edi */ + leal 8(%ebp),%edx /* calling proc's esp, not ours! */ + movl %edx,16(%eax) + movl 4(%ebp), %edx /* save return PC */ + movl %edx,20(%eax) + movl 0(%ebp),%edx /* calling proc's ebp, not ours! */ + movl %edx,12(%eax) + + xorl %eax,%eax /* return 0 the first time */ + leave + ret $4 + _____ Modified: trunk/reactos/ntoskrnl/dbg/kdb.c --- trunk/reactos/ntoskrnl/dbg/kdb.c 2005-03-05 23:22:44 UTC (rev 13840) +++ trunk/reactos/ntoskrnl/dbg/kdb.c 2005-03-05 23:35:08 UTC (rev 13841) @@ -12,1786 +12,1495 @@ #include <ntoskrnl.h> #include "kdb.h" -#include "kjs.h" #define NDEBUG #include <internal/debug.h> /* TYPES *********************************************************************/ -/* GLOBALS *******************************************************************/ +/* DEFINES *******************************************************************/ -#define BS 8 -#define DEL 127 +#define KDB_STACK_SIZE (4096*3) +#define KDB_MAXIMUM_BREAKPOINT_COUNT 256 +#define KDB_MAXIMUM_HW_BREAKPOINT_COUNT 4 +#define KDB_MAXIMUM_SW_BREAKPOINT_COUNT 256 -BOOL KbdEchoOn = TRUE; +#define __STRING(x) #x +#define _STRING(x) __STRING(x) -typedef struct -{ - BOOLEAN Enabled; - BOOLEAN Temporary; - BOOLEAN Assigned; - ULONG Address; - UCHAR SavedInst; -} KDB_ACTIVE_BREAKPOINT; +/* GLOBALS *******************************************************************/ -#define KDB_MAXIMUM_BREAKPOINT_COUNT (255) +STATIC LONG KdbEntryCount = 0; +STATIC CHAR KdbStack[KDB_STACK_SIZE]; -static ULONG KdbBreakPointCount = 0; -static KDB_ACTIVE_BREAKPOINT - KdbActiveBreakPoints[KDB_MAXIMUM_BREAKPOINT_COUNT]; +STATIC ULONG KdbBreakPointCount = 0; /* Number of used breakpoints in the array */ +STATIC KDB_BREAKPOINT KdbBreakPoints[KDB_MAXIMUM_BREAKPOINT_COUNT] = {{0}}; /* Breakpoint array */ +STATIC ULONG KdbSwBreakPointCount = 0; /* Number of enabled software breakpoints */ +STATIC ULONG KdbHwBreakPointCount = 0; /* Number of enabled hardware breakpoints */ +STATIC PKDB_BREAKPOINT KdbSwBreakPoints[KDB_MAXIMUM_SW_BREAKPOINT_COUNT]; /* Enabled software breakpoints, orderless */ +STATIC PKDB_BREAKPOINT KdbHwBreakPoints[KDB_MAXIMUM_HW_BREAKPOINT_COUNT]; /* Enabled hardware breakpoints, orderless */ +STATIC PKDB_BREAKPOINT KdbBreakPointToReenable = NULL; /* Set to a breakpoint struct when single stepping after + a software breakpoint was hit, to reenable it */ +LONG KdbLastBreakPointNr = -1; /* Index of the breakpoint which cause KDB to be entered */ +ULONG KdbNumSingleSteps = 0; /* How many single steps to do */ +BOOLEAN KdbSingleStepOver = FALSE; /* Whether to step over calls/reps. */ -static BOOLEAN KdbHandleUmode = FALSE; -static BOOLEAN KdbHandleHandled = FALSE; -static BOOLEAN KdbBreakOnModuleLoad = FALSE; +STATIC BOOLEAN KdbEnteredOnSingleStep = FALSE; /* Set to true when KDB was entered because of single step */ +PEPROCESS KdbCurrentProcess = NULL; /* The current process context in which KDB runs */ +PEPROCESS KdbOriginalProcess = NULL; /* The process in whichs context KDB was intered */ +PETHREAD KdbCurrentThread = NULL; /* The current thread context in which KDB runs */ +PETHREAD KdbOriginalThread = NULL; /* The thread in whichs context KDB was entered */ +PKDB_KTRAP_FRAME KdbCurrentTrapFrame = NULL; /* Pointer to the current trapframe */ +STATIC KDB_KTRAP_FRAME KdbTrapFrame = { { 0 } }; /* The trapframe which was passed to KdbEnterDebuggerException */ +STATIC KDB_KTRAP_FRAME KdbThreadTrapFrame = { { 0 } }; /* The trapframe of the current thread (KdbCurrentThread) */ +STATIC KAPC_STATE KdbApcState; -static BOOLEAN KdbIgnoreNextSingleStep = FALSE; -static ULONG KdbLastSingleStepFrom = 0xFFFFFFFF; -static BOOLEAN KdbEnteredOnSingleStep = FALSE; - -ULONG KdbEntryCount = 0; - -int isalpha( int ); -VOID -PsDumpThreads(BOOLEAN System); -ULONG -DbgContCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgStopCondition(ULONG Aargc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgModuleLoadedAction(ULONG Aargc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgEchoToggle(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgRegsCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgDRegsCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgCRegsCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgBugCheckCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgBackTraceCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgAddrCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgXCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgScriptCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgThreadListCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgProcessListCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgProcessHelpCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgShowFilesCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgEnableFileCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgDisableFileCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgDisassemble(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgSetBreakPoint(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgDeleteBreakPoint(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgSetMemoryBreakPoint(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgStep(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgStepOver(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -ULONG -DbgFinish(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); - -struct +/* Array of conditions when to enter KDB */ +STATIC KDB_ENTER_CONDITION KdbEnterConditions[][2] = { - PCH Name; - PCH Syntax; - PCH Help; - ULONG (*Fn)(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); -} DebuggerCommands[] = { - {"cont", "cont", "Exit the debugger", DbgContCommand}, - {"echo", "echo", "Toggle serial echo", DbgEchoToggle}, - {"condition", "condition [all|umode|kmode]", "Kdbg enter condition", DbgStopCondition}, - {"module-loaded", "module-loaded [break|continue]", "Module-loaded action", DbgModuleLoadedAction}, + /* First chance Last chance */ + { KdbDoNotEnter, KdbEnterFromKmode }, /* Zero devide */ + { KdbEnterAlways, KdbDoNotEnter }, /* Debug trap */ + { KdbDoNotEnter, KdbEnterAlways }, /* NMI */ + { KdbEnterFromKmode, KdbDoNotEnter }, /* INT3 */ + { KdbDoNotEnter, KdbEnterFromKmode }, /* Overflow */ + { KdbDoNotEnter, KdbEnterFromKmode }, + { KdbDoNotEnter, KdbEnterFromKmode }, /* Invalid opcode */ + { KdbDoNotEnter, KdbEnterFromKmode }, /* No math coprocessor fault */ + { KdbEnterAlways, KdbEnterAlways }, + { KdbEnterAlways, KdbEnterAlways }, + { KdbDoNotEnter, KdbEnterFromKmode }, + { KdbDoNotEnter, KdbEnterFromKmode }, + { KdbDoNotEnter, KdbEnterFromKmode }, /* Stack fault */ + { KdbDoNotEnter, KdbEnterFromKmode }, /* General protection fault */ + { KdbDoNotEnter, KdbEnterFromKmode }, /* Page fault */ + { KdbEnterAlways, KdbEnterAlways }, /* Reserved (15) */ + { KdbDoNotEnter, KdbEnterFromKmode }, /* FPU fault */ + { KdbDoNotEnter, KdbEnterFromKmode }, + { KdbDoNotEnter, KdbEnterFromKmode }, + { KdbDoNotEnter, KdbEnterFromKmode }, /* SIMD fault */ + { KdbDoNotEnter, KdbEnterFromKmode } /* Last entry: used for unknown exceptions */ +}; - {"regs", "regs", "Display general purpose registers", DbgRegsCommand}, - {"dregs", "dregs", "Display debug registers", DbgDRegsCommand}, - {"cregs", "cregs", "Display control registers", DbgCRegsCommand}, - {"bugcheck", "bugcheck", "Bugcheck the system", DbgBugCheckCommand}, - {"bt", "bt [*frame-address]|[thread-id]","Do a backtrace", DbgBackTraceCommand}, - {"addr", "addr <address>", "Displays symbol info", DbgAddrCommand}, - {"x", "x <addr> <words>", "Displays <addr> for <words>", DbgXCommand}, - {"plist", "plist", "Display processes in the system", DbgProcessListCommand}, - {"tlist", "tlist [sys]", "Display threads in the system", DbgThreadListCommand}, - {"sfiles", "sfiles", "Show files that print debug prints", DbgShowFilesCommand}, - {"efile", "efile <filename>", "Enable debug prints from file", DbgEnableFileCommand}, - {"dfile", "dfile <filename>", "Disable debug prints from file", DbgDisableFileCommand}, - {"js", "js", "Script mode", DbgScriptCommand}, - {"disasm", "disasm <address>", "Disables 10 instructions at <address> or " - "eip", DbgDisassemble}, - {"bp", "bp <address>", "Sets an int3 breakpoint at a given address", - DbgSetBreakPoint}, - {"bc", "bc <breakpoint number>", "Deletes a breakpoint", - DbgDeleteBreakPoint}, - {"ba", "ba <debug register> <access type> <length> <address>", - "Sets a breakpoint using a debug register", DbgSetMemoryBreakPoint}, - {"t", "t", "Steps forward a single instructions", DbgStep}, - {"p", "p", "Steps forward a single instructions skipping calls", - DbgStepOver}, - {"finish", "finish", "Runs until the current function exits", DbgFinish}, - {"help", "help", "Display help screen", DbgProcessHelpCommand}, - {NULL, NULL, NULL} +/* Exception descriptions */ +STATIC CONST PCHAR ExceptionNrToString[] = +{ + "Divide Error", + "Debug Trap", + "NMI", + "Breakpoint", + "Overflow", + "BOUND range exceeded", + "Invalid Opcode", + "No Math Coprocessor", + "Double Fault", + "Unknown(9)", + "Invalid TSS", + "Segment Not Present", + "Stack Segment Fault", + "General Protection", + "Page Fault", + "Reserved(15)", + "Math Fault", + "Alignment Check", + "Machine Check", + "SIMD Fault" }; -static const char *ExceptionTypeStrings[] = - { - "Divide Error", - "Debug Trap", - "NMI", - "Breakpoint", - "Overflow", - "BOUND range exceeded", - "Invalid Opcode", - "No Math Coprocessor", - "Double Fault", - "Unknown(9)", - "Invalid TSS", - "Segment Not Present", - "Stack Segment Fault", - "General Protection", - "Page Fault", - "Reserved(15)", - "Math Fault", - "Alignment Check", - "Machine Check", - "SIMD Fault" - }; - -volatile DWORD x_dr0 = 0, x_dr1 = 0, x_dr2 = 0, x_dr3 = 0, x_dr7 = 0; - -extern LONG KdbDisassemble(ULONG Address); -extern LONG KdbGetInstLength(ULONG Address); - /* FUNCTIONS *****************************************************************/ -/* - * Convert a string to an unsigned long integer. +/*!\brief Overwrites the instruction at \a Address with \a NewInst and stores + * the old instruction in *OldInst. * - * Ignores `locale' stuff. Assumes that the upper and lower case - * alphabets and digits are each contiguous. + * \param Process Process in which's context to overwrite the instruction. + * \param Address Address at which to overwrite the instruction. + * \param NewInst New instruction (written to \a Address) + * \param OldInst Old instruction (read from \a Address) + * + * \returns NTSTATUS */ -unsigned long -strtoul(const char *nptr, char **endptr, int base) +STATIC NTSTATUS +KdbpOverwriteInstruction( + IN PEPROCESS Process, + IN ULONG_PTR Address, + IN UCHAR NewInst, + OUT PUCHAR OldInst OPTIONAL) { - const char *s = nptr; - unsigned long acc; - int c; - unsigned long cutoff; - int neg = 0, any, cutlim; + NTSTATUS Status; + ULONG Protect; + PEPROCESS CurrentProcess = PsGetCurrentProcess(); + KAPC_STATE ApcState; - /* - * See strtol for comments as to the logic used. - */ - do { - c = *s++; - } while (isspace(c)); - if (c == '-') - { - neg = 1; - c = *s++; - } - else if (c == '+') - c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) - { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; - cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; - for (acc = 0, any = 0;; c = *s++) - { - if (isdigit(c)) - c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) - { - acc = ULONG_MAX; - } - else if (neg) - acc = -acc; - if (endptr != 0) - *endptr = any ? (char *)s - 1 : (char *)nptr; - return acc; -} + /* Get the protection for the address. */ + Protect = MmGetPageProtect(Process, (PVOID)PAGE_ROUND_DOWN(Address)); + + /* Return if that page isn't present. */ + if (Protect & PAGE_NOACCESS) + { + return STATUS_MEMORY_NOT_ALLOCATED; + } + + /* Attach to the process */ + if (CurrentProcess != Process) + { + KeStackAttachProcess(EPROCESS_TO_KPROCESS(Process), &ApcState); + } + /* Make the page writeable if it is read only. */ + if (Protect & (PAGE_READONLY|PAGE_EXECUTE|PAGE_EXECUTE_READ)) + { + MmSetPageProtect(Process, (PVOID)PAGE_ROUND_DOWN(Address), + (Protect & ~(PAGE_READONLY|PAGE_EXECUTE|PAGE_EXECUTE_READ)) | PAGE_READWRITE); + } + + /* Copy the old instruction back to the caller. */ + if (OldInst != NULL) + { + Status = KdbpSafeReadMemory(OldInst, (PUCHAR)Address, 1); + if (!NT_SUCCESS(Status)) + { + if (Protect & (PAGE_READONLY|PAGE_EXECUTE|PAGE_EXECUTE_READ)) + { + MmSetPageProtect(Process, (PVOID)PAGE_ROUND_DOWN(Address), Protect); + } + /* Detach from process */ + if (CurrentProcess != Process) + { + KeDetachProcess(); + } + return Status; + } + } + + /* Copy the new instruction in its place. */ + Status = KdbpSafeWriteMemory((PUCHAR)Address, &NewInst, 1); + + /* Restore the page protection. */ + if (Protect & (PAGE_READONLY|PAGE_EXECUTE|PAGE_EXECUTE_READ)) + { + MmSetPageProtect(Process, (PVOID)PAGE_ROUND_DOWN(Address), Protect); + } + + /* Detach from process */ + if (CurrentProcess != Process) + { + KeUnstackDetachProcess(&ApcState); + } -char* -strpbrk(const char* s, const char* accept) -{ - int i; - for (; (*s) != 0; s++) - { - for (i = 0; accept[i] != 0; i++) - { - if (accept[i] == (*s)) - { - return((char *)s); - } - } - } - return(NULL); + return Status; } - -#if 0 -NTSTATUS -KdbpSafeReadMemory(PVOID dst, PVOID src, INT size) +/*!\brief Checks whether the given instruction can be single stepped or has to be + * stepped over using a temporary breakpoint. + * [truncated at 1000 lines; 7037 more skipped]
19 years, 9 months
1
0
0
0
[chorns] 13840: Put remaining files on the cd
by chorns@svn.reactos.com
Put remaining files on the cd Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr.xml Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_main.xml Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/setupldr.xml Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/setupldr_main.xml Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr.xml Modified: branches/xmlbuildsystem/reactos/bootdata/bootdata.xml Modified: branches/xmlbuildsystem/reactos/subsys/system/directory.xml Modified: branches/xmlbuildsystem/reactos/tools/rbuild/bootstrap.cpp Added: branches/xmlbuildsystem/reactos/tools/wrc/makefile _____ Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr.xml --- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr.xml 2005-03-05 23:19:42 UTC (rev 13839) +++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr.xml 2005-03-05 23:22:44 UTC (rev 13840) @@ -1,4 +1,5 @@ <module name="freeldr" type="bootloader"> + <bootstrap base="loader" /> <library>freeldr_startup</library> <library>freeldr_base64k</library> <library>freeldr_base</library> _____ Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_main.xml --- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_main.xml 2005-03-05 23:19:42 UTC (rev 13839) +++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_main.xml 2005-03-05 23:22:44 UTC (rev 13840) @@ -8,9 +8,6 @@ <compilerflag>-fno-inline</compilerflag> <compilerflag>-fno-zero-initialized-in-bss</compilerflag> <compilerflag>-Os</compilerflag> - <directory name="inffile"> - <file>inffile.c</file> - </directory> <file>bootmgr.c</file> <file>drivemap.c</file> <file>miscboot.c</file> _____ Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/setupldr.xml --- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/setupldr.xml 2005-03-05 23:19:42 UTC (rev 13839) +++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/setupldr.xml 2005-03-05 23:22:44 UTC (rev 13840) @@ -0,0 +1,8 @@ +<module name="setupldr" type="bootloader"> + <bootstrap base="loader" /> + <library>freeldr_startup</library> + <library>freeldr_base64k</library> + <library>freeldr_base</library> + <library>setupldr_main</library> + <library>rossym</library> +</module> _____ Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/setupldr_main.xml --- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/setupldr_main.xml 2005-03-05 23:19:42 UTC (rev 13839) +++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/setupldr_main.xml 2005-03-05 23:22:44 UTC (rev 13840) @@ -0,0 +1,17 @@ +<module name="setupldr_main" type="objectlibrary"> + <include base="setupldr_main">include</include> + <include base="ntoskrnl">include</include> + <define name="__USE_W32API" /> + <compilerflag>-nostdlib</compilerflag> + <compilerflag>-ffreestanding</compilerflag> + <compilerflag>-fno-builtin</compilerflag> + <compilerflag>-fno-inline</compilerflag> + <compilerflag>-fno-zero-initialized-in-bss</compilerflag> + <compilerflag>-Os</compilerflag> + <directory name="inffile"> + <file>inffile.c</file> + </directory> + <directory name="reactos"> + <file>setupldr.c</file> + </directory> +</module> _____ Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr.xml --- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr.xml 2005-03-05 23:19:42 UTC (rev 13839) +++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr.xml 2005-03-05 23:22:44 UTC (rev 13840) @@ -6,5 +6,7 @@ <xi:include href="freeldr/freeldr_base64k.xml" /> <xi:include href="freeldr/freeldr_base.xml" /> <xi:include href="freeldr/freeldr_main.xml" /> + <xi:include href="freeldr/setupldr_main.xml" /> <xi:include href="freeldr/freeldr.xml" /> + <xi:include href="freeldr/setupldr.xml" /> </directory> _____ Modified: branches/xmlbuildsystem/reactos/bootdata/bootdata.xml --- branches/xmlbuildsystem/reactos/bootdata/bootdata.xml 2005-03-05 23:19:42 UTC (rev 13839) +++ branches/xmlbuildsystem/reactos/bootdata/bootdata.xml 2005-03-05 23:22:44 UTC (rev 13840) @@ -3,6 +3,6 @@ <cdfile>readme.txt</cdfile> <cdfile base="reactos">hivecls.inf</cdfile> <cdfile base="reactos">hivedef.inf</cdfile> -<cdfile base="reactos">hiveinst.inf</cdfile> <cdfile base="reactos">hivesft.inf</cdfile> <cdfile base="reactos">hivesys.inf</cdfile> +<cdfile base="reactos">txtsetup.sif</cdfile> _____ Modified: branches/xmlbuildsystem/reactos/subsys/system/directory.xml --- branches/xmlbuildsystem/reactos/subsys/system/directory.xml 2005-03-05 23:19:42 UTC (rev 13839) +++ branches/xmlbuildsystem/reactos/subsys/system/directory.xml 2005-03-05 23:22:44 UTC (rev 13840) @@ -19,6 +19,9 @@ <directory name="notepad"> <xi:include href="notepad/notepad.xml" /> </directory> +<directory name="reactos"> + <xi:include href="reactos/reactos.xml" /> +</directory> <directory name="regedit"> <xi:include href="regedit/regedit.xml" /> </directory> _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/bootstrap.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/bootstrap.cpp 2005-03-05 23:19:42 UTC (rev 13839) +++ branches/xmlbuildsystem/reactos/tools/rbuild/bootstrap.cpp 2005-03-05 23:22:44 UTC (rev 13840) @@ -33,11 +33,11 @@ case Win32GUI: case KernelModeDriver: case BootSector: + case BootLoader: return true; case BuildTool: case StaticLibrary: case ObjectLibrary: - case BootLoader: case Iso: return false; } _____ Added: branches/xmlbuildsystem/reactos/tools/wrc/makefile --- branches/xmlbuildsystem/reactos/tools/wrc/makefile 2005-03-05 23:19:42 UTC (rev 13839) +++ branches/xmlbuildsystem/reactos/tools/wrc/makefile 2005-03-05 23:22:44 UTC (rev 13840) @@ -0,0 +1,39 @@ +WRC_BASE = tools$(SEP)wrc + +WRC_TARGET = \ + $(ROS_INTERMEDIATE)$(WRC_BASE)$(SEP)wrc$(EXEPOSTFIX) + +WRC_SOURCES = \ + $(WRC_BASE)$(SEP)dumpres.c \ + $(WRC_BASE)$(SEP)genres.c \ + $(WRC_BASE)$(SEP)newstruc.c \ + $(WRC_BASE)$(SEP)readres.c \ + $(WRC_BASE)$(SEP)translation.c \ + $(WRC_BASE)$(SEP)utils.c \ + $(WRC_BASE)$(SEP)wrc.c \ + $(WRC_BASE)$(SEP)writeres.c \ + $(WRC_BASE)$(SEP)y.tab.c \ + $(WRC_BASE)$(SEP)lex.yy.c \ + $(WRC_BASE)$(SEP)port$(SEP)mkstemps.o + +WRC_OBJECTS = \ + $(WRC_SOURCES:.c=.o) + +WRC_HOST_CFLAGS = -I$(WRC_BASE) -g -Werror -Wall \ + -D__USE_W32API -DWINE_UNICODE_API= \ + -Dwchar_t="unsigned short" -D_WCHAR_T_DEFINED \ + -I$(UNICODE_BASE) -I$(WPP_BASE) -I$(WRC_BASE) \ + -Iinclude/wine -Iinclude -Iw32api/include + +WRC_HOST_LFLAGS = -g + +$(WRC_TARGET): $(WRC_OBJECTS) $(UNICODE_TARGET) $(WPP_TARGET) + ${host_gcc} $(WRC_OBJECTS) $(UNICODE_TARGET) $(WPP_TARGET) $(WRC_HOST_LFLAGS) -o $(WRC_TARGET) + +$(WRC_OBJECTS): %.o : %.c + ${host_gcc} $(WRC_HOST_CFLAGS) -c $< -o $@ + +.PHONY: wrc_clean +wrc_clean: + -@$(rm) $(WRC_TARGET) $(WRC_OBJECTS) 2>$(NUL) +clean: wrc_clean
19 years, 9 months
1
0
0
0
[ion] 13839: - Fix bootlog/debug to file problem -- Steven. 3GB now works (Thanks to Filip) but a bug remains in ntoskrnl.
by ion@svn.reactos.com
- Fix bootlog/debug to file problem -- Steven. 3GB now works (Thanks to Filip) but a bug remains in ntoskrnl. - Basic beginning of Vector Exception Handling implementation -- Thomas - Merge with 13793:13838 Modified: branches/alex_devel_branch/reactos/bootdata/packages/reactos.dff Modified: branches/alex_devel_branch/reactos/drivers/fs/np/create.c Modified: branches/alex_devel_branch/reactos/drivers/fs/np/fsctrl.c Modified: branches/alex_devel_branch/reactos/drivers/fs/np/npfs.h Modified: branches/alex_devel_branch/reactos/drivers/fs/np/rw.c Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/ src/sys/sys/select.h Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/ src/sys/sys/socketvar.h Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/ src/sys/sys/systm.h Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/in_pcb. c Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/interfa ce.c Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/route.c Modified: branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.c Modified: branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.h Modified: branches/alex_devel_branch/reactos/include/ntdll/rtl.h Modified: branches/alex_devel_branch/reactos/lib/adns/Makefile Modified: branches/alex_devel_branch/reactos/lib/adns/src/event.c Modified: branches/alex_devel_branch/reactos/lib/ntdll/def/ntdll.def Modified: branches/alex_devel_branch/reactos/lib/ntdll/ldr/startup.c Modified: branches/alex_devel_branch/reactos/lib/ntdll/rtl/exception.c Modified: branches/alex_devel_branch/reactos/lib/rpcrt4/rpc_message.c Modified: branches/alex_devel_branch/reactos/lib/user32/resources/oic_reactos.ico Modified: branches/alex_devel_branch/reactos/ntoskrnl/Makefile Modified: branches/alex_devel_branch/reactos/ntoskrnl/include/internal/io.h Modified: branches/alex_devel_branch/reactos/ntoskrnl/include/internal/kd.h Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/cancel.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/iomgr.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/irp.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/kd/dlog.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/kd/kdebug.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/ob/handle.c Modified: branches/alex_devel_branch/reactos/ntoskrnl/ps/kill.c Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/res/logov.bmp Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/res/reactos.ic o Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/res/ros-big.ic o Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/res/startmenu. ico Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/taskbar/startm enu.cpp Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/utility/xmlsto rage.cpp Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/utility/xmlsto rage.h Modified: branches/alex_devel_branch/reactos/subsys/system/ibrowser/Makefile _____ Modified: branches/alex_devel_branch/reactos/bootdata/packages/reactos.dff --- branches/alex_devel_branch/reactos/bootdata/packages/reactos.dff 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/bootdata/packages/reactos.dff 2005-03-05 23:19:42 UTC (rev 13839) @@ -146,6 +146,7 @@ subsys\system\explorer\explorer.exe 4 subsys\system\explorer\explorer-cfg-template.xml 4 subsys\system\explorer\notifyhook\notifyhook.dll 1 +subsys\system\ibrowser\ibrowser.exe 1 subsys\system\format\format.exe 1 subsys\system\notepad\notepad.exe 1 subsys\system\regedit\regedit.exe 4 _____ Modified: branches/alex_devel_branch/reactos/drivers/fs/np/create.c --- branches/alex_devel_branch/reactos/drivers/fs/np/create.c 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/drivers/fs/np/create.c 2005-03-05 23:19:42 UTC (rev 13839) @@ -48,17 +48,18 @@ NpfsFindListeningServerInstance(PNPFS_PIPE Pipe) { PLIST_ENTRY CurrentEntry; - PNPFS_FCB ServerFcb; + PNPFS_WAITER_ENTRY Waiter; - CurrentEntry = Pipe->ServerFcbListHead.Flink; - while (CurrentEntry != &Pipe->ServerFcbListHead) + CurrentEntry = Pipe->WaiterListHead.Flink; + while (CurrentEntry != &Pipe->WaiterListHead) { - ServerFcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB, FcbListEntry); - if (ServerFcb->PipeState == FILE_PIPE_LISTENING_STATE) + Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry); + if (Waiter->Fcb->PipeState == FILE_PIPE_LISTENING_STATE) { - DPRINT("Server found! Fcb %p\n", ServerFcb); - return ServerFcb; + DPRINT("Server found! Fcb %p\n", Waiter->Fcb); + return Waiter->Fcb; } + CurrentEntry = CurrentEntry->Flink; } @@ -66,6 +67,35 @@ } +static VOID +NpfsSignalAndRemoveListeningServerInstance(PNPFS_PIPE Pipe, + PNPFS_FCB Fcb) +{ + PLIST_ENTRY CurrentEntry; + PNPFS_WAITER_ENTRY Waiter; + + CurrentEntry = Pipe->WaiterListHead.Flink; + while (CurrentEntry != &Pipe->WaiterListHead) + { + Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry); + if (Waiter->Fcb == Fcb) + { + DPRINT("Server found! Fcb %p\n", Waiter->Fcb); + + KeSetEvent(Waiter->Irp->UserEvent, 0, FALSE); + Waiter->Irp->UserIosb->Status = FILE_PIPE_CONNECTED_STATE; + Waiter->Irp->UserIosb->Information = 0; + IoCompleteRequest(Waiter->Irp, IO_NO_INCREMENT); + + RemoveEntryList(&Waiter->Entry); + ExFreePool(Waiter); + return; + } + CurrentEntry = CurrentEntry->Flink; + } +} + + NTSTATUS STDCALL NpfsCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp) @@ -206,9 +236,8 @@ ClientFcb->PipeState = FILE_PIPE_CONNECTED_STATE; ServerFcb->PipeState = FILE_PIPE_CONNECTED_STATE; - /* Wake server thread */ - DPRINT("Setting the ConnectEvent for %x\n", ServerFcb); - KeSetEvent(&ServerFcb->ConnectEvent, 0, FALSE); + /* Signal the server thread and remove it from the waiter list */ + NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerFcb); } KeUnlockMutex(&Pipe->FcbListLock); @@ -318,6 +347,7 @@ InitializeListHead(&Pipe->ServerFcbListHead); InitializeListHead(&Pipe->ClientFcbListHead); + InitializeListHead(&Pipe->WaiterListHead); KeInitializeMutex(&Pipe->FcbListLock, 0); Pipe->PipeType = Buffer->NamedPipeType; _____ Modified: branches/alex_devel_branch/reactos/drivers/fs/np/fsctrl.c --- branches/alex_devel_branch/reactos/drivers/fs/np/fsctrl.c 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/drivers/fs/np/fsctrl.c 2005-03-05 23:19:42 UTC (rev 13839) @@ -18,9 +18,67 @@ /* FUNCTIONS *****************************************************************/ +static VOID +NpfsListeningCancelRoutine(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PNPFS_WAITER_ENTRY Waiter; + + DPRINT1("NpfsListeningCancelRoutine() called\n"); + /* FIXME: Not tested. */ + + Waiter = Irp->Tail.Overlay.DriverContext[0]; + + RemoveEntryList(&Waiter->Entry); + ExFreePool(Waiter); + + IoReleaseCancelSpinLock(Irp->CancelIrql); + + Irp->IoStatus.Status = STATUS_CANCELLED; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); +} + + static NTSTATUS -NpfsConnectPipe(PNPFS_FCB Fcb) +NpfsAddListeningServerInstance(PIRP Irp, + PNPFS_FCB Fcb) { + PNPFS_WAITER_ENTRY Entry; + KIRQL OldIrql; + + Entry = ExAllocatePool(NonPagedPool, sizeof(NPFS_WAITER_ENTRY)); + if (Entry == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Entry->Irp = Irp; + Entry->Fcb = Fcb; + InsertTailList(&Fcb->Pipe->WaiterListHead, &Entry->Entry); + + IoAcquireCancelSpinLock(&OldIrql); + if (!Irp->Cancel) + { + Irp->Tail.Overlay.DriverContext[0] = Entry; + IoMarkIrpPending(Irp); + IoSetCancelRoutine(Irp, NpfsListeningCancelRoutine); + IoReleaseCancelSpinLock(OldIrql); + return STATUS_PENDING; + } + /* IRP has already been cancelled */ + IoReleaseCancelSpinLock(OldIrql); + + DPRINT1("FIXME: Remove waiter entry!\n"); + RemoveEntryList(&Entry->Entry); + ExFreePool(Entry); + + return STATUS_CANCELLED; +} + + +static NTSTATUS +NpfsConnectPipe(PIRP Irp, + PNPFS_FCB Fcb) +{ PNPFS_PIPE Pipe; PLIST_ENTRY current_entry; PNPFS_FCB ClientFcb; @@ -88,29 +146,18 @@ current_entry = current_entry->Flink; } - KeUnlockMutex(&Pipe->FcbListLock); - /* no listening client fcb found */ DPRINT("No listening client fcb found -- waiting for client\n"); Fcb->PipeState = FILE_PIPE_LISTENING_STATE; - Status = KeWaitForSingleObject(&Fcb->ConnectEvent, - UserRequest, - KernelMode, - FALSE, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT("KeWaitForSingleObject() failed (Status %lx)\n", Status); - return Status; - } + Status = NpfsAddListeningServerInstance(Irp, Fcb); - Fcb->PipeState = FILE_PIPE_CONNECTED_STATE; + KeUnlockMutex(&Pipe->FcbListLock); - DPRINT("Client Fcb: %p\n", Fcb->OtherSide); + DPRINT("NpfsConnectPipe() done (Status %lx)\n", Status); - return STATUS_PIPE_CONNECTED; + return Status; } @@ -327,7 +374,6 @@ } - NTSTATUS STDCALL NpfsFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) @@ -366,7 +412,7 @@ case FSCTL_PIPE_LISTEN: DPRINT("Connecting pipe %wZ\n", &Pipe->PipeName); - Status = NpfsConnectPipe(Fcb); + Status = NpfsConnectPipe(Irp, Fcb); break; case FSCTL_PIPE_PEEK: @@ -439,12 +485,15 @@ Status = STATUS_UNSUCCESSFUL; } - Irp->IoStatus.Status = Status; - Irp->IoStatus.Information = 0; + if (Status != STATUS_PENDING) + { + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return(Status); + return Status; } _____ Modified: branches/alex_devel_branch/reactos/drivers/fs/np/npfs.h --- branches/alex_devel_branch/reactos/drivers/fs/np/npfs.h 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/drivers/fs/np/npfs.h 2005-03-05 23:19:42 UTC (rev 13839) @@ -19,6 +19,7 @@ KMUTEX FcbListLock; LIST_ENTRY ServerFcbListHead; LIST_ENTRY ClientFcbListHead; + LIST_ENTRY WaiterListHead; ULONG PipeType; ULONG ReadMode; ULONG WriteMode; @@ -52,7 +53,15 @@ KSPIN_LOCK DataListLock; /* Data queue lock */ } NPFS_FCB, *PNPFS_FCB; +typedef struct _NPFS_WAITER_ENTRY +{ + LIST_ENTRY Entry; + PIRP Irp; + PNPFS_PIPE Pipe; + PNPFS_FCB Fcb; +} NPFS_WAITER_ENTRY, *PNPFS_WAITER_ENTRY; + extern NPAGED_LOOKASIDE_LIST NpfsPipeDataLookasideList; _____ Modified: branches/alex_devel_branch/reactos/drivers/fs/np/rw.c --- branches/alex_devel_branch/reactos/drivers/fs/np/rw.c 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/drivers/fs/np/rw.c 2005-03-05 23:19:42 UTC (rev 13839) @@ -101,7 +101,6 @@ /* FIXME: check if in blocking mode */ if (Fcb->ReadDataAvailable == 0) { - KeResetEvent(&Fcb->Event); if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE) { KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE); @@ -167,6 +166,7 @@ if (Length == 0) { KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE); + KeResetEvent(&Fcb->Event); break; } } @@ -187,8 +187,19 @@ #endif Information = CopyLength; - Fcb->ReadDataAvailable = 0; - Fcb->WriteQuotaAvailable = Fcb->MaxDataLength; + + if (Fcb->ReadDataAvailable > Length) + { + memmove(Fcb->Data, Fcb->Data + Length, + Fcb->ReadDataAvailable - Length); + Fcb->ReadDataAvailable -= Length; + Status = STATUS_MORE_ENTRIES; + } + else + { + Fcb->ReadDataAvailable = 0; + Fcb->WriteQuotaAvailable = Fcb->MaxDataLength; + } } if (Information > 0) @@ -197,6 +208,7 @@ { KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE); } + KeResetEvent(&Fcb->Event); break; } } @@ -291,7 +303,6 @@ { if (ReaderFcb->WriteQuotaAvailable == 0) { - KeResetEvent(&Fcb->Event); KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE); KeReleaseSpinLock(&ReaderFcb->DataListLock, OldIrql); if (Fcb->PipeState != FILE_PIPE_CONNECTED_STATE) @@ -355,6 +366,7 @@ if (Length == 0) { KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE); + KeResetEvent(&Fcb->Event); break; } } @@ -374,6 +386,7 @@ if (Information > 0) { KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE); + KeResetEvent(&Fcb->Event); break; } } _____ Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/ src/sys/sys/select.h --- branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/ src/sys/sys/select.h 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/ src/sys/sys/select.h 2005-03-05 23:19:42 UTC (rev 13839) @@ -40,19 +40,14 @@ struct listener_mgr; #endif -/* - * Used to maintain information about processes that wish to be - * notified when I/O becomes possible. - */ -struct selinfo { -#if defined(OSKIT) - struct listener_mgr *si_sel; -#endif /* OSKIT */ - pid_t si_pid; /* process to be notified */ - short si_flags; /* see below */ -}; -#define SI_COLL 0x0001 /* collision occurred */ +/* Included to suppress warnings about struct socket being declared in the + * parameter list. Selinfo reoredered with struct socket. */ +struct selinfo; +struct socket; + +#include <sys/socketvar.h> + #ifdef KERNEL struct proc; _____ Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/ src/sys/sys/socketvar.h --- branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/ src/sys/sys/socketvar.h 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/ src/sys/sys/socketvar.h 2005-03-05 23:19:42 UTC (rev 13839) @@ -40,7 +40,26 @@ #include <sys/filedesc.h> /* for struct filedesc */ #include <sys/select.h> /* for struct selinfo */ +/* Warning suppression */ +struct sockaddr; + /* + * Used to maintain information about processes that wish to be + * notified when I/O becomes possible. + * + * Moved from sys/select.h and replaced with an #include. + */ +struct selinfo { +#if defined(OSKIT) + struct listener_mgr *si_sel; +#endif /* OSKIT */ + pid_t si_pid; /* process to be notified */ + short si_flags; /* see below */ +}; +#define SI_COLL 0x0001 /* collision occurred */ + + +/* * Kernel structure per socket. * Contains send and receive buffer queues, * handle on protocol and pointer to protocol _____ Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/ src/sys/sys/systm.h --- branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/ src/sys/sys/systm.h 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/ src/sys/sys/systm.h 2005-03-05 23:19:42 UTC (rev 13839) @@ -125,9 +125,11 @@ #include <oskitfreebsd.h> #include <oskitdebug.h> + int __cdecl vprintf(const char *, va_list); -static inline int log ( int blah, const char* fmt, ... ) +#define log bsd_log +static inline int bsd_log ( int blah, const char* fmt, ... ) { va_list arg; int i; _____ Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/in_pcb. c --- branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/in_pcb. c 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/in_pcb. c 2005-03-05 23:19:42 UTC (rev 13839) @@ -312,7 +312,7 @@ * Don't do pcblookup call here; return interface in plocal_sin * and exit to caller, that will do the lookup. */ - *plocal_sin = ia->ia_ifa.ifa_addr; + *plocal_sin = (struct sockaddr_in *)ia->ia_ifa.ifa_addr; OS_DbgPrint(OSK_MID_TRACE,("plocal sin %x\n", (*plocal_sin)->sin_addr.s_addr)); _____ Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/interfa ce.c --- branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/interfa ce.c 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/interfa ce.c 2005-03-05 23:19:42 UTC (rev 13839) @@ -365,7 +365,7 @@ */ so = head->so_q; - inp = so ? so->so_pcb : 0; + inp = so ? (struct inpcb *)so->so_pcb : NULL; if( inp ) { ((struct sockaddr_in *)AddrOut)->sin_addr.s_addr = inp->inp_faddr.s_addr; @@ -381,7 +381,7 @@ /*so->so_state &= ~SS_COMP;*/ - mnam.m_data = &sa; + mnam.m_data = (char *)&sa; mnam.m_len = sizeof(sa); (void) soaccept(so, &mnam); @@ -452,7 +452,7 @@ OSK_UINT RemoteAddress, OSK_UI16 RemotePort ) { struct socket *so = socket; - struct inpcb *inp = so->so_pcb; + struct inpcb *inp = (struct inpcb *)so->so_pcb; inp->inp_laddr.s_addr = LocalAddress; inp->inp_lport = LocalPort; inp->inp_faddr.s_addr = RemoteAddress; @@ -465,7 +465,7 @@ OSK_UINT *RemoteAddress, OSK_UI16 *RemotePort ) { struct socket *so = socket; - struct inpcb *inp = so ? so->so_pcb : 0; + struct inpcb *inp = so ? (struct inpcb *)so->so_pcb : NULL; if( inp ) { *LocalAddress = inp->inp_laddr.s_addr; *LocalPort = inp->inp_lport; @@ -589,7 +589,7 @@ if( ifaddr ) { - sin = (struct sockaddr *)&ifaddr->ifa_addr; + sin = (struct sockaddr_in *)&ifaddr->ifa_addr; OS_DbgPrint(OSK_MID_TRACE,("ifaddr->addr = %x\n", sin->sin_addr.s_addr)); _____ Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/route.c --- branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/route.c 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/route.c 2005-03-05 23:19:42 UTC (rev 13839) @@ -314,8 +314,8 @@ register struct ifaddr *ifa; OS_DbgPrint(OSK_MID_TRACE,("Called: flags %\n", flags)); - OskitDumpBuffer( dst, sizeof(*dst) ); - OskitDumpBuffer( gateway, sizeof(*gateway) ); + OskitDumpBuffer( (void *)dst, sizeof(*dst) ); + OskitDumpBuffer( (void *)gateway, sizeof(*gateway) ); if ((flags & RTF_GATEWAY) == 0) { /* _____ Modified: branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.c --- branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.c 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.c 2005-03-05 23:19:42 UTC (rev 13839) @@ -1327,6 +1327,8 @@ DrvParms->TMSectorCountHi, DrvParms->TMSectorCountLo, (ULONG)((DrvParms->TMSectorCountHi << 16) + DrvParms->TMSectorCountLo)); + DPRINT("SupportedFeatures83: %x, EnabledFeatures86 %x\n", DrvParms->SupportedFeatures83, DrvParms->EnabledFeatures86); + DPRINT("Max48BitAddress: %I64d\n", *(PULONGLONG)DrvParms->Max48BitAddress); if (DrvParms->TMFieldsValid & 0x0004) { if ((DrvParms->UltraDmaModes >> 8) && (DrvParms->UltraDmaModes & 0xff)) @@ -1952,7 +1954,7 @@ { PREAD_CAPACITY_DATA CapacityData; PIDE_DRIVE_IDENTIFY DeviceParams; - ULONG LastSector; + LARGE_INTEGER LastSector; DPRINT("SCSIOP_READ_CAPACITY: TargetId: %lu\n", Srb->TargetId); CapacityData = (PREAD_CAPACITY_DATA)Srb->DataBuffer; @@ -1964,15 +1966,34 @@ /* Calculate last sector (big-endian). */ if (DeviceParams->Capabilities & IDE_DRID_LBA_SUPPORTED) { - LastSector = (ULONG)((DeviceParams->TMSectorCountHi << 16) + - DeviceParams->TMSectorCountLo) - 1; + if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS) + { + ((PUSHORT)&LastSector)[0] = DeviceParams->Max48BitAddress[0]; + ((PUSHORT)&LastSector)[1] = DeviceParams->Max48BitAddress[1]; + ((PUSHORT)&LastSector)[2] = DeviceParams->Max48BitAddress[2]; + ((PUSHORT)&LastSector)[3] = DeviceParams->Max48BitAddress[3]; + LastSector.QuadPart -= 1; + + } + else + { + LastSector.u.HighPart = 0; + LastSector.u.LowPart = (ULONG)((DeviceParams->TMSectorCountHi << 16) + + DeviceParams->TMSectorCountLo)-1; + } } else { - LastSector = (ULONG)(DeviceParams->LogicalCyls * - DeviceParams->LogicalHeads * - DeviceParams->SectorsPerTrack)-1; + LastSector.u.HighPart = 0; + LastSector.u.LowPart = (ULONG)(DeviceParams->LogicalCyls * + DeviceParams->LogicalHeads * + DeviceParams->SectorsPerTrack)-1; } + if (LastSector.u.HighPart) + { + DPRINT1("Disk is too large for our implementation (%I64d sectors\n", LastSector.QuadPart); + KEBUGCHECK(0); + } CapacityData->LogicalBlockAddress = (((PUCHAR)&LastSector)[0] << 24) | (((PUCHAR)&LastSector)[1] << 16) | @@ -1996,10 +2017,10 @@ PIDE_DRIVE_IDENTIFY DeviceParams; ULONG StartingSector; ULONG SectorCount; - UCHAR CylinderHigh; - UCHAR CylinderLow; + UCHAR CylinderHigh[2]; + UCHAR CylinderLow[2]; UCHAR DrvHead; - UCHAR SectorNumber; + UCHAR SectorNumber[2]; UCHAR Command; ULONG Retries; UCHAR Status; @@ -2025,47 +2046,61 @@ Srb->DataTransferLength, SectorCount); - if (DeviceParams->Capabilities & IDE_DRID_LBA_SUPPORTED) + if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS) { - SectorNumber = StartingSector & 0xff; - CylinderLow = (StartingSector >> 8) & 0xff; - CylinderHigh = (StartingSector >> 16) & 0xff; - DrvHead = ((StartingSector >> 24) & 0x0f) | - (Srb->TargetId ? IDE_DH_DRV1 : 0) | - IDE_DH_LBA; + SectorNumber[0] = StartingSector & 0xff; + CylinderLow[0] = (StartingSector >> 8) & 0xff; + CylinderHigh[0] = (StartingSector >> 16) & 0xff; + SectorNumber[1] = (StartingSector >> 24) & 0xff; + CylinderLow[1] = 0; + CylinderHigh[1] = 0; + DrvHead = (Srb->TargetId ? IDE_DH_DRV1 : 0) | IDE_DH_LBA; + + DPRINT("%s:BUS=%04x:DRV=%d:LBA48=1:BLK=%08d:SC=%02x:CM=%02x\n", + (Srb->SrbFlags & SRB_FLAGS_DATA_IN) ? "READ" : "WRITE", + DeviceExtension->CommandPortBase, + DrvHead & IDE_DH_DRV1 ? 1 : 0, + (SectorNumber[1] << 24) + + (CylinderHigh[0] << 16) + (CylinderLow[0] << 8) + DectorNumberLow[0], + SectorCount, + Command); } - else + else if (DeviceParams->Capabilities & IDE_DRID_LBA_SUPPORTED) { - SectorNumber = (StartingSector % DeviceParams->SectorsPerTrack) + 1; - StartingSector /= DeviceParams->SectorsPerTrack; - DrvHead = (StartingSector % DeviceParams->LogicalHeads) | - (Srb->TargetId ? IDE_DH_DRV1 : 0); - StartingSector /= DeviceParams->LogicalHeads; - CylinderLow = StartingSector & 0xff; - CylinderHigh = StartingSector >> 8; - } + SectorNumber[0] = StartingSector & 0xff; + CylinderLow[0] = (StartingSector >> 8) & 0xff; + CylinderHigh[0] = (StartingSector >> 16) & 0xff; + DrvHead = ((StartingSector >> 24) & 0x0f) | + (Srb->TargetId ? IDE_DH_DRV1 : 0) | + IDE_DH_LBA; - if (DrvHead & IDE_DH_LBA) - { DPRINT("%s:BUS=%04x:DRV=%d:LBA=1:BLK=%08d:SC=%02x:CM=%02x\n", (Srb->SrbFlags & SRB_FLAGS_DATA_IN) ? "READ" : "WRITE", DeviceExtension->CommandPortBase, DrvHead & IDE_DH_DRV1 ? 1 : 0, ((DrvHead & 0x0f) << 24) + - (CylinderHigh << 16) + (CylinderLow << 8) + SectorNumber, + (CylinderHigh[0] << 16) + (CylinderLow[0] << 8) + SectorNumber[0], SectorCount, Command); } else { + SectorNumber[0] = (StartingSector % DeviceParams->SectorsPerTrack) + 1; + StartingSector /= DeviceParams->SectorsPerTrack; + DrvHead = (StartingSector % DeviceParams->LogicalHeads) | + (Srb->TargetId ? IDE_DH_DRV1 : 0); + StartingSector /= DeviceParams->LogicalHeads; + CylinderLow[0] = StartingSector & 0xff; + CylinderHigh[0] = StartingSector >> 8; + DPRINT("%s:BUS=%04x:DRV=%d:LBA=0:CH=%02x:CL=%02x:HD=%01x:SN=%02x:SC=%02x :CM=%02x\n", (Srb->SrbFlags & SRB_FLAGS_DATA_IN) ? "READ" : "WRITE", DeviceExtension->CommandPortBase, DrvHead & IDE_DH_DRV1 ? 1 : 0, - CylinderHigh, - CylinderLow, + CylinderHigh[0], + CylinderLow[0], DrvHead & 0x0f, - SectorNumber, + SectorNumber[0], SectorCount, Command); } @@ -2119,11 +2154,21 @@ #endif /* Setup command parameters */ + if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS) + { + IDEWritePrecomp(DeviceExtension->CommandPortBase, 0); + IDEWriteSectorCount(DeviceExtension->CommandPortBase, SectorCount >> 8); + IDEWriteSectorNum(DeviceExtension->CommandPortBase, SectorNumber[1]); + IDEWriteCylinderLow(DeviceExtension->CommandPortBase, CylinderLow[1]); + IDEWriteCylinderHigh(DeviceExtension->CommandPortBase, CylinderHigh[1]); + } + IDEWritePrecomp(DeviceExtension->CommandPortBase, 0); - IDEWriteSectorCount(DeviceExtension->CommandPortBase, SectorCount); - IDEWriteSectorNum(DeviceExtension->CommandPortBase, SectorNumber); - IDEWriteCylinderHigh(DeviceExtension->CommandPortBase, CylinderHigh); - IDEWriteCylinderLow(DeviceExtension->CommandPortBase, CylinderLow); + IDEWriteSectorCount(DeviceExtension->CommandPortBase, SectorCount & 0xff); + IDEWriteSectorNum(DeviceExtension->CommandPortBase, SectorNumber[0]); + IDEWriteCylinderLow(DeviceExtension->CommandPortBase, CylinderLow[0]); + IDEWriteCylinderHigh(DeviceExtension->CommandPortBase, CylinderHigh[0]); + IDEWriteDriveHead(DeviceExtension->CommandPortBase, IDE_DH_FIXED | DrvHead); #ifdef ENABLE_DMA @@ -2135,7 +2180,14 @@ if (DeviceExtension->UseDma) { Handler = AtapiDmaInterrupt; - Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_DMA : IDE_CMD_WRITE_DMA; + if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS) + { + Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_DMA_EXT : IDE_CMD_WRITE_DMA_EXT; + } + else + { + Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_DMA : IDE_CMD_WRITE_DMA; + } } else #endif @@ -2143,11 +2195,25 @@ Handler = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? AtapiReadInterrupt : AtapiWriteInterrupt; if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_MULTI_SECTOR_CMD) { - Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_MULTIPLE : IDE_CMD_WRITE_MULTIPLE; + if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS) + { + Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_MULTIPLE_EXT : IDE_CMD_WRITE_MULTIPLE_EXT; + } + else + { + Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_MULTIPLE : IDE_CMD_WRITE_MULTIPLE; + } } else { - Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ : IDE_CMD_WRITE; + if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS) + { + Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_EXT : IDE_CMD_WRITE_EXT; + } + else + { + Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ : IDE_CMD_WRITE; + } } } @@ -2274,7 +2340,9 @@ ScsiPortStallExecution(10); /* Issue command to drive */ - AtapiExecuteCommand(DeviceExtension, IDE_CMD_FLUSH_CACHE, AtapiNoDataInterrupt); + AtapiExecuteCommand(DeviceExtension, + DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS ? IDE_CMD_FLUSH_CACHE_EXT : IDE_CMD_FLUSH_CACHE, + AtapiNoDataInterrupt); /* Wait for controller ready */ for (Retries = 0; Retries < IDE_MAX_WRITE_RETRIES; Retries++) _____ Modified: branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.h --- branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.h 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.h 2005-03-05 23:19:42 UTC (rev 13839) @@ -64,21 +64,27 @@ #define IDE_REG_COMMAND 0x0007 /* IDE/ATA commands */ -#define IDE_CMD_RESET 0x08 -#define IDE_CMD_READ 0x20 -#define IDE_CMD_READ_RETRY 0x21 -#define IDE_CMD_WRITE 0x30 -#define IDE_CMD_WRITE_RETRY 0x31 -#define IDE_CMD_PACKET 0xA0 -#define IDE_CMD_READ_MULTIPLE 0xC4 -#define IDE_CMD_WRITE_MULTIPLE 0xC5 -#define IDE_CMD_READ_DMA 0xC8 -#define IDE_CMD_WRITE_DMA 0xCA -#define IDE_CMD_FLUSH_CACHE 0xE7 -#define IDE_CMD_FLUSH_CACHE_EXT 0xEA -#define IDE_CMD_IDENT_ATA_DRV 0xEC -#define IDE_CMD_IDENT_ATAPI_DRV 0xA1 -#define IDE_CMD_GET_MEDIA_STATUS 0xDA +#define IDE_CMD_RESET 0x08 +#define IDE_CMD_READ 0x20 +#define IDE_CMD_READ_ONCE 0x21 +#define IDE_CMD_READ_EXT 0x24 /* 48 bit */ +#define IDE_CMD_READ_DMA_EXT 0x25 /* 48 bit */ +#define IDE_CMD_READ_MULTIPLE_EXT 0x29 /* 48 bit */ +#define IDE_CMD_WRITE 0x30 +#define IDE_CMD_WRITE_ONCE 0x31 +#define IDE_CMD_WRITE_EXT 0x34 /* 48 bit */ +#define IDE_CMD_WRITE_DMA_EXT 0x35 /* 48 bit */ +#define IDE_CMD_WRITE_MULTIPLE_EXT 0x39 /* 48 bit */ +#define IDE_CMD_PACKET 0xA0 +#define IDE_CMD_READ_MULTIPLE 0xC4 +#define IDE_CMD_WRITE_MULTIPLE 0xC5 +#define IDE_CMD_READ_DMA 0xC8 +#define IDE_CMD_WRITE_DMA 0xCA +#define IDE_CMD_FLUSH_CACHE 0xE7 +#define IDE_CMD_FLUSH_CACHE_EXT 0xEA /* 48 bit */ +#define IDE_CMD_IDENT_ATA_DRV 0xEC +#define IDE_CMD_IDENT_ATAPI_DRV 0xA1 +#define IDE_CMD_GET_MEDIA_STATUS 0xDA // // Access macros for command registers _____ Modified: branches/alex_devel_branch/reactos/include/ntdll/rtl.h --- branches/alex_devel_branch/reactos/include/ntdll/rtl.h 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/include/ntdll/rtl.h 2005-03-05 23:19:42 UTC (rev 13839) @@ -770,7 +770,14 @@ STDCALL RtlDeleteTimerQueue(HANDLE TimerQueue); +PVOID +STDCALL +RtlEncodePointer(IN PVOID Pointer); +PVOID +STDCALL +RtlDecodePointer(IN PVOID Pointer); + #ifndef __NTDRIVER__ #ifndef __INTERLOCKED_DECLARED _____ Modified: branches/alex_devel_branch/reactos/lib/adns/Makefile --- branches/alex_devel_branch/reactos/lib/adns/Makefile 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/lib/adns/Makefile 2005-03-05 23:19:42 UTC (rev 13839) @@ -7,8 +7,8 @@ TARGET_NAME = adns TARGET_CFLAGS = \ - -O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ - -Wstrict-prototypes -Wmissing-prototypes -Wall -DADNS_JGAA_WIN32 + -O3 -Wall -Wwrite-strings -Wpointer-arith \ + -Wstrict-prototypes -Wmissing-prototypes -Wall -DADNS_JGAA_WIN32 -D__USE_W32API -D__REACTOS__ # require os code to explicitly request A/W version of structs/functions TARGET_CFLAGS += -Isrc -Iadns_win32 _____ Modified: branches/alex_devel_branch/reactos/lib/adns/src/event.c --- branches/alex_devel_branch/reactos/lib/adns/src/event.c 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/lib/adns/src/event.c 2005-03-05 23:19:42 UTC (rev 13839) @@ -52,7 +52,7 @@ serv= ads->tcpserver; adns_socket_close(ads->tcpsocket); - ads->tcpsocket= -1; + ads->tcpsocket= INVALID_SOCKET; ads->tcprecv.used= ads->tcprecv_skip= ads->tcpsend.used= 0; } _____ Modified: branches/alex_devel_branch/reactos/lib/ntdll/def/ntdll.def --- branches/alex_devel_branch/reactos/lib/ntdll/def/ntdll.def 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/lib/ntdll/def/ntdll.def 2005-03-05 23:19:42 UTC (rev 13839) @@ -296,6 +296,7 @@ RtlAddAuditAccessAceEx@28 ;RtlAddCompoundAce RtlAddRange@36 +RtlAddVectoredExceptionHandler@8 RtlAdjustPrivilege@16 RtlAllocateAndInitializeSid@44 RtlAllocateHandle@8 @@ -593,6 +594,7 @@ RtlReleasePebLock@0 RtlReleaseResource@4 ;RtlRemoteCall +RtlRemoveVectoredExceptionHandler@4 RtlResetRtlTranslations@4 RtlRestoreLastWin32Error@4=RtlSetLastWin32Error@4 RtlRunDecodeUnicodeString@8 _____ Modified: branches/alex_devel_branch/reactos/lib/ntdll/ldr/startup.c --- branches/alex_devel_branch/reactos/lib/ntdll/ldr/startup.c 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/lib/ntdll/ldr/startup.c 2005-03-05 23:19:42 UTC (rev 13839) @@ -39,7 +39,9 @@ NTSTATUS LdrpAttachThread (VOID); +VOID RtlpInitializeVectoredExceptionHandling(VOID); + #define VALUE_BUFFER_SIZE 256 BOOLEAN FASTCALL @@ -306,6 +308,9 @@ ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL); } + /* initialized vectored exception handling */ + RtlpInitializeVectoredExceptionHandling(); + /* initalize peb lock support */ RtlInitializeCriticalSection (&PebLock); Peb->FastPebLock = &PebLock; _____ Modified: branches/alex_devel_branch/reactos/lib/ntdll/rtl/exception.c --- branches/alex_devel_branch/reactos/lib/ntdll/rtl/exception.c 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/lib/ntdll/rtl/exception.c 2005-03-05 23:19:42 UTC (rev 13839) @@ -22,6 +22,15 @@ #define NDEBUG #include <debug.h> +static CRITICAL_SECTION RtlpVectoredExceptionLock; +static LIST_ENTRY RtlpVectoredExceptionHead; + +typedef struct _RTL_VECTORED_EXCEPTION_HANDLER +{ + LIST_ENTRY ListEntry; + PVECTORED_EXCEPTION_HANDLER VectoredHandler; +} RTL_VECTORED_EXCEPTION_HANDLER, *PRTL_VECTORED_EXCEPTION_HANDLER; + /* FUNCTIONS ***************************************************************/ VOID STDCALL @@ -87,4 +96,83 @@ NtTerminateProcess(NtCurrentProcess(), ExitStatus); } + +VOID +RtlpInitializeVectoredExceptionHandling(VOID) +{ + InitializeListHead(&RtlpVectoredExceptionHead); + RtlInitializeCriticalSection(&RtlpVectoredExceptionLock); +} + + +/* + * @implemented + */ +PVOID STDCALL +RtlAddVectoredExceptionHandler(IN ULONG FirstHandler, + IN PVECTORED_EXCEPTION_HANDLER VectoredHandler) +{ + PRTL_VECTORED_EXCEPTION_HANDLER veh; + + veh = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + sizeof(RTL_VECTORED_EXCEPTION_HANDLER)); + if(veh != NULL) + { + veh->VectoredHandler = RtlEncodePointer(VectoredHandler); + RtlEnterCriticalSection(&RtlpVectoredExceptionLock); + if(FirstHandler != 0) + { + InsertHeadList(&RtlpVectoredExceptionHead, + &veh->ListEntry); + } + else + { + InsertTailList(&RtlpVectoredExceptionHead, + &veh->ListEntry); + } + RtlLeaveCriticalSection(&RtlpVectoredExceptionLock); + } + + return veh; +} + + +/* + * @implemented + */ +ULONG STDCALL +RtlRemoveVectoredExceptionHandler(IN PVOID VectoredHandlerHandle) +{ + PLIST_ENTRY CurrentEntry; + PRTL_VECTORED_EXCEPTION_HANDLER veh = NULL; + ULONG Removed = FALSE; + + RtlEnterCriticalSection(&RtlpVectoredExceptionLock); + for(CurrentEntry = RtlpVectoredExceptionHead.Flink; + CurrentEntry != &RtlpVectoredExceptionHead; + CurrentEntry = CurrentEntry->Flink) + { + veh = CONTAINING_RECORD(CurrentEntry, + RTL_VECTORED_EXCEPTION_HANDLER, + ListEntry); + if(veh == VectoredHandlerHandle) + { + RemoveEntryList(&veh->ListEntry); + Removed = TRUE; + break; + } + } + RtlLeaveCriticalSection(&RtlpVectoredExceptionLock); + + if(Removed) + { + RtlFreeHeap(RtlGetProcessHeap(), + 0, + veh); + } + + return Removed; +} + /* EOF */ _____ Modified: branches/alex_devel_branch/reactos/lib/rpcrt4/rpc_message.c --- branches/alex_devel_branch/reactos/lib/rpcrt4/rpc_message.c 2005-03-05 22:20:15 UTC (rev 13838) +++ branches/alex_devel_branch/reactos/lib/rpcrt4/rpc_message.c 2005-03-05 23:19:42 UTC (rev 13839) @@ -265,10 +265,15 @@ } /* transmit packet header */ - if (!WriteFile(Connection->conn, Header, hdr_size, &count, NULL)) { + ResetEvent(Connection->ovl.hEvent); + if (!WriteFile(Connection->conn, Header, hdr_size, &count, &Connection->ovl)) { WARN("WriteFile failed with error %ld\n", GetLastError()); return GetLastError(); } + if (!GetOverlappedResult(Connection->conn, &Connection->ovl, &count, TRUE)) { + WARN("GetOverlappedResult failed with error %ld\n", GetLastError()); [truncated at 1000 lines; 755 more skipped]
19 years, 9 months
1
0
0
0
[chorns] 13838: Build HALs
by chorns@svn.reactos.com
Build HALs Modified: branches/xmlbuildsystem/reactos/hal/directory.xml Added: branches/xmlbuildsystem/reactos/hal/halx86/directory.xml Added: branches/xmlbuildsystem/reactos/hal/halx86/generic/generic.xml Added: branches/xmlbuildsystem/reactos/hal/halx86/mp/halmp.xml Added: branches/xmlbuildsystem/reactos/hal/halx86/up/halup.xml Added: branches/xmlbuildsystem/reactos/hal/halx86/xbox/halxbox.xml _____ Modified: branches/xmlbuildsystem/reactos/hal/directory.xml --- branches/xmlbuildsystem/reactos/hal/directory.xml 2005-03-05 22:13:47 UTC (rev 13837) +++ branches/xmlbuildsystem/reactos/hal/directory.xml 2005-03-05 22:20:15 UTC (rev 13838) @@ -1,3 +1,6 @@ <directory name="hal"> <xi:include href="hal/hal.xml" /> </directory> +<directory name="halx86"> + <xi:include href="halx86/directory.xml" /> +</directory> _____ Added: branches/xmlbuildsystem/reactos/hal/halx86/directory.xml --- branches/xmlbuildsystem/reactos/hal/halx86/directory.xml 2005-03-05 22:13:47 UTC (rev 13837) +++ branches/xmlbuildsystem/reactos/hal/halx86/directory.xml 2005-03-05 22:20:15 UTC (rev 13838) @@ -0,0 +1,12 @@ +<directory name="generic"> + <xi:include href="generic/generic.xml" /> +</directory> +<directory name="up"> + <xi:include href="up/halup.xml" /> +</directory> +<directory name="mp"> + <xi:include href="mp/halmp.xml" /> +</directory> +<directory name="xbox"> + <xi:include href="xbox/halxbox.xml" /> +</directory> _____ Added: branches/xmlbuildsystem/reactos/hal/halx86/generic/generic.xml --- branches/xmlbuildsystem/reactos/hal/halx86/generic/generic.xml 2005-03-05 22:13:47 UTC (rev 13837) +++ branches/xmlbuildsystem/reactos/hal/halx86/generic/generic.xml 2005-03-05 22:20:15 UTC (rev 13838) @@ -0,0 +1,31 @@ +<module name="hal_generic" type="staticlibrary"> + <include base="hal_generic">../include</include> + <include base="ntoskrnl">include</include> + <define name="_DISABLE_TIDENTS" /> + <define name="__NTHAL__" /> + <file>adapter.c</file> + <file>beep.c</file> + <file>bus.c</file> + <file>display.c</file> + <file>dma.c</file> + <file>drive.c</file> + <file>enum.c</file> + <file>fmutex.c</file> + <file>halinit.c</file> + <file>ipi.c</file> + <file>irql.c</file> + <file>isa.c</file> + <file>kdbg.c</file> + <file>mca.c</file> + <file>misc.c</file> + <file>pci.c</file> + <file>portio.c</file> + <file>processor.c</file> + <file>reboot.c</file> + <file>resource.c</file> + <file>spinlock.c</file> + <file>sysbus.c</file> + <file>sysinfo.c</file> + <file>time.c</file> + <file>timer.c</file> +</module> _____ Added: branches/xmlbuildsystem/reactos/hal/halx86/mp/halmp.xml --- branches/xmlbuildsystem/reactos/hal/halx86/mp/halmp.xml 2005-03-05 22:13:47 UTC (rev 13837) +++ branches/xmlbuildsystem/reactos/hal/halx86/mp/halmp.xml 2005-03-05 22:20:15 UTC (rev 13838) @@ -0,0 +1,16 @@ +<module name="halmp" type="kernelmodedll"> + <include base="hal_generic">../include</include> + <include base="ntoskrnl">include</include> + <define name="_DISABLE_TIDENTS" /> + <define name="CONFIG_SMP" /> + <define name="__NTHAL__" /> + <file>apic.c</file> + <file>halinit_mp.c</file> + <file>ipi_mp.c</file> + <file>mps.S</file> + <file>mpsboot.asm</file> + <file>mpsirql.c</file> + <file>processor_mp.c</file> + <file>resource_mp.c</file> + <file>halmp.rc</file> +</module> _____ Added: branches/xmlbuildsystem/reactos/hal/halx86/up/halup.xml --- branches/xmlbuildsystem/reactos/hal/halx86/up/halup.xml 2005-03-05 22:13:47 UTC (rev 13837) +++ branches/xmlbuildsystem/reactos/hal/halx86/up/halup.xml 2005-03-05 22:20:15 UTC (rev 13838) @@ -0,0 +1,9 @@ +<module name="halup" type="kernelmodedll"> + <bootstrap base="reactos" nameoncd="hal.dll" /> + <include base="hal_generic">../include</include> + <include base="ntoskrnl">include</include> + <define name="_DISABLE_TIDENTS" /> + <define name="__NTHAL__" /> + <file>halinit_up.c</file> + <file>halup.rc</file> +</module> _____ Added: branches/xmlbuildsystem/reactos/hal/halx86/xbox/halxbox.xml --- branches/xmlbuildsystem/reactos/hal/halx86/xbox/halxbox.xml 2005-03-05 22:13:47 UTC (rev 13837) +++ branches/xmlbuildsystem/reactos/hal/halx86/xbox/halxbox.xml 2005-03-05 22:20:15 UTC (rev 13838) @@ -0,0 +1,13 @@ +<module name="halxbox" type="kernelmodedll"> + <include base="hal_generic">../include</include> + <include base="ntoskrnl">include</include> + <define name="_DISABLE_TIDENTS" /> + <define name="UP" /> + <define name="__NTHAL__" /> + <file>display_xbox.c</file> + <file>font.c</file> + <file>halinit_xbox.c</file> + <file>part_xbox.c</file> + <file>pci_xbox.c</file> + <file>halxbox.rc</file> +</module>
19 years, 9 months
1
0
0
0
[chorns] 13837: Copy msiexec from trunk
by chorns@svn.reactos.com
Copy msiexec from trunk Added: branches/xmlbuildsystem/reactos/subsys/system/msiexec/ _____ Copied: branches/xmlbuildsystem/reactos/subsys/system/msiexec (from rev 13830, trunk/reactos/subsys/system/msiexec)
19 years, 9 months
1
0
0
0
← Newer
1
...
53
54
55
56
57
58
59
60
61
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Results per page:
10
25
50
100
200