[ros-diffs] [ion] 25852: - KPROCESSOR_STATE is not 4-byte aligned. - Fail physical memory reads for now. - Use the right kernel load address. - Generate image name when loading boot symbols. Now WinDBG sees "ntoskrnl.exe". - Fix KiSaveProcessorControlState and KiRestoreProcessorControlSate. The latter doesn't freeze the CPU anymore so it's enabled, and the former doesn't cause WinDBG to panic anymore and display weird data.

ion at svn.reactos.org ion at svn.reactos.org
Tue Feb 20 04:22:38 CET 2007


Author: ion
Date: Tue Feb 20 06:22:30 2007
New Revision: 25852

URL: http://svn.reactos.org/svn/reactos?rev=25852&view=rev
Log:
- KPROCESSOR_STATE is not 4-byte aligned.
- Fail physical memory reads for now.
- Use the right kernel load address.
- Generate image name when loading boot symbols. Now WinDBG sees "ntoskrnl.exe".
- Fix KiSaveProcessorControlState and KiRestoreProcessorControlSate. The latter doesn't freeze the CPU anymore so it's enabled, and the former doesn't cause WinDBG to panic anymore and display weird data.

Modified:
    branches/alex-kd-branch/reactos/include/ndk/i386/ketypes.h
    branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdapi.c
    branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdinit.c
    branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/cpu.c

Modified: branches/alex-kd-branch/reactos/include/ndk/i386/ketypes.h
URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/include/ndk/i386/ketypes.h?rev=25852&r1=25851&r2=25852&view=diff
==============================================================================
--- branches/alex-kd-branch/reactos/include/ndk/i386/ketypes.h (original)
+++ branches/alex-kd-branch/reactos/include/ndk/i386/ketypes.h Tue Feb 20 06:22:30 2007
@@ -350,7 +350,6 @@
 //
 // Processor State Data
 //
-#pragma pack(push,4)
 typedef struct _KPROCESSOR_STATE
 {
     CONTEXT ContextFrame;
@@ -360,6 +359,7 @@
 //
 // Processor Region Control Block
 //
+#pragma pack(push,4)
 typedef struct _KPRCB
 {
     USHORT MinorVersion;

Modified: branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdapi.c
URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdapi.c?rev=25852&r1=25851&r2=25852&view=diff
==============================================================================
--- branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdapi.c (original)
+++ branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdapi.c Tue Feb 20 06:22:30 2007
@@ -464,6 +464,7 @@
             case DbgKdReadPhysicalMemoryApi:
 
                 /* FIXME: TODO */
+                goto fail;
                 Ke386SetCr2(DbgKdReadPhysicalMemoryApi);
                 while (TRUE);
                 break;
@@ -653,6 +654,7 @@
 
                 /* Setup an empty message, with failure */
                 while (TRUE);
+fail:
                 Data.Length = 0;
                 ManipulateState.ReturnStatus = STATUS_UNSUCCESSFUL;
 

Modified: branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdinit.c
URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdinit.c?rev=25852&r1=25851&r2=25852&view=diff
==============================================================================
--- branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdinit.c (original)
+++ branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdinit.c Tue Feb 20 06:22:30 2007
@@ -68,7 +68,7 @@
     ANSI_STRING ImageName;
     PLDR_DATA_TABLE_ENTRY LdrEntry;
     PLIST_ENTRY NextEntry;
-    ULONG i;
+    ULONG i, j;
     CHAR NameBuffer[256];
 
     /* Check if this is Phase 1 */
@@ -132,7 +132,7 @@
                                      InLoadOrderLinks);
 
         /* Save the Kernel Base */
-        LdrEntry->DllBase = (PVOID)PsNtosImageBase;
+        PsNtosImageBase = (ULONG)LdrEntry->DllBase;
         KdVersionBlock.KernBase = (ULONGLONG)(LONG_PTR)LdrEntry->DllBase;
 
         /* Check if we have a command line */
@@ -230,6 +230,11 @@
                                              InLoadOrderLinks);
 
                 /* Generate the image name */
+                for (j = 0; j < LdrEntry->BaseDllName.Length / 2; j++)
+                {
+                    /* Do cheap Unicode to ANSI conversion */
+                    NameBuffer[j] = (CHAR)LdrEntry->BaseDllName.Buffer[j];
+                }
 
                 /* Load symbols for image */
                 RtlInitAnsiString(&ImageName, NameBuffer);

Modified: branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/cpu.c
URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/cpu.c?rev=25852&r1=25851&r2=25852&view=diff
==============================================================================
--- branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/cpu.c (original)
+++ branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/cpu.c Tue Feb 20 06:22:30 2007
@@ -678,7 +678,6 @@
 NTAPI
 KiRestoreProcessorControlState(PKPROCESSOR_STATE ProcessorState)
 {
-    return;
     /* Restore the CR registers */
     __writecr0(ProcessorState->SpecialRegisters.Cr0);
     Ke386SetCr2(ProcessorState->SpecialRegisters.Cr2);
@@ -698,8 +697,8 @@
     //
     // Restore GDT, IDT, LDT and TSS
     //
-    Ke386SetGlobalDescriptorTable(ProcessorState->SpecialRegisters.Gdtr);
-    Ke386SetInterruptDescriptorTable(ProcessorState->SpecialRegisters.Idtr);
+    Ke386SetGlobalDescriptorTable(ProcessorState->SpecialRegisters.Gdtr.Base);
+    Ke386SetInterruptDescriptorTable(ProcessorState->SpecialRegisters.Idtr.Base);
     Ke386SetTr(ProcessorState->SpecialRegisters.Tr);
     Ke386SetLocalDescriptorTable(ProcessorState->SpecialRegisters.Ldtr);
 }
@@ -725,8 +724,8 @@
     Ke386SetDr7(0);
 
     /* Save GDT, IDT, LDT and TSS */
-    Ke386GetGlobalDescriptorTable(ProcessorState->SpecialRegisters.Gdtr);
-    Ke386GetInterruptDescriptorTable(ProcessorState->SpecialRegisters.Idtr);
+    Ke386GetGlobalDescriptorTable(ProcessorState->SpecialRegisters.Gdtr.Base);
+    Ke386GetInterruptDescriptorTable(ProcessorState->SpecialRegisters.Idtr.Base);
     Ke386GetTr(ProcessorState->SpecialRegisters.Tr);
     Ke386GetLocalDescriptorTable(ProcessorState->SpecialRegisters.Ldtr);
 }




More information about the Ros-diffs mailing list