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.

svn path=/branches/powerpc/; revision=25463
This commit is contained in:
Art Yerkes
2007-01-15 09:54:16 +00:00
parent e4aa183ac9
commit 674fbb117a
6 changed files with 47 additions and 38 deletions
+1 -1
View File
@@ -850,7 +850,7 @@ CmiScanKeyList(PKEY_OBJECT Parent,
ULONG Attributes,
PKEY_OBJECT* ReturnedObject)
{
PKEY_OBJECT CurKey;
PKEY_OBJECT CurKey = 0;
ULONG Index;
DPRINT("Scanning key list for: %wZ (Parent: %wZ)\n",
+9 -1
View File
@@ -34,10 +34,15 @@ BOOLEAN KdpEarlyBreak = FALSE;
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 @@ KdInitSystem(ULONG BootPhase,
/* 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 */
+1 -1
View File
@@ -1552,7 +1552,7 @@ KdpGdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
case 'c':
{
ULONG BreakpointNumber;
ULONG dr6_;
ULONG dr6_ = 0;
/* try to read optional parameter, pc unchanged if no parm */
if (GspHex2Long (&ptr, &Address))
+2
View File
@@ -122,6 +122,7 @@ INIT_FUNCTION
NTAPI
KiInitializeBugCheck(VOID)
{
#if 0
PRTL_MESSAGE_RESOURCE_DATA BugCheckData;
LDR_RESOURCE_INFO ResourceInfo;
PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
@@ -148,6 +149,7 @@ KiInitializeBugCheck(VOID)
NULL);
if (NT_SUCCESS(Status)) KiBugCodeMessages = BugCheckData;
}
#endif
}
VOID
+21 -5
View File
@@ -294,6 +294,11 @@ KiRosFrldrLpbToNtLpb(IN PROS_LOADER_PARAMETER_BLOCK RosLoaderBlock,
/* 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 @@ KiRosPrepareForSystemStartup(IN ULONG Dummy,
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 @@ KiRosPrepareForSystemStartup(IN ULONG Dummy,
}
/* 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,7 +468,13 @@ KiRosPrepareForSystemStartup(IN ULONG Dummy,
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
@@ -466,16 +482,16 @@ KiRosPrepareForSystemStartup(IN ULONG Dummy,
/* 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);
+13 -30
View File
@@ -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 @@ KiInitializePcr(IN ULONG ProcessorNumber,
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 @@ KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
/* 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 @@ KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
/* 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 @@ KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
&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 @@ AppCpuInit:
Prcb,
Cpu,
(PVOID)LoaderBlock);
TRACE;
}