Author: arty Date: Mon Jun 18 01:18:25 2007 New Revision: 27217
URL: http://svn.reactos.org/svn/reactos?rev=27217&view=rev Log: - Some random imports from ntoskrnl (ndis header, bugcodes) - Lean out ntoskrnl entry point to make it more like the new style in trunk - Implement loading by imports in freeldr and move import resolution there - Fix ppcmmu BAT snooping - We'll remove our serial debug hack in KiSystemService once we verify kdcom/kd serial works
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c branches/powerpc/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild branches/powerpc/reactos/boot/freeldr/freeldr/reactos/reactos.c branches/powerpc/reactos/include/ddk/ndis.h branches/powerpc/reactos/include/reactos/bugcodes.h branches/powerpc/reactos/include/reactos/buildno.h branches/powerpc/reactos/include/reactos/errcodes.h branches/powerpc/reactos/include/reactos/ppcmmu/mmu.h branches/powerpc/reactos/ntoskrnl/bugcodes.rc branches/powerpc/reactos/ntoskrnl/include/internal/ntoskrnl.h branches/powerpc/reactos/ntoskrnl/ke/freeldr.c branches/powerpc/reactos/ntoskrnl/ke/powerpc/ppc_irq.c branches/powerpc/reactos/ntoskrnl/ntoskrnl.rbuild
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fre... ============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c Mon Jun 18 01:18:25 2007 @@ -30,7 +30,7 @@ #define NDEBUG #include <debug.h>
-static PVOID KernelMemory = 0; +PVOID KernelMemory = 0; extern boot_infos_t BootInfo;
/* Bits to shift to convert a Virtual Address into an Offset in the Page Table */ @@ -39,20 +39,6 @@ /* Bits to shift to convert a Virtual Address into an Offset in the Page Directory */ #define PDE_SHIFT 22 #define PDE_SHIFT_PAE 18 - - -/* Converts a Relative Address read from the Kernel into a Physical Address */ -ULONG RaToPa(ULONG p) { - return (ULONG)(KernelMemory) + p; -} - -/* Converts a Phsyical Address Pointer into a Page Frame Number */ -#define PaPtrToPfn(p) \ - (((ULONG_PTR)&p) >> PFN_SHIFT) - -/* Converts a Phsyical Address into a Page Frame Number */ -#define PaToPfn(p) \ - ((p) >> PFN_SHIFT)
#define STARTUP_BASE 0xC0000000 #define HYPERSPACE_BASE 0xC0400000 @@ -74,7 +60,7 @@
#define BAT_GRANULARITY (64 * 1024) -#define KernelMemorySize (16 * 1024 * 1024) +#define KernelMemorySize (8 * 1024 * 1024) #define KernelEntryPoint (KernelEntry - KERNEL_BASE_PHYS) + KernelBase #define XROUNDUP(x,n) ((((ULONG)x) + ((n) - 1)) & (~((n) - 1)))
@@ -95,6 +81,15 @@
/* Dummy to bring in memmove */ PVOID memmove_dummy = memmove; + +PLOADER_MODULE +NTAPI +LdrGetModuleObject(PCHAR ModuleName); + +NTSTATUS +NTAPI +LdrPEFixupImports(IN PVOID DllBase, + IN PCHAR DllName);
/* FUNCTIONS *****************************************************************/
@@ -116,34 +111,6 @@ *--*/
typedef void (*KernelEntryFn)( void * ); - -VOID -DrawDigit(boot_infos_t *BootInfo, ULONG Digit, int x, int y) -{ - int i,j,k; - - for( i = 0; i < 7; i++ ) { - for( j = 0; j < 8; j++ ) { - for( k = 0; k < BootInfo->dispDeviceDepth/8; k++ ) { - SetPhysByte(((ULONG_PTR)BootInfo->dispDeviceBase)+ - k + - (((j+x) * (BootInfo->dispDeviceDepth/8)) + - ((i+y) * (BootInfo->dispDeviceRowBytes))), - BootInfo->dispFont[Digit][i*8+j] == ' ' ? 0 : 255); - } - } - } -} - -VOID -DrawNumber(boot_infos_t *BootInfo, ULONG Number, int x, int y) -{ - int i; - - for( i = 0; i < 8; i++, Number<<=4 ) { - DrawDigit(BootInfo,(Number>>28)&0xf,x+(i*8),y); - } -}
int MmuPageMiss(int inst, ppc_trap_frame_t *trap) { @@ -161,24 +128,35 @@ { KernelEntryFn KernelEntryAddress = (KernelEntryFn)(KernelEntry + KernelBase); - ULONG_PTR i, page; + ULONG_PTR i, j, page, count; + 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));
+ for(i = 0; i < LoaderBlock.ModsCount; i++) + { + ModHeader = ((PCHAR)reactos_modules[i].ModStart); + if(ModHeader[0] == 'M' && ModHeader[1] == 'Z') + LdrPEFixupImports + ((PVOID)reactos_modules[i].ModStart, + (PCHAR)reactos_modules[i].String); + } + /* We'll use vsid 1 for freeldr (expendable) */ for(i = 0; i < 8; i++) { MmuAllocVsid(16 + i); - MmuSetVsid(i, i+1, 1); - } + } + MmuSetVsid(0, 8, 1); + /* Vsid 0 is reactos kernel */ for(i = 8; i < 16; i++) { MmuAllocVsid(i); - MmuSetVsid(i, i+1, 0); - } + } + MmuSetVsid(8, 16, 0);
MmuSetPageCallback(MmuPageMiss);
@@ -197,19 +175,37 @@ MmuMapPage(info, page);
/* Map module name strings */ - for( i = 0; i < LoaderBlock.ModsCount; i++ ) + for( count = 0, i = 0; i < LoaderBlock.ModsCount; i++ ) { page = ROUND_DOWN(((ULONG)reactos_modules[i].String), (1<<PFN_SHIFT)); - info[i].flags = MMU_ALL_RW; - info[i].proc = 1; - info[i].addr = page; - info[i].phys = page; // PpcVirt2phys(page, 0); - MmuMapPage(info, 1); - } - - info[i].addr = (ULONG)&LoaderBlock; - info[i].phys = info[i].addr; - MmuMapPage(info, 1); + 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++; + } + } + + 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++; + } + MmuMapPage(info, count);
MmuTurnOn(KernelEntryAddress, (void*)&LoaderBlock);
@@ -364,6 +360,16 @@ PCHAR sptr; Elf32_Ehdr ehdr; Elf32_Shdr *shdr; + LPSTR TempName; + + TempName = strrchr(ImageName, '\'); + if(TempName) TempName++; else TempName = (LPSTR)ImageName; + ModuleData = LdrGetModuleObject(TempName); + + if(ModuleData) + { + return TRUE; + }
if(!KernelAddr) KernelAddr = (ULONG)NextModuleBase - (ULONG)KernelMemory + KernelBase; @@ -579,6 +585,11 @@ ModuleData->ModEnd = NextModuleBase; ModuleData->String = (ULONG)MmAllocateMemory(strlen(ImageName)+1); strcpy((PCHAR)ModuleData->String, ImageName); + printf("Module %s (%x-%x) next at %x\n", + ModuleData->String, + ModuleData->ModStart, + ModuleData->ModEnd, + NextModuleBase); LoaderBlock.ModsCount++;
/* Return Success */ @@ -627,8 +638,6 @@ LPSTR NameBuffer; LPSTR TempName;
- printf("Load module %s at %x\n", ModuleName, (ULONG)NextModuleBase - (ULONG)KernelMemory + KernelBase); - /* Get current module data structure and module name string array */ ModuleData = &reactos_modules[LoaderBlock.ModsCount];
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fre... ============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c Mon Jun 18 01:18:25 2007 @@ -34,7 +34,8 @@
BOOLEAN PpcPrepConsKbHit() { - return GetPhysByte(prep_serial+5) & 1; + return 1; + //return GetPhysByte(prep_serial+5) & 1; }
int PpcPrepConsGetCh()
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fre... ============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild Mon Jun 18 01:18:25 2007 @@ -76,6 +76,7 @@ <file>prep_pci.c</file> <file>prep_vga.c</file> <file>mboot.c</file> + <file>loader.c</file> </module> </if> </directory>
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/reactos/reactos.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fre... ============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/reactos/reactos.c (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/reactos/reactos.c Mon Jun 18 01:18:25 2007 @@ -35,6 +35,7 @@ unsigned long reactos_disk_count = 0; CHAR szHalName[255]; CHAR szBootPath[255]; +CHAR SystemRoot[255]; static CHAR szLoadingMsg[] = "Loading ReactOS..."; BOOLEAN FrLdrBootType;
@@ -199,6 +200,8 @@ CHAR szFileName[256]; ULONG BufferSize;
+ strcpy(SystemRoot, szSystemRoot); + /* open the codepage key */ rc = RegOpenKey(NULL, L"\Registry\Machine\SYSTEM\CurrentControlSet\Control\NLS\CodePage", @@ -300,7 +303,7 @@ return(TRUE); }
-static BOOLEAN +BOOLEAN FrLdrLoadDriver(PCHAR szFileName, INT nPos) { @@ -312,6 +315,25 @@
/* Open the Driver */ FilePointer = FsOpenFile(szFileName); + + /* Try under the system root in the main dir and drivers */ + if (FilePointer == NULL) + { + strcpy(value, SystemRoot); + strcat(value, "SYSTEM32\"); + strcat(value, szFileName); + printf("Trying %s\n", value); + FilePointer = FsOpenFile(value); + } + + if (FilePointer == NULL) + { + strcpy(value, SystemRoot); + strcat(value, "SYSTEM32\DRIVERS\"); + strcat(value, szFileName); + printf("Trying %s\n", value); + FilePointer = FsOpenFile(value); + }
/* Make sure we did */ if (FilePointer == NULL) {
Modified: branches/powerpc/reactos/include/ddk/ndis.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/ddk/ndis... ============================================================================== --- branches/powerpc/reactos/include/ddk/ndis.h (original) +++ branches/powerpc/reactos/include/ddk/ndis.h Mon Jun 18 01:18:25 2007 @@ -1806,7 +1806,7 @@ VirtualAddress, \ Length) \ { \ - if (VirtualAddress) \ + if (ARGUMENT_PRESENT(VirtualAddress)) \ *((PVOID*)VirtualAddress) = MmGetSystemAddressForMdl(Buffer); \ \ *((PUINT)Length) = MmGetMdlByteCount(Buffer); \ @@ -2022,48 +2022,52 @@ * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL, * OUT PUINT TotalPacketLength OPTIONAL); */ -#define NdisQueryPacket(Packet, \ - PhysicalBufferCount, \ - BufferCount, \ - FirstBuffer, \ - TotalPacketLength) \ -{ \ - if (FirstBuffer) \ - *((PNDIS_BUFFER*)FirstBuffer) = (Packet)->Private.Head; \ - if ((TotalPacketLength) || (BufferCount) || (PhysicalBufferCount)) \ - { \ - if (!(Packet)->Private.ValidCounts) { \ - UINT _Offset; \ - UINT _PacketLength; \ - PNDIS_BUFFER _NdisBuffer; \ - UINT _PhysicalBufferCount = 0; \ - UINT _TotalPacketLength = 0; \ - UINT _Count = 0; \ - \ - for (_NdisBuffer = (Packet)->Private.Head; \ - _NdisBuffer != (PNDIS_BUFFER)NULL; \ - _NdisBuffer = _NdisBuffer->Next) \ - { \ - _PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(_NdisBuffer); \ - NdisQueryBufferOffset(_NdisBuffer, &_Offset, &_PacketLength); \ - _TotalPacketLength += _PacketLength; \ - _Count++; \ - } \ - (Packet)->Private.PhysicalCount = _PhysicalBufferCount; \ - (Packet)->Private.TotalLength = _TotalPacketLength; \ - (Packet)->Private.Count = _Count; \ - (Packet)->Private.ValidCounts = TRUE; \ - } \ - \ - if (PhysicalBufferCount) \ - *((PUINT)PhysicalBufferCount) = (Packet)->Private.PhysicalCount; \ - \ - if (BufferCount) \ - *((PUINT)BufferCount) = (Packet)->Private.Count; \ - \ - if (TotalPacketLength) \ - *((PUINT)TotalPacketLength) = (Packet)->Private.TotalLength; \ - } \ +static __inline +VOID +NdisQueryPacket( + IN PNDIS_PACKET Packet, + OUT PUINT PhysicalBufferCount OPTIONAL, + OUT PUINT BufferCount OPTIONAL, + OUT PNDIS_BUFFER *FirstBuffer OPTIONAL, + OUT PUINT TotalPacketLength OPTIONAL) +{ + if (FirstBuffer) + *FirstBuffer = Packet->Private.Head; + if (TotalPacketLength || BufferCount || PhysicalBufferCount) + { + if (!Packet->Private.ValidCounts) + { + UINT Offset; + UINT PacketLength; + PNDIS_BUFFER NdisBuffer; + UINT PhysicalBufferCount = 0; + UINT TotalPacketLength = 0; + UINT Count = 0; + + for (NdisBuffer = Packet->Private.Head; + NdisBuffer != (PNDIS_BUFFER)NULL; + NdisBuffer = NdisBuffer->Next) + { + PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(NdisBuffer); + NdisQueryBufferOffset(NdisBuffer, &Offset, &PacketLength); + TotalPacketLength += PacketLength; + Count++; + } + Packet->Private.PhysicalCount = PhysicalBufferCount; + Packet->Private.TotalLength = TotalPacketLength; + Packet->Private.Count = Count; + Packet->Private.ValidCounts = TRUE; + } + + if (PhysicalBufferCount) + *PhysicalBufferCount = Packet->Private.PhysicalCount; + + if (BufferCount) + *BufferCount = Packet->Private.Count; + + if (TotalPacketLength) + *TotalPacketLength = Packet->Private.TotalLength; + } }
/* @@ -2281,7 +2285,7 @@
#endif
-#if defined(_M_IX86) || defined(_M_AMD64) +#if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_PPC)
/* * VOID @@ -2305,17 +2309,17 @@ #else
#define NdisMoveMappedMemory(Destination, Source, Length) \ -{ \ - PUCHAR _Dest = Destination, _Src = Source, _End = _Dest + Length; \ - while (_Dest < _End) \ - *_Dest++ = _Src++; \ +{ + PUCHAR _Dest = Destination, _Src = Source, _End = _Dest + Length; + while (_Dest < _End) + *_Dest++ = _Src++; }
#define NdisZeroMappedMemory(Destination, Length) \ -{ \ - PUCHAR _Dest = Destination, _End = _Dest + Length; \ - while (_Dest < _End) \ - *_Dest++ = 0; \ +{ + PUCHAR _Dest = Destination, _End = _Dest + Length; + while (_Dest < _End) + *_Dest++ = 0; }
#endif /* _M_IX86 or _M_AMD64 */ @@ -4126,6 +4130,7 @@ KEVENT DpcsCompletedEvent; } NDIS_INTERRUPT, *PNDIS_INTERRUPT;
+ typedef enum _NDIS_WORK_ITEM_TYPE { NdisWorkItemRequest, NdisWorkItemSend, @@ -4255,19 +4260,19 @@ IN PUCHAR Packet, IN ULONG PacketSize);
-typedef VOID DDKFASTAPI +typedef VOID FASTCALL (*NDIS_M_DEQUEUE_WORK_ITEM)( IN PNDIS_MINIPORT_BLOCK Miniport, IN NDIS_WORK_ITEM_TYPE WorkItemType, OUT PVOID *WorkItemContext);
-typedef NDIS_STATUS DDKFASTAPI +typedef NDIS_STATUS FASTCALL (*NDIS_M_QUEUE_NEW_WORK_ITEM)( IN PNDIS_MINIPORT_BLOCK Miniport, IN NDIS_WORK_ITEM_TYPE WorkItemType, IN PVOID WorkItemContext);
-typedef NDIS_STATUS DDKFASTAPI +typedef NDIS_STATUS FASTCALL (*NDIS_M_QUEUE_WORK_ITEM)( IN PNDIS_MINIPORT_BLOCK Miniport, IN NDIS_WORK_ITEM_TYPE WorkItemType, @@ -4294,7 +4299,7 @@ (*NDIS_M_SEND_RESOURCES_HANDLER)( IN NDIS_HANDLE MiniportAdapterHandle);
-typedef BOOLEAN DDKFASTAPI +typedef BOOLEAN FASTCALL (*NDIS_M_START_SENDS)( IN PNDIS_MINIPORT_BLOCK Miniport);
Modified: branches/powerpc/reactos/include/reactos/bugcodes.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/reactos/... ============================================================================== --- branches/powerpc/reactos/include/reactos/bugcodes.h (original) +++ branches/powerpc/reactos/include/reactos/bugcodes.h Mon Jun 18 01:18:25 2007 @@ -1,10 +1,10 @@ /* This file is generated with wmc version 0.3.0. Do not edit! */ /* Source : ntoskrnl/ntoskrnl.mc */ /* Cmdline: wmc -i -H include/reactos/bugcodes.h -o ntoskrnl/bugcodes.rc ntoskrnl/ntoskrnl.mc */ -/* Date : Sun Apr 1 07:41:30 2007 */ - -#ifndef __WMCGENERATED_460f622a_H -#define __WMCGENERATED_460f622a_H +/* Date : Wed Jun 13 06:44:39 2007 */ + +#ifndef __WMCGENERATED_466f9257_H +#define __WMCGENERATED_466f9257_H
/* Severity codes */ #define STATUS_SEVERITY_ERROR 0x3 @@ -550,6 +550,22 @@ /* Approx. msg: The BIOS in this system is not fully ACPI compliant. Please contact your */ #define ACPI_BIOS_ERROR ((ULONG)0x000000a5L)
+/* MessageId : 0x400000a8 */ +/* Approx. msg: The system is booting in safemode - Minimal Services */ +#define BOOTING_IN_SAFEMODE_MINIMAL ((ULONG)0x400000a8L) + +/* MessageId : 0x400000a9 */ +/* Approx. msg: The system is booting in safemode - Minimal Services with Network */ +#define BOOTING_IN_SAFEMODE_NETWORK ((ULONG)0x400000a9L) + +/* MessageId : 0x400000aa */ +/* Approx. msg: The system is booting in safemode - Directory Services Repair */ +#define BOOTING_IN_SAFEMODE_DSREPAIR ((ULONG)0x400000aaL) + +/* MessageId : 0x400000b7 */ +/* Approx. msg: Boot Logging Enabled */ +#define BOOTLOG_ENABLED ((ULONG)0x400000b7L) + /* MessageId : 0x000000be */ /* Approx. msg: ATTEMPTED_WRITE_TO_READONLY_MEMORY */ #define ATTEMPTED_WRITE_TO_READONLY_MEMORY ((ULONG)0x000000beL) @@ -635,7 +651,7 @@ #define WINDOWS_NT_INFO_STRING ((ULONG)0x40000088L)
/* MessageId : 0x40000089 */ -/* Approx. msg: MulitProcessor Kernel */ +/* Approx. msg: MultiProcessor Kernel */ #define WINDOWS_NT_MP_STRING ((ULONG)0x40000089L)
/* MessageId : 0x4000009d */
Modified: branches/powerpc/reactos/include/reactos/buildno.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/reactos/... ============================================================================== --- branches/powerpc/reactos/include/reactos/buildno.h (original) +++ branches/powerpc/reactos/include/reactos/buildno.h Mon Jun 18 01:18:25 2007 @@ -1,9 +1,9 @@ /* Do not edit - Machine generated */ #ifndef _INC_REACTOS_BUILDNO #define _INC_REACTOS_BUILDNO -#define KERNEL_VERSION_BUILD 20070523 -#define KERNEL_VERSION_BUILD_STR "20070523-rUNKNOWN" -#define KERNEL_VERSION_BUILD_RC "20070523-rUNKNOWN\0" +#define KERNEL_VERSION_BUILD 20070613 +#define KERNEL_VERSION_BUILD_STR "20070613-rUNKNOWN" +#define KERNEL_VERSION_BUILD_RC "20070613-rUNKNOWN\0" #define KERNEL_RELEASE_RC "0.4-SVN\0" #define KERNEL_RELEASE_STR "0.4-SVN" #define KERNEL_VERSION_RC "0.4-SVN\0"
Modified: branches/powerpc/reactos/include/reactos/errcodes.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/reactos/... ============================================================================== --- branches/powerpc/reactos/include/reactos/errcodes.h (original) +++ branches/powerpc/reactos/include/reactos/errcodes.h Mon Jun 18 01:18:25 2007 @@ -1,10 +1,10 @@ /* This file is generated with wmc version 0.3.0. Do not edit! */ /* Source : dll/win32/kernel32/kernel32.mc */ /* Cmdline: wmc -i -U -H include/reactos/errcodes.h -o dll/win32/kernel32/errcodes.rc dll/win32/kernel32/kernel32.mc */ -/* Date : Wed May 23 04:08:35 2007 */ - -#ifndef __WMCGENERATED_4653be43_H -#define __WMCGENERATED_4653be43_H +/* Date : Wed Jun 13 06:13:07 2007 */ + +#ifndef __WMCGENERATED_466f8af3_H +#define __WMCGENERATED_466f8af3_H
/* Severity codes */ #define STATUS_SEVERITY_ERROR 0x3
Modified: branches/powerpc/reactos/include/reactos/ppcmmu/mmu.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/reactos/... ============================================================================== --- branches/powerpc/reactos/include/reactos/ppcmmu/mmu.h (original) +++ branches/powerpc/reactos/include/reactos/ppcmmu/mmu.h Mon Jun 18 01:18:25 2007 @@ -96,15 +96,14 @@ int (*mmumain)(int action, void *arg1, void *arg2, void *arg3) = (void *)MMUCODE; __asm__("bl 1f\n\t" "\n1:\n\t" - "mflr 0\n\t" - "stw 0,0(%0)" : : "r" (&pc)); + "mflr %0\n\t" : "=r" (pc));
for(i = 0, gotbat = 0; i < 4 && gotbat < 2; i++) { GetBat(i, 1, &batu, &batl); - if(batu & 0x3fc) + if(batu & 0xffc) { - mask = ~(0x1ffff | ((batu & 0x3fc)>>2)<<17); + mask = ~(0x1ffff | ((batu & 0xffc)>>2)<<17); if(!(batu & 2) || ((batu & mask) != (pc & mask))) usebat[gotbat++] = i; } else {
Modified: branches/powerpc/reactos/ntoskrnl/bugcodes.rc URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/bugcode... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/bugcodes.rc (original) +++ branches/powerpc/reactos/ntoskrnl/bugcodes.rc Mon Jun 18 01:18:25 2007 @@ -1,40 +1,46 @@ /* This file is generated with wmc version 0.3.0. Do not edit! */ /* Source : ntoskrnl/ntoskrnl.mc */ /* Cmdline: wmc -i -H include/reactos/bugcodes.h -o ntoskrnl/bugcodes.rc ntoskrnl/ntoskrnl.mc */ -/* Date : Wed May 23 04:08:35 2007 */ +/* Date : Wed Jun 13 06:44:39 2007 */
1 MESSAGETABLE LANGUAGE 0x9, 0x1 { - /* NBlocks */ 0x0000001bL, - /* Lo,Hi,Offs */ 0x00000000L, 0x00000039L, 0x00000148L, - /* Lo,Hi,Offs */ 0x0000003eL, 0x00000042L, 0x00000c74L, - /* Lo,Hi,Offs */ 0x00000044L, 0x00000045L, 0x00000e04L, - /* Lo,Hi,Offs */ 0x00000048L, 0x00000059L, 0x00000e4cL, - /* Lo,Hi,Offs */ 0x0000005cL, 0x0000007bL, 0x00001060L, - /* Lo,Hi,Offs */ 0x0000007dL, 0x00000080L, 0x00001588L, - /* Lo,Hi,Offs */ 0x0000008eL, 0x0000008eL, 0x000017acL, - /* Lo,Hi,Offs */ 0x00000094L, 0x00000094L, 0x000017c8L, - /* Lo,Hi,Offs */ 0x00000096L, 0x00000096L, 0x000017ecL, - /* Lo,Hi,Offs */ 0x000000a5L, 0x000000a5L, 0x0000180cL, - /* Lo,Hi,Offs */ 0x000000beL, 0x000000beL, 0x00001880L, - /* Lo,Hi,Offs */ 0x000000c3L, 0x000000c3L, 0x00001918L, - /* Lo,Hi,Offs */ 0x000000c5L, 0x000000c5L, 0x00001a84L, - /* Lo,Hi,Offs */ 0x000000c8L, 0x000000c8L, 0x00001d04L, - /* Lo,Hi,Offs */ 0x000000cbL, 0x000000cbL, 0x00001df4L, - /* Lo,Hi,Offs */ 0x000000ceL, 0x000000ceL, 0x00001e20L, - /* Lo,Hi,Offs */ 0x000000d0L, 0x000000d1L, 0x00001e5cL, - /* Lo,Hi,Offs */ 0x000000d3L, 0x000000d4L, 0x00001ea0L, - /* Lo,Hi,Offs */ 0x000000d8L, 0x000000d8L, 0x00001f08L, - /* Lo,Hi,Offs */ 0x000000e0L, 0x000000e5L, 0x00001f28L, - /* Lo,Hi,Offs */ 0x000000e9L, 0x000000eaL, 0x0000217cL, - /* Lo,Hi,Offs */ 0x000000efL, 0x000000efL, 0x0000229cL, - /* Lo,Hi,Offs */ 0x000000f4L, 0x000000f4L, 0x000022b8L, - /* Lo,Hi,Offs */ 0x000000faL, 0x000000faL, 0x000022dcL, - /* Lo,Hi,Offs */ 0x000000fcL, 0x000000fcL, 0x00002300L, - /* Lo,Hi,Offs */ 0x4000009aL, 0x4000009fL, 0x0000232cL, - /* Lo,Hi,Offs */ 0x8000007fL, 0x80000083L, 0x000024b8L, + /* NBlocks */ 0x00000021L, + /* Lo,Hi,Offs */ 0x00000000L, 0x00000039L, 0x00000190L, + /* Lo,Hi,Offs */ 0x0000003eL, 0x00000042L, 0x00000cbcL, + /* Lo,Hi,Offs */ 0x00000044L, 0x00000045L, 0x00000e4cL, + /* Lo,Hi,Offs */ 0x00000048L, 0x00000059L, 0x00000e94L, + /* Lo,Hi,Offs */ 0x0000005cL, 0x0000007bL, 0x000010a8L, + /* Lo,Hi,Offs */ 0x0000007dL, 0x00000080L, 0x000015d0L, + /* Lo,Hi,Offs */ 0x0000008eL, 0x00000090L, 0x000017f4L, + /* Lo,Hi,Offs */ 0x00000094L, 0x00000094L, 0x00001850L, + /* Lo,Hi,Offs */ 0x00000096L, 0x00000096L, 0x00001874L, + /* Lo,Hi,Offs */ 0x000000a0L, 0x000000a0L, 0x00001894L, + /* Lo,Hi,Offs */ 0x000000a5L, 0x000000a5L, 0x000018b0L, + /* Lo,Hi,Offs */ 0x000000beL, 0x000000beL, 0x00001924L, + /* Lo,Hi,Offs */ 0x000000c3L, 0x000000c3L, 0x000019bcL, + /* Lo,Hi,Offs */ 0x000000c5L, 0x000000c5L, 0x00001b28L, + /* Lo,Hi,Offs */ 0x000000c8L, 0x000000c8L, 0x00001da8L, + /* Lo,Hi,Offs */ 0x000000cbL, 0x000000cbL, 0x00001e98L, + /* Lo,Hi,Offs */ 0x000000ceL, 0x000000ceL, 0x00001ec4L, + /* Lo,Hi,Offs */ 0x000000d0L, 0x000000d1L, 0x00001f00L, + /* Lo,Hi,Offs */ 0x000000d3L, 0x000000d4L, 0x00001f44L, + /* Lo,Hi,Offs */ 0x000000d8L, 0x000000d8L, 0x00001facL, + /* Lo,Hi,Offs */ 0x000000e0L, 0x000000e5L, 0x00001fccL, + /* Lo,Hi,Offs */ 0x000000e9L, 0x000000eaL, 0x00002220L, + /* Lo,Hi,Offs */ 0x000000efL, 0x000000efL, 0x00002340L, + /* Lo,Hi,Offs */ 0x000000f4L, 0x000000f4L, 0x0000235cL, + /* Lo,Hi,Offs */ 0x000000faL, 0x000000faL, 0x00002380L, + /* Lo,Hi,Offs */ 0x000000fcL, 0x000000fcL, 0x000023a4L, + /* Lo,Hi,Offs */ 0x4000007eL, 0x4000007eL, 0x000023d0L, + /* Lo,Hi,Offs */ 0x40000087L, 0x40000089L, 0x000023fcL, + /* Lo,Hi,Offs */ 0x4000009dL, 0x4000009dL, 0x00002458L, + /* Lo,Hi,Offs */ 0x4000009fL, 0x4000009fL, 0x00002484L, + /* Lo,Hi,Offs */ 0x400000a8L, 0x400000aaL, 0x00002564L, + /* Lo,Hi,Offs */ 0x400000b7L, 0x400000b7L, 0x0000262cL, + /* Lo,Hi,Offs */ 0x8000007fL, 0x80000083L, 0x00002648L,
/* Msg 0x00000000 */ 0x0048, 0x0000, "The bug code is undefined. Please use an existing code instead.\n\x00\x00\x00\x00", @@ -424,11 +430,20 @@ /* Msg 0x0000008e */ 0x001c, 0x0000, "SPIN_LOCK_INIT_FAILURE\n\x00",
+ /* Msg 0x0000008f */ 0x0020, 0x0000, + "PP0_INITIALIZATION_FAILED\n\x00\x00", + + /* Msg 0x00000090 */ 0x0020, 0x0000, + "PP1_INITIALIZATION_FAILED\n\x00\x00", + /* Msg 0x00000094 */ 0x0024, 0x0000, "KERNEL_STACK_LOCKED_AT_EXIT\n\x00\x00\x00\x00",
/* Msg 0x00000096 */ 0x0020, 0x0000, "INVALID_WORK_QUEUE_ITEM\n\x00\x00\x00\x00", + + /* Msg 0x000000a0 */ 0x001c, 0x0000, + "INTERNAL_POWER_ERROR\n\x00\x00\x00",
/* Msg 0x000000a5 */ 0x0074, 0x0000, "The BIOS in this system is not fully ACPI compliant. Please contact you", @@ -530,19 +545,19 @@ /* Msg 0x000000fc */ 0x002c, 0x0000, "ATTEMPTED_EXECUTE_OF_NOEXECUTE_MEMORY\n\x00\x00",
- /* Msg 0x4000009a */ 0x0024, 0x0000, - "ReactOS Version %s (Build %s)\n\x00\x00", - - /* Msg 0x4000009b */ 0x0014, 0x0000, + /* Msg 0x4000007e */ 0x002c, 0x0000, + "ReactOS (R) Version %hs (Build %u%hs)\n\x00\x00", + + /* Msg 0x40000087 */ 0x0014, 0x0000, "Service Pack\n\x00\x00\x00",
- /* Msg 0x4000009c */ 0x002c, 0x0000, + /* Msg 0x40000088 */ 0x002c, 0x0000, "%u System Processor [%u MB Memory] %Z\n\x00\x00",
- /* Msg 0x4000009d */ 0x001c, 0x0000, - "MulitProcessor Kernel\n\x00\x00", - - /* Msg 0x4000009e */ 0x002c, 0x0000, + /* Msg 0x40000089 */ 0x001c, 0x0000, + "MultiProcessor Kernel\n\x00\x00", + + /* Msg 0x4000009d */ 0x002c, 0x0000, "%u System Processors [%u MB Memory] %Z\n\x00",
/* Msg 0x4000009f */ 0x00e0, 0x0000, @@ -550,6 +565,18 @@ "e,\n and you\n are welcome to change it and/or distribute copies of it ", "under\n certain\n conditions. There is absolutely no warranty for React", "OS.\n\n\x00\x00\x00\x00", + + /* Msg 0x400000a8 */ 0x003c, 0x0000, + "The system is booting in safemode - Minimal Services\n\x00\x00\x00", + + /* Msg 0x400000a9 */ 0x0048, 0x0000, + "The system is booting in safemode - Minimal Services with Network\n\x00\x00", + + /* Msg 0x400000aa */ 0x0044, 0x0000, + "The system is booting in safemode - Directory Services Repair\n\x00\x00", + + /* Msg 0x400000b7 */ 0x001c, 0x0000, + "Boot Logging Enabled\n\x00\x00\x00",
/* Msg 0x8000007f */ 0x0064, 0x0000, "A problem has been detected and ReactOS has been shut down to prevent da",
Modified: branches/powerpc/reactos/ntoskrnl/include/internal/ntoskrnl.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/include... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/include/internal/ntoskrnl.h (original) +++ branches/powerpc/reactos/ntoskrnl/include/internal/ntoskrnl.h Mon Jun 18 01:18:25 2007 @@ -17,6 +17,7 @@
#ifdef _NTOSKRNL_
+#define NUM_BOOT_DRIVERS 32 #define KeGetCurrentThread _KeGetCurrentThread #define KeGetPreviousMode _KeGetPreviousMode #undef PsGetCurrentProcess @@ -353,4 +354,12 @@ C_ASSERT(FIELD_OFFSET(KTSS, IoMapBase) == KTSS_IOMAPBASE); #endif
+#ifdef _PPC_ +#define SWAPD(x) ((((x)&0xff)<<24)|(((x)&0xff00)<<8)|(((x)>>8)&0xff00)|(((x)>>24)&0xff)) +#define SWAPW(x) ((((x)&0xff)<<8)|(((x)>>8)&0xff)) +#else +#define SWAPD(x) x +#define SWAPW(x) x +#endif + #endif /* INCLUDE_INTERNAL_NTOSKRNL_H */
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 Jun 18 01:18:25 2007 @@ -17,8 +17,9 @@
/* FreeLDR Module Data */ LOADER_MODULE KeLoaderModules[64]; +LDR_DATA_TABLE_ENTRY ModuleObject[NUM_BOOT_DRIVERS]; ULONG KeLoaderModuleCount; -static CHAR KeLoaderModuleStrings[64][256]; +CHAR KeLoaderModuleStrings[64][256];
/* FreeLDR Memory Data */ ADDRESS_RANGE KeMemoryMap[64]; @@ -32,9 +33,6 @@ ROS_LOADER_PARAMETER_BLOCK KeRosLoaderBlock; static CHAR KeLoaderCommandLine[256]; BOOLEAN AcpiTableDetected; - -/* FreeLDR PE Hack Data */ -extern LDR_DATA_TABLE_ENTRY HalModuleObject;
/* NT Loader Data */ LOADER_PARAMETER_BLOCK BldrLoaderBlock; @@ -221,7 +219,7 @@ else if (!(_stricmp(DriverName, "hal.dll"))) { /* The HAL actually gets loaded somewhere else */ - ModStart = HalModuleObject.DllBase; + ModStart = ModuleObject[1].DllBase;
/* Create an MD for the HAL */ MdEntry = &BldrMemoryDescriptors[i]; @@ -296,10 +294,6 @@ #endif }
-VOID -INIT_FUNCTION -NTAPI -LdrpSettleHal(PVOID NewHalBase); VOID NTAPI KiSetupSyscallHandler(); @@ -314,7 +308,6 @@ ULONG StartKernelBase; ULONG HalBase; ULONG DriverBase; - ULONG DriverSize; PLOADER_PARAMETER_BLOCK NtLoaderBlock; CHAR* s; #ifdef _M_IX86 @@ -406,6 +399,11 @@ strcpy(KeLoaderModuleStrings[i], (PCHAR)KeLoaderModules[i].String); }
+ DPRINT1("Module %08x-%08x: %s\n", + KeLoaderModules[i].ModStart, + KeLoaderModules[i].ModEnd, + KeLoaderModuleStrings[i]); + #ifdef _M_PPC KeLoaderModules[i].ModStart += KSEG0_BASE - StartKernelBase; KeLoaderModules[i].ModEnd += KSEG0_BASE - StartKernelBase; @@ -429,9 +427,8 @@
/* Choose last module address as the final kernel address */ MmFreeLdrLastKernelAddress = - ROUND_UP(KeLoaderModules[KeRosLoaderBlock.ModsCount - 1].ModEnd, 0x10000); - - /* Select the HAL Base */ + KeLoaderModules[KeRosLoaderBlock.ModsCount - 1].ModEnd; + HalBase = KeLoaderModules[1].ModStart;
/* Choose Driver Base */ @@ -442,48 +439,21 @@ LdrHalBase = (ULONG_PTR)DriverBase; #endif
+ /* Convert the loader block */ + KiRosFrldrLpbToNtLpb(&KeRosLoaderBlock, &NtLoaderBlock); + /* 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); - - /* Increase the last kernel address with the size of HAL */ - MmFreeLdrLastKernelAddress += PAGE_ROUND_UP(DriverSize); - -#ifdef _M_IX86 - /* Now select the final beginning and ending Kernel Addresses */ - MmFreeLdrFirstKrnlPhysAddr = KeLoaderModules[0].ModStart - - KSEG0_BASE + 0x200000; - MmFreeLdrLastKrnlPhysAddr = MmFreeLdrLastKernelAddress - - KSEG0_BASE + 0x200000; -#endif + /* LdrInitModuleManagement((PVOID)KeLoaderModules[0].ModStart); */
/* Setup the IDT */ KeInitExceptions(); // ONCE HACK BELOW IS GONE, MOVE TO KISYSTEMSTARTUP! KeInitInterrupts(); // ROS HACK DEPRECATED SOON BY NEW HAL
- /* Load the Kernel with the PE Loader */ - LdrSafePEProcessModule((PVOID)KeLoaderModules[0].ModStart, - (PVOID)KeLoaderModules[0].ModStart, - (PVOID)DriverBase, - &DriverSize); - /* Sets up the VDM Data */ #ifdef _M_IX86 NtEarlyInitVdm(); #endif
- /* Convert the loader block */ - KiRosFrldrLpbToNtLpb(&KeRosLoaderBlock, &NtLoaderBlock); - /* Do general System Startup */ KiSystemStartup(NtLoaderBlock); }
Modified: branches/powerpc/reactos/ntoskrnl/ke/powerpc/ppc_irq.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/powe... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/powerpc/ppc_irq.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/powerpc/ppc_irq.c Mon Jun 18 01:18:25 2007 @@ -822,14 +822,13 @@ NTAPI KiSystemService(ppc_trap_frame_t *trap_frame) { - SetPhysByte(0x800003f8, 'S'); - SetPhysByte(0x800003f8, 'C'); - SetPhysByte(0x800003f8, '!'); - SetPhysByte(0x800003f8, '\r'); - SetPhysByte(0x800003f8, '\n'); + int i; switch(trap_frame->gpr[8]) { case 0x10000: /* DebugService */ + for( i = 0; i < trap_frame->gpr[5]; i++ ) + SetPhysByte(0x800003f8, ((PCHAR)trap_frame->gpr[4])[i]); + trap_frame->gpr[3] = KdpServiceDispatcher (trap_frame->gpr[3], (PCHAR)trap_frame->gpr[4],
Modified: branches/powerpc/reactos/ntoskrnl/ntoskrnl.rbuild URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ntoskrn... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ntoskrnl.rbuild (original) +++ branches/powerpc/reactos/ntoskrnl/ntoskrnl.rbuild Mon Jun 18 01:18:25 2007 @@ -251,10 +251,6 @@ <file>kdinit.c</file> <file>kdio.c</file> <file>kdmain.c</file> - </directory> - <directory name="ldr"> - <file>loader.c</file> - <file>rtl.c</file> </directory> <directory name="lpc"> <file>close.c</file>