[ros-diffs] [arty] 29928: Fix memory map to kernel mode. Allow prep serial in kdcom (and stop clobbering the data miss handler). Clean up boot mapping a bit. Silence some boot time spam. Enable not present page handler (yes, this routing actually works). Scan physical memory on the (virtually 100%) chance that open firmware will somehow have a buggy implementation of the memory object, or we're on prep hardware. Initialize syscall trap early, so we can do DbgPrint.

arty at svn.reactos.org arty at svn.reactos.org
Sun Oct 28 13:31:12 CET 2007


Author: arty
Date: Sun Oct 28 15:31:10 2007
New Revision: 29928

URL: http://svn.reactos.org/svn/reactos?rev=29928&view=rev
Log:
Fix memory map to kernel mode.
Allow prep serial in kdcom (and stop clobbering the data miss handler).
Clean up boot mapping a bit.
Silence some boot time spam.
Enable not present page handler (yes, this routing actually works).
Scan physical memory on the (virtually 100%) chance that open firmware will
somehow have a buggy implementation of the memory object, or we're on prep
hardware.
Initialize syscall trap early, so we can do DbgPrint.

Modified:
    trunk/reactos/boot/freeldr/freeldr/arch/powerpc/loader.c
    trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
    trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c
    trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c
    trunk/reactos/boot/freeldr/freeldr/include/reactos.h
    trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c
    trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c
    trunk/reactos/drivers/base/kdcom/kdbg.c
    trunk/reactos/ntoskrnl/ke/freeldr.c
    trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c
    trunk/reactos/ntoskrnl/mm/powerpc/pfault.c
    trunk/reactos/ntoskrnl/ntoskrnl_powerpc.lnk

Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/loader.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/powerpc/loader.c?rev=29928&r1=29927&r2=29928&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/loader.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/loader.c Sun Oct 28 15:31:10 2007
@@ -22,7 +22,9 @@
 
 #define NDEBUG
 #include <debug.h>
+
 #undef DbgPrint
+#define DbgPrint printf
 
 extern PVOID KernelMemory;
 
@@ -96,13 +98,11 @@
         BaseAddress = (PVOID)((ULONG_PTR)BaseAddress - KSEG0_BASE + (ULONG)KernelMemory);
     }
 
-    DbgPrint("Exports: RtlImageDirectoryEntryToData\n");
     ExportDir = (PIMAGE_EXPORT_DIRECTORY)
         RtlImageDirectoryEntryToData(BaseAddress,
                                      TRUE,
                                      IMAGE_DIRECTORY_ENTRY_EXPORT,
                                      &ExportDirSize);
-    DbgPrint("RtlImageDirectoryEntryToData done\n");
     if (!ExportDir)
     {
         DbgPrint("LdrPEGetExportByName(): no export directory!\n");
@@ -202,7 +202,6 @@
             if ((ULONG_PTR)Function >= (ULONG_PTR)ExportDir &&
                 (ULONG_PTR)Function < (ULONG_PTR)ExportDir + ExportDirSize)
             {
-                DbgPrint("Forward: %s\n", (PCHAR)Function);
                 Function = LdrPEFixupForward((PCHAR)Function);
                 if (Function == NULL)
                 {
@@ -323,16 +322,12 @@
     PLOADER_MODULE ImportedModule;
     ULONG Size;
 
-    printf("Fixing up %x (%s)\n", DllBase, DllName);
-
     /*  Process each import module  */
-    DbgPrint("FixupImports: RtlImageDirectoryEntryToData\n");
     ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR)
         RtlImageDirectoryEntryToData(DllBase,
                                      TRUE,
                                      IMAGE_DIRECTORY_ENTRY_IMPORT,
                                      &Size);
-    DbgPrint("RtlImageDirectoryEntryToData done\n");
     while (ImportModuleDirectory && ImportModuleDirectory->Name)
     {
         /*  Check to make sure that import lib is kernel  */

Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c?rev=29928&r1=29927&r2=29928&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c Sun Oct 28 15:31:10 2007
@@ -301,6 +301,9 @@
     }
 }
 
+ULONG PpcPrepGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
+                           ULONG MaxMemoryMapSize );
+
 /*
  * Get memory the proper openfirmware way
  */
@@ -319,7 +322,7 @@
     printf("Returned data: %d\n", returned);
     if( returned == -1 ) {
 	printf("getprop /memory[@reg] failed\n");
-	return 0;
+        return PpcPrepGetMemoryMap( BiosMemoryMap, MaxMemoryMapSize );
     }
 
     for( i = 0; i < returned; i++ ) {
@@ -328,7 +331,7 @@
     printf("\n");
 
     for( i = 0; i < returned / 2; i++ ) {
-	BiosMemoryMap[slots].Type = 1/*MEMTYPE_USABLE*/;
+	BiosMemoryMap[slots].Type = BiosMemoryUsable;
 	BiosMemoryMap[slots].BaseAddress = memdata[i*2];
 	BiosMemoryMap[slots].Length = memdata[i*2+1];
 	printf("MemoryMap[%d] = (%x:%x)\n",

Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c?rev=29928&r1=29927&r2=29928&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c Sun Oct 28 15:31:10 2007
@@ -123,18 +123,59 @@
     while(1);
 }
 
+typedef struct _ppc_map_set_t {
+    int mapsize;
+    int usecount;
+    ppc_map_info_t *info;
+} ppc_map_set_t;
+
 VOID
 NTAPI
+FrLdrAddPageMapping(ppc_map_set_t *set, int proc, paddr_t phys, vaddr_t virt)
+{
+    int j;
+    paddr_t page = ROUND_DOWN(phys, (1<<PFN_SHIFT));
+    if (virt == 0)
+        virt = page;
+    else
+        virt = ROUND_DOWN(virt, (1<<PFN_SHIFT));
+
+    for( j = 0; j < set->usecount; j++ )
+    {
+        if(set->info[j].addr == page) return;
+    }
+
+    if (!set->mapsize)
+    {
+        set->mapsize = 0x80;
+        set->info = MmAllocateMemory(0x80 * sizeof(*set->info));
+    }
+    else if (set->mapsize <= set->usecount)
+    {
+        ppc_map_info_t *newinfo = MmAllocateMemory(set->mapsize * 2 * sizeof(*set->info));
+        memcpy(newinfo, set->info, set->mapsize * sizeof(*set->info));
+        MmFreeMemory(set->info);
+        set->info = newinfo;
+        set->mapsize *= 2;
+    }
+    
+    set->info[set->usecount].flags = MMU_ALL_RW;
+    set->info[set->usecount].proc = proc;
+    set->info[set->usecount].addr = virt;
+    set->info[set->usecount].phys = page;
+    set->usecount++;
+}
+
+VOID
+NTAPI
 FrLdrStartup(ULONG Magic)
 {
-    ULONG_PTR i, j, page, count;
+    ULONG_PTR i, tmp;
     PCHAR ModHeader;
     boot_infos_t *LocalBootInfo = &BootInfo;
     LocalBootInfo->dispFont = (font_char *)&LocalBootInfo[1];
     LoaderBlock.ArchExtra = (ULONG)LocalBootInfo;
-    ppc_map_info_t *info = MmAllocateMemory(0x80 * sizeof(*info));
-
-    printf("FrLdrStartup(KernelEntry = %x)\n", KernelEntryPoint);
+    ppc_map_set_t memmap = { };
 
     for(i = 0; i < LoaderBlock.ModsCount; i++)
     {
@@ -145,85 +186,52 @@
 		 (PCHAR)reactos_modules[i].String);
     }
 
-    printf("PpcInitializeMmu\n");
+    /* We don't use long longs, but longs for the addresses in the 
+     * ADDRESS_RANGE structure.  Swap the quad halves of our memory
+     * map.
+     */
+    for( i = 0; 
+         i < reactos_memory_map_descriptor_size / sizeof(reactos_memory_map[0]); 
+         i++ )
+    {
+        tmp = reactos_memory_map[i].base_addr_high;
+        reactos_memory_map[i].base_addr_high = reactos_memory_map[i].base_addr_low;
+        reactos_memory_map[i].base_addr_low = tmp;
+        tmp = reactos_memory_map[i].length_high;
+        reactos_memory_map[i].length_high = reactos_memory_map[i].length_low;
+        reactos_memory_map[i].length_low = tmp;
+    }
+
     PpcInitializeMmu(0);
-    printf("PpcInitializeMmu done\n");
 
     /* We'll use vsid 1 for freeldr (expendable) */
     MmuAllocVsid(1, 0xff);
-    printf("(1)\n");
     MmuSetVsid(0, 8, 1);
-    printf("(2)\n");
 
     MmuAllocVsid(0, 0xff00);
-    printf("(3)\n");
     MmuSetVsid(8, 16, 0);
-    printf("(4)\n");
-
-    printf("MmuSetTrapHandler\n");
-    MmuSetTrapHandler(3, MmuPageMiss);
-    MmuSetTrapHandler(4, MmuPageMiss);
-    printf("MmuSetTrapHandler done\n");
-
-    info = MmAllocateMemory((KernelMemorySize >> PAGE_SHIFT) * sizeof(*info));
-    printf("page info at %x\n", info);
 
     /* Map kernel space 0x80000000 ... */
-    for( i = (ULONG)KernelMemory, page = 0;
+    for( i = (ULONG)KernelMemory;
 	 i < (ULONG)KernelMemory + KernelMemorySize;
-	 i += (1<<PFN_SHIFT), page++ ) {
-	info[page].proc = 0;
-	info[page].addr = KernelBase + (page << PAGE_SHIFT);
-	info[page].phys = i; //PpcVirt2phys(i, 1);
-	info[page].flags = MMU_ALL_RW;
-    }
-
-    printf("Adding page info (%d pages)\n", page);
-    MmuMapPage(info, page);
-    printf("Adding page info (%d pages) ... done\n", page);
+	 i += (1<<PFN_SHIFT) ) {
+        
+        FrLdrAddPageMapping(&memmap, 0, i, KernelBase + i - (ULONG)KernelMemory);
+    }
 
     /* Map module name strings */
-    for( count = 0, i = 0; i < LoaderBlock.ModsCount; i++ )
-    {
-        printf("Checking string %s\n", reactos_modules[i].String);
-	page = ROUND_DOWN(((ULONG)reactos_modules[i].String), (1<<PFN_SHIFT));
-	for( j = 0; j < count; j++ )
-	{
-	    if(info[j].addr == page) break;
-	}
-	if( j != count )
-	{
-            printf("Mapping page %x containing string %s\n",
-                   page, reactos_modules[i].String);
-	    info[count].flags = MMU_ALL_RW;
-	    info[count].proc = 1;
-	    info[count].addr = page;
-	    info[count].phys = page; // PpcVirt2phys(page, 0);
-	    count++;
-	}
-    }
-
-    page = ROUND_DOWN((vaddr_t)&LoaderBlock, (1 << PAGE_SHIFT));
-    for( j = 0; j < count; j++ )
-    {
-	if(info[j].addr == page) break;
-    }
-
-    if( j != count )
-    {
-	info[count].flags = MMU_ALL_RW;
-	info[count].proc = 1;
-	info[count].addr = page;
-	info[count].phys = page; // PpcVirt2phys(page, 0);
-	count++;
-    }
-    printf("Mapping module name strings\n");
-    MmuMapPage(info, count);
-    printf("Module name strings mapped\n");
-
-    printf("MmuTurnOn(KernelEntry = %x)\n", KernelEntryPoint);
+    for( i = 0; i < LoaderBlock.ModsCount; i++ )
+    {
+        FrLdrAddPageMapping(&memmap, 1, (ULONG)reactos_modules[i].String, 0);
+    }
+
+    /* Map memory zones */
+    FrLdrAddPageMapping(&memmap, 1, (vaddr_t)&reactos_memory_map_descriptor_size, 0);
+    FrLdrAddPageMapping(&memmap, 1, (vaddr_t)&LoaderBlock, 0);
+
+    MmuMapPage(memmap.info, memmap.usecount);
+
     MmuTurnOn((KernelEntryFn)KernelEntryPoint, (void*)&LoaderBlock);
-    printf("MAED OF FALE!!1\n");
 
     /* Nothing more */
     while(1);
@@ -393,7 +401,7 @@
 	MemLoadAddr = (PCHAR)NextModuleBase;
 
     ModuleData = &reactos_modules[LoaderBlock.ModsCount];
-    printf("Loading file (elf at %x)\n", KernelAddr);
+    //printf("Loading file (elf at %x)\n", KernelAddr);
 
     /* Load the first 1024 bytes of the kernel image so we can read the PE header */
     if (!FsReadFile(KernelImage, sizeof(ehdr), NULL, &ehdr)) {
@@ -413,8 +421,6 @@
     /* Read section headers */
     FsSetFilePointer(KernelImage,  ehdr.e_shoff);
     FsReadFile(KernelImage, shsize * shnum, NULL, sptr);
-
-    printf("Loaded section headers\n");
 
     /* Now we'll get the PE Header */
     for( i = 0; i < shnum; i++ )
@@ -429,12 +435,14 @@
 	    FsReadFile(KernelImage, shdr->sh_size, NULL, MemLoadAddr);
 	    ImageHeader = (PIMAGE_DOS_HEADER)MemLoadAddr;
 	    NtHeader = (PIMAGE_NT_HEADERS)((PCHAR)MemLoadAddr + SWAPD(ImageHeader->e_lfanew));
+#if 0
 	    printf("NtHeader at %x\n", SWAPD(ImageHeader->e_lfanew));
 	    printf("SectionAlignment %x\n",
 		   SWAPD(NtHeader->OptionalHeader.SectionAlignment));
 	    SectionAddr = ROUND_UP
 		(shdr->sh_size, SWAPD(NtHeader->OptionalHeader.SectionAlignment));
 	    printf("Header ends at %x\n", SectionAddr);
+#endif
 	    break;
 	}
     }
@@ -444,10 +452,12 @@
 	printf("No peheader section encountered :-(\n");
 	return 0;
     }
+#if 0
     else
     {
         printf("DOS SIG: %s\n", (PCHAR)MemLoadAddr);
     }
+#endif
 
     /* Save the Image Base */
     NtHeader->OptionalHeader.ImageBase = SWAPD(KernelAddr);
@@ -455,8 +465,6 @@
     /* Load the file image */
     Section = COFF_FIRST_SECTION(NtHeader);
     SectionCount = SWAPW(NtHeader->FileHeader.NumberOfSections);
-
-    printf("Section headers at %x\n", Section);
 
     /* Walk each section */
     for (i=0; i < SectionCount; i++, Section++)
@@ -603,11 +611,13 @@
     ModuleData->ModEnd = NextModuleBase;
     ModuleData->String = (ULONG)MmAllocateMemory(strlen(ImageName)+1);
     strcpy((PCHAR)ModuleData->String, ImageName);
+#if 0
     printf("Module %s (%x-%x) next at %x\n",
 	   ModuleData->String,
 	   ModuleData->ModStart,
 	   ModuleData->ModEnd,
 	   NextModuleBase);
+#endif
     LoaderBlock.ModsCount++;
 
     /* Return Success */
@@ -640,7 +650,6 @@
 
     /* Allocate kernel memory */
     KernelMemory = MmAllocateMemory(KernelMemorySize);
-    printf("Kernel Memory @%x\n", (int)KernelMemory);
 
     return FrLdrMapModule(KernelImage, "ntoskrnl.exe", KernelMemory, KernelBase);
 }
@@ -679,11 +688,6 @@
     ModuleData->ModStart = NextModuleBase;
     ModuleData->ModEnd = NextModuleBase + LocalModuleSize;
 
-    printf("Module size %x len %x name %s\n",
-	   ModuleData->ModStart,
-	   ModuleData->ModEnd - ModuleData->ModStart,
-	   ModuleName);
-
     /* Save name */
     strcpy(NameBuffer, ModuleName);
     ModuleData->String = (ULONG_PTR)NameBuffer;

Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c?rev=29928&r1=29927&r2=29928&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c Sun Oct 28 15:31:10 2007
@@ -71,10 +71,36 @@
 ULONG PpcPrepGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
 			   ULONG MaxMemoryMapSize )
 {
-    // xxx fixme
-    BiosMemoryMap[0].Type = 1;
-    BiosMemoryMap[0].BaseAddress = 0xe80000;
-    BiosMemoryMap[0].Length = (64 * 1024 * 1024) - BiosMemoryMap[0].BaseAddress;
+    // Probe memory
+    paddr_t physAddr;
+    register int oldStore = 0, newStore = 0, change = 0, oldmsr;
+
+    __asm__("mfmsr %0\n" : "=r" (oldmsr));
+    change = oldmsr & 0x6fff;
+    __asm__("mtmsr %0\n" : : "r" (change));
+
+    // Find the last ram address in physical space ... this bypasses mapping
+    // but could run into non-ram objects right above ram.  Usually systems
+    // aren't designed like that though.
+    for (physAddr = 0x30000, change = newStore; 
+         (physAddr < 0x80000000) && (change == newStore); 
+         physAddr += 1 << 12)
+    {
+        oldStore = GetPhys(physAddr);
+        newStore = (physAddr & 0x1000) ? 0x55aa55aa : 0xaa55aa55;
+        SetPhys(physAddr, newStore);
+        change = GetPhys(physAddr);
+        SetPhys(physAddr, oldStore);
+    }
+    // Back off by one page
+    physAddr -= 0x1000;
+    BiosMemoryMap[0].BaseAddress = 0x30000; // End of ppcmmu
+    BiosMemoryMap[0].Type = BiosMemoryUsable;
+    BiosMemoryMap[0].Length = physAddr - BiosMemoryMap[0].BaseAddress;
+
+    __asm__("mtmsr %0\n" : : "r" (oldmsr));
+
+    printf("Actual RAM: %d Mb\n", physAddr >> 20);
     PpcInitializeMmu(BiosMemoryMap[0].BaseAddress + BiosMemoryMap[0].Length);
     return 1;
 }

Modified: trunk/reactos/boot/freeldr/freeldr/include/reactos.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/include/reactos.h?rev=29928&r1=29927&r2=29928&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/reactos.h (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/reactos.h Sun Oct 28 15:31:10 2007
@@ -84,8 +84,13 @@
 extern char					reactos_kernel_cmdline[255];	// Command line passed to kernel
 extern LOADER_MODULE		reactos_modules[64];		// Array to hold boot module info loaded for the kernel
 extern char					reactos_module_strings[64][256];	// Array to hold module names
-extern unsigned long		reactos_memory_map_descriptor_size;
-extern memory_map_t			reactos_memory_map[32];		// Memory map
+typedef struct _reactos_mem_data {
+    unsigned long			memory_map_descriptor_size;
+    memory_map_t			memory_map[32];		// Memory map
+} reactos_mem_data_t;
+extern reactos_mem_data_t reactos_mem_data;
+#define reactos_memory_map_descriptor_size reactos_mem_data.memory_map_descriptor_size
+#define reactos_memory_map reactos_mem_data.memory_map
 
 VOID FASTCALL FrLdrSetupPae(ULONG Magic);
 VOID FASTCALL FrLdrSetupPageDirectory(VOID);

Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c?rev=29928&r1=29927&r2=29928&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c Sun Oct 28 15:31:10 2007
@@ -29,8 +29,9 @@
 char					reactos_kernel_cmdline[255];	// Command line passed to kernel
 LOADER_MODULE			reactos_modules[64];		// Array to hold boot module info loaded for the kernel
 char					reactos_module_strings[64][256];	// Array to hold module names
-unsigned long			reactos_memory_map_descriptor_size;
-memory_map_t			reactos_memory_map[32];		// Memory map
+// Make this a single struct to guarantee that these elements are nearby in
+// memory.  
+reactos_mem_data_t reactos_mem_data;
 ARC_DISK_SIGNATURE      reactos_arc_disk_info[32]; // ARC Disk Information
 char                    reactos_arc_strings[32][256];
 unsigned long           reactos_disk_count = 0;
@@ -409,7 +410,7 @@
         if (rc != ERROR_SUCCESS) OrderList[0] = 0;
 
         /* enumerate all drivers */
-        for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++) {
+        for (TagIndex = 1; TagIndex <= SWAPD(OrderList[0]); TagIndex++) {
 
             Index = 0;
 
@@ -603,10 +604,13 @@
     LoaderBlock.MmapLength = (unsigned long)MachGetMemoryMap((PBIOS_MEMORY_MAP)reactos_memory_map, 32) * sizeof(memory_map_t);
     if (LoaderBlock.MmapLength)
     {
+#ifdef _M_IX86
         ULONG i;
+#endif
         LoaderBlock.Flags |= MB_FLAGS_MEM_INFO | MB_FLAGS_MMAP_INFO;
         LoaderBlock.MmapAddr = (unsigned long)&reactos_memory_map;
         reactos_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24
+#ifdef _M_IX86
         for (i=0; i<(LoaderBlock.MmapLength/sizeof(memory_map_t)); i++)
         {
             if (BiosMemoryUsable == reactos_memory_map[i].type &&
@@ -625,6 +629,7 @@
                 LoaderBlock.MemHigher = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024 - 1024;
             }
         }
+#endif
     }
 
 	/*
@@ -761,10 +766,13 @@
     LoadBase = FrLdrLoadImage(szKernelName, 5, 1);
     if (!LoadBase) return;
 
+    printf("Kernel loaded at %x\n", LoadBase);
+
     /* Get the NT header, kernel base and kernel entry */
     NtHeader = RtlImageNtHeader(LoadBase);
-    KernelBase = NtHeader->OptionalHeader.ImageBase;
-    KernelEntryPoint = KernelBase + NtHeader->OptionalHeader.AddressOfEntryPoint;
+    KernelBase = SWAPD(NtHeader->OptionalHeader.ImageBase);
+    KernelEntryPoint = KernelBase + SWAPD(NtHeader->OptionalHeader.AddressOfEntryPoint);
+    printf("KernelEntryPoint is %x (base %x)\n", KernelEntryPoint, KernelBase);
     LoaderBlock.KernelBase = KernelBase;
 
 	/*
@@ -836,14 +844,18 @@
 	/*
 	 * Load boot drivers
 	 */
+        printf("FrLdrLoadBootDrivers\n");
 	FrLdrLoadBootDrivers(szBootPath, 40);
+        printf("FrLdrLoadBootDrivers end\n");
 	//UiUnInitialize("Booting ReactOS...");
 
 	/*
 	 * Now boot the kernel
 	 */
 	DiskStopFloppyMotor();
+        printf("MachVideoPrepareForReactOS\n");
     MachVideoPrepareForReactOS(FALSE);
+    printf("FrLdrStartup\n");
     FrLdrStartup(0x2badb002);
 }
 

Modified: trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c?rev=29928&r1=29927&r2=29928&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c Sun Oct 28 15:31:10 2007
@@ -29,8 +29,7 @@
 char					reactos_kernel_cmdline[255];	// Command line passed to kernel
 LOADER_MODULE			reactos_modules[64];		// Array to hold boot module info loaded for the kernel
 char					reactos_module_strings[64][256];	// Array to hold module names
-unsigned long			reactos_memory_map_descriptor_size;
-memory_map_t			reactos_memory_map[32];		// Memory map
+reactos_mem_data_t reactos_mem_data;
 char szBootPath[256];
 char szHalName[256];
 CHAR SystemRoot[255];

Modified: trunk/reactos/drivers/base/kdcom/kdbg.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kdcom/kdbg.c?rev=29928&r1=29927&r2=29928&view=diff
==============================================================================
--- trunk/reactos/drivers/base/kdcom/kdbg.c (original)
+++ trunk/reactos/drivers/base/kdcom/kdbg.c Sun Oct 28 15:31:10 2007
@@ -294,8 +294,12 @@
 	ULONG	Unknown2
 	)
 {
+#ifdef _M_IX86
         ULONG BaseArray[5] = {0, 0x3F8, 0x2F8, 0x3E8, 0x2E8};
-		PUCHAR ComPortBase;
+#elif defined(_M_PPC)
+        ULONG BaseArray[5] = {0, 0x800003f8};
+#endif
+        PUCHAR ComPortBase;
         char buffer[80];
         ULONG divisor;
         UCHAR lcr;

Modified: trunk/reactos/ntoskrnl/ke/freeldr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/freeldr.c?rev=29928&r1=29927&r2=29928&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/freeldr.c (original)
+++ trunk/reactos/ntoskrnl/ke/freeldr.c Sun Oct 28 15:31:10 2007
@@ -1181,6 +1181,10 @@
 }
 
 VOID
+NTAPI
+KiSetupSyscallHandler();
+
+VOID
 FASTCALL
 KiRosPrepareForSystemStartup(IN ULONG Dummy,
                              IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
@@ -1206,6 +1210,10 @@
     TssEntry->HighWord.Bytes.BaseHi = (UCHAR)((ULONG_PTR)Tss >> 24);
 #endif
 
+#if defined(_M_PPC)
+    KiSetupSyscallHandler();
+#endif
+
     /* Save pointer to ROS Block */
     KeRosLoaderBlock = LoaderBlock;
     MmFreeLdrLastKernelAddress = PAGE_ROUND_UP(KeRosLoaderBlock->

Modified: trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c?rev=29928&r1=29927&r2=29928&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c (original)
+++ trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c Sun Oct 28 15:31:10 2007
@@ -226,7 +226,7 @@
 KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
 {
     ULONG Cpu;
-    ppc_map_info_t info[3];
+    ppc_map_info_t info[4];
     PKIPCR Pcr = (PKIPCR)KPCR_BASE;
     PKPRCB Prcb;
 
@@ -259,7 +259,11 @@
 	info[2].proc = 2;
 	info[2].addr = (vaddr_t)KI_USER_SHARED_DATA;
 	info[2].flags = MMU_KRW_UR;
-	MmuMapPage(info, 3);
+        info[3].phys = 0;
+        info[3].proc = 2;
+        info[3].addr = (vaddr_t)KIP0PCRADDRESS;
+        info[3].flags = MMU_KRW_UR;
+	MmuMapPage(info, 4);
     }
 
     /* Skip initial setup if this isn't the Boot CPU */

Modified: trunk/reactos/ntoskrnl/mm/powerpc/pfault.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/powerpc/pfault.c?rev=29928&r1=29927&r2=29928&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/powerpc/pfault.c (original)
+++ trunk/reactos/ntoskrnl/mm/powerpc/pfault.c Sun Oct 28 15:31:10 2007
@@ -17,6 +17,11 @@
 
 /* EXTERNS *******************************************************************/
 
+NTSTATUS
+NTAPI
+MmNotPresentFault(KPROCESSOR_MODE Mode,
+                  ULONG_PTR Address,
+                  BOOLEAN FromMdl);
 extern ULONG KiKernelTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2);
 
 /* FUNCTIONS *****************************************************************/
@@ -61,8 +66,7 @@
     }
     else
     {
-	KeBugCheck(0);
-	//Status = MmNotPresentFault(Mode, (PVOID)VirtualAddr, FALSE, TrapInfo);
+	Status = MmNotPresentFault(Mode, VirtualAddr, FALSE);
     }
 
     if (NT_SUCCESS(Status))

Modified: trunk/reactos/ntoskrnl/ntoskrnl_powerpc.lnk
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl_powerpc.lnk?rev=29928&r1=29927&r2=29928&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl_powerpc.lnk (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl_powerpc.lnk Sun Oct 28 15:31:10 2007
@@ -50,20 +50,8 @@
   {
     *(.rsrc)
   }
-  .rela.text :
+  .rela :
   {
-    *(.rela.text)
-  }
-  .rela.data :
-  {
-    *(.rela.data)
-  }
-  .rela.rodata :
-  {
-    *(.rela.rodata)
-  }
-  .rela.got2 :
-  {
-    *(.rela.got2)
+    *(.rela.*)
   }
 }




More information about the Ros-diffs mailing list