Author: arty Date: Mon Jan 15 12:54:16 2007 New Revision: 25463
URL: http://svn.reactos.org/svn/reactos?rev=25463&view=rev Log: Checkpoint. HalDisplayString is working and hooked up to DbgPrint. We've now got reciprocal imports from hal working. I've added a small hack, that being to relocate modules to 64k boundaries. This works around ABI issues for now. Some warning suppression re: uninitialized values. KdInit: make it possible to use a subset of the x86 debug targets.
Modified: branches/powerpc/reactos/ntoskrnl/cm/regobj.c branches/powerpc/reactos/ntoskrnl/kd/kdinit.c branches/powerpc/reactos/ntoskrnl/kd/wrappers/gdbstub.c branches/powerpc/reactos/ntoskrnl/ke/bug.c branches/powerpc/reactos/ntoskrnl/ke/freeldr.c branches/powerpc/reactos/ntoskrnl/ke/powerpc/kiinit.c
Modified: branches/powerpc/reactos/ntoskrnl/cm/regobj.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/cm/rego... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/cm/regobj.c (original) +++ branches/powerpc/reactos/ntoskrnl/cm/regobj.c Mon Jan 15 12:54:16 2007 @@ -850,7 +850,7 @@ ULONG Attributes, PKEY_OBJECT* ReturnedObject) { - PKEY_OBJECT CurKey; + PKEY_OBJECT CurKey = 0; ULONG Index;
DPRINT("Scanning key list for: %wZ (Parent: %wZ)\n",
Modified: branches/powerpc/reactos/ntoskrnl/kd/kdinit.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/kd/kdin... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/kd/kdinit.c (original) +++ branches/powerpc/reactos/ntoskrnl/kd/kdinit.c Mon Jan 15 12:54:16 2007 @@ -34,10 +34,15 @@ LIST_ENTRY KdProviders = {&KdProviders, &KdProviders}; KD_DISPATCH_TABLE DispatchTable[KdMax];
+#ifdef _M_IX86 PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit, KdpSerialInit, KdpInitDebugLog, KdpBochsInit}; +#elif defined(_M_PPC) +PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit, + KdpInitDebugLog}; +#endif
/* PRIVATE FUNCTIONS *********************************************************/
@@ -248,7 +253,10 @@ /* Call Providers at Phase 0 */ for (i = 0; i < KdMax; i++) { - InitRoutines[i](&DispatchTable[i], 0); + if(InitRoutines[i]) + { + InitRoutines[i](&DispatchTable[i], 0); + } }
/* Call Wrapper at Phase 0 */
Modified: branches/powerpc/reactos/ntoskrnl/kd/wrappers/gdbstub.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/kd/wrap... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/kd/wrappers/gdbstub.c (original) +++ branches/powerpc/reactos/ntoskrnl/kd/wrappers/gdbstub.c Mon Jan 15 12:54:16 2007 @@ -1552,7 +1552,7 @@ case 'c': { ULONG BreakpointNumber; - ULONG dr6_; + ULONG dr6_ = 0;
/* try to read optional parameter, pc unchanged if no parm */ if (GspHex2Long (&ptr, &Address))
Modified: branches/powerpc/reactos/ntoskrnl/ke/bug.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/bug.... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/bug.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/bug.c Mon Jan 15 12:54:16 2007 @@ -122,6 +122,7 @@ NTAPI KiInitializeBugCheck(VOID) { +#if 0 PRTL_MESSAGE_RESOURCE_DATA BugCheckData; LDR_RESOURCE_INFO ResourceInfo; PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry; @@ -148,6 +149,7 @@ NULL); if (NT_SUCCESS(Status)) KiBugCodeMessages = BugCheckData; } +#endif }
VOID
Modified: branches/powerpc/reactos/ntoskrnl/ke/freeldr.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/free... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/freeldr.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/freeldr.c Mon Jan 15 12:54:16 2007 @@ -294,6 +294,11 @@ /* Parse it and change every slash to a space */ BootPath = LoaderBlock->LoadOptions; do {if (*BootPath == '/') *BootPath = ' ';} while (*BootPath++); + +#ifdef _M_PPC + /* Finally link to the ReactOS specific part in the extension section */ + LoaderBlock->u.PowerPC.BootInfo = &KeRosLoaderBlock; +#endif }
VOID @@ -325,6 +330,7 @@ boot_infos_t *XBootInfo = (boot_infos_t *)LoaderBlock->ArchExtra; memcpy(&PpcEarlybootInfo, XBootInfo, sizeof(PpcEarlybootInfo)); PpcEarlybootInfo.dispFont = BootDigits; + LoaderBlock->ArchExtra = (ULONG)&PpcEarlybootInfo; BootInfo = (struct _boot_infos_t *)&PpcEarlybootInfo; DrawNumber(BootInfo, 0x1234abcd, 10, 100); DrawNumber(BootInfo, (ULONG)nk, 10 , 150); @@ -447,10 +453,14 @@ }
/* Choose last module address as the final kernel address */ + /* This is a workaround re: high and low adjust. + * The ABI we're using doesn't respect HIGHADJ pairing like compilers for NT do, so well be a bit + * lenient. This can be fixed later. + */ +#ifndef _M_PPC MmFreeLdrLastKernelAddress = PAGE_ROUND_UP(KeLoaderModules[KeRosLoaderBlock.ModsCount - 1].ModEnd);
-#ifndef _M_PPC /* Select the HAL Base */ HalBase = KeLoaderModules[1].ModStart;
@@ -458,23 +468,29 @@ DriverBase = MmFreeLdrLastKernelAddress; LdrHalBase = (ULONG_PTR)DriverBase; #else + MmFreeLdrLastKernelAddress = + ROUND_UP(KeLoaderModules[KeRosLoaderBlock.ModsCount - 1].ModEnd, 0x10000); + + /* Select the HAL Base */ HalBase = KeLoaderModules[1].ModStart; + + /* Choose Driver Base */ DriverBase = MmFreeLdrLastKernelAddress; LdrHalBase = KeLoaderModules[1].ModStart; #endif
/* Initialize Module Management */ LdrInitModuleManagement((PVOID)KeLoaderModules[0].ModStart); + +#ifdef _M_PPC + LdrpSettleHal((PVOID)DriverBase); +#endif
/* Load HAL.DLL with the PE Loader */ LdrSafePEProcessModule((PVOID)HalBase, (PVOID)DriverBase, (PVOID)KeLoaderModules[0].ModStart, &DriverSize); - -#ifdef _M_PPC - LdrpSettleHal((PVOID)DriverBase); -#endif
/* Increase the last kernel address with the size of HAL */ MmFreeLdrLastKernelAddress += PAGE_ROUND_UP(DriverSize);
Modified: branches/powerpc/reactos/ntoskrnl/ke/powerpc/kiinit.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/powe... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/powerpc/kiinit.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/powerpc/kiinit.c Mon Jan 15 12:54:16 2007 @@ -14,11 +14,17 @@
#define NDEBUG #include <debug.h> +#include <ppcdebug.h>
/* GLOBALS *******************************************************************/ + +/* Ku bit should be set, so that we get the best options for page protection */ +#define PPC_SEG_Ku 0x40000000 +#define PPC_SEG_Ks 0x20000000
extern LOADER_MODULE KeLoaderModules[64]; extern ULONG KeLoaderModuleCount; +extern ULONG_PTR MmFreeLdrLastKernelAddress; KPRCB PrcbData[MAXIMUM_PROCESSORS];
/* FUNCTIONS *****************************************************************/ @@ -78,29 +84,17 @@ IN PKTHREAD IdleThread, IN PVOID DpcStack) { - TRACE; Pcr->MajorVersion = PCR_MAJOR_VERSION; - TRACE; Pcr->MinorVersion = PCR_MINOR_VERSION; - TRACE; Pcr->CurrentIrql = PASSIVE_LEVEL; - TRACE; Pcr->Prcb = PrcbData; - TRACEXY(Pcr->Prcb, PrcbData); Pcr->Prcb->MajorVersion = 1; - TRACE; Pcr->Prcb->MinorVersion = 1; - TRACE; Pcr->Prcb->Number = 0; /* UP for now */ - TRACE; Pcr->Prcb->SetMember = 1; - TRACE; Pcr->Prcb->BuildType = 0; - TRACE; Pcr->Prcb->DpcStack = DpcStack; - TRACE; KiProcessorBlock[ProcessorNumber] = Pcr->Prcb; - TRACEXY(0xd00d,0xbeef); }
extern ULONG KiGetFeatureBits(); @@ -257,7 +251,7 @@
/* Set up segs for normal paged address space. */ for( i = 0; i < 16; i++ ) { - SetSR(i, i); + SetSR(i, (i < 8 ? PPC_SEG_Ku : PPC_SEG_Ks) | i); }
/* Save the loader block and get the current CPU */ @@ -269,14 +263,13 @@ /* We'll allocate a page from the end of the kernel area for KPCR. This code will probably * change when we get SMP support. */ - ULONG LastPage = ROUND_UP(KeLoaderModules[KeLoaderModuleCount-1].ModEnd,1<<PAGE_SHIFT); - PhysicalPage = PpcVirt2phys(LastPage, FALSE); + PhysicalPage = PpcVirt2phys(MmFreeLdrLastKernelAddress, FALSE); + MmFreeLdrLastKernelAddress += (1<<PAGE_SHIFT); InsertPageEntry((ULONG)Pcr, PhysicalPage, 0, 0); - *((PULONG)Pcr) = -1; - if(!((PULONG)Pcr)) { - TRACEXY(0xCABBA9E, 0xC0FFEE); - while(1); - } + + PhysicalPage = PpcVirt2phys(MmFreeLdrLastKernelAddress, FALSE); + MmFreeLdrLastKernelAddress += (1<<PAGE_SHIFT); + InsertPageEntry((ULONG)KI_USER_SHARED_DATA, PhysicalPage, 0, 0); }
/* Skip initial setup if this isn't the Boot CPU */ @@ -289,44 +282,35 @@ &KiInitialThread.Tcb, KiDoubleFaultStack);
- TRACE; /* Set us as the current process */ KiInitialThread.Tcb.ApcState.Process = &KiInitialProcess.Pcb;
- TRACE; /* Setup CPU-related fields */ AppCpuInit: - TRACE; Prcb = Pcr->Prcb; Pcr->Number = Cpu; Pcr->SetMember = 1 << Cpu; Prcb->SetMember = 1 << Cpu;
- TRACE; /* Initialize the Processor with HAL */ HalInitializeProcessor(Cpu, LoaderBlock);
- TRACE; /* Set active processors */ KeActiveProcessors |= Pcr->SetMember; KeNumberProcessors++;
- TRACE; /* Initialize the Debugger for the Boot CPU */ if (!Cpu) KdInitSystem (0, LoaderBlock);
- TRACE; /* Check for break-in */ if (KdPollBreakIn()) { DbgBreakPointWithStatus(1); }
- TRACE; /* Raise to HIGH_LEVEL */ KfRaiseIrql(HIGH_LEVEL);
- TRACE; /* Call main kernel intialization */ KiInitializeKernel(&KiInitialProcess.Pcb, &KiInitialThread.Tcb, @@ -334,6 +318,5 @@ Prcb, Cpu, (PVOID)LoaderBlock); - TRACE; -} - +} +