Author: arty
Date: Thu May 17 11:54:40 2007
New Revision: 26818
URL:
http://svn.reactos.org/svn/reactos?rev=26818&view=rev
Log:
- Fix a last bug in elf code.
- Start cleaning in kernel land for our current environment.
- Fix the build process just a bit (assign common addresses and loosen
acceptable sections a bit).
Modified:
branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c
branches/powerpc/reactos/ntoskrnl/ke/freeldr.c
branches/powerpc/reactos/tools/ppc-build/elfpe/compdvr.cpp
branches/powerpc/reactos/tools/ppc-build/elfpe/header.cpp
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c (original)
+++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c Thu May 17 11:54:40
2007
@@ -196,6 +196,15 @@
}
MmuMapPage((void *)KernelBase, info, page);
+
+ /* Map module name strings */
+ for( 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].phys = page;
+ MmuMapPage((void *)page, info, 1);
+ }
/* Tell them we're booting */
DrawNumber(LocalBootInfo,(ULONG)&LoaderBlock,10,100);
@@ -513,10 +522,20 @@
memcpy(&symbol, SymbolSection + (ELF32_R_SYM(reloc.r_info) * sizeof(symbol)),
sizeof(symbol));
/* Compute addends */
- S = symbol.st_value + ELF_SECTION(symbol.st_shndx)->sh_addr + KernelAddr;
+ S = symbol.st_value + ELF_SECTION(symbol.st_shndx)->sh_addr + KernelAddr +
reloc.r_addend;
A = reloc.r_addend;
P = reloc.r_offset + ELF_SECTION(targetSection)->sh_addr;
-
+
+#if 0
+ printf("Symbol %d -> %d(%x:%x) -> %x@%x\n",
+ ELF32_R_SYM(reloc.r_info),
+ symbol.st_shndx,
+ ELF_SECTION(symbol.st_shndx)->sh_addr,
+ symbol.st_value,
+ S,
+ P);
+#endif
+
Target32 = (ULONG*)(((PCHAR)MemLoadAddr) + P);
Target16 = (USHORT *)Target32;
x = *Target32;
Modified: branches/powerpc/reactos/ntoskrnl/ke/freeldr.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/fre…
==============================================================================
--- branches/powerpc/reactos/ntoskrnl/ke/freeldr.c (original)
+++ branches/powerpc/reactos/ntoskrnl/ke/freeldr.c Thu May 17 11:54:40 2007
@@ -323,21 +323,6 @@
PKTSS Tss;
PKGDTENTRY TssEntry;
#endif
-#ifdef _M_PPC
- {
- __asm__("ori 0,0,0");
- char *nk = "ntoskrnl is here";
- 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);
- DrawString(BootInfo, nk, 100, 150);
- __asm__("ori 0,0,0");
- }
-#endif
#ifdef _M_IX86
/* Load the GDT and IDT */
@@ -354,9 +339,6 @@
TssEntry->HighWord.Bytes.BaseMid = (UCHAR)((ULONG_PTR)Tss >> 16);
TssEntry->HighWord.Bytes.BaseHi = (UCHAR)((ULONG_PTR)Tss >> 24);
#endif
-
- DrawNumber(BootInfo, 0xb0071f03, 190, 90);
- DrawNumber(BootInfo, (ULONG)BootInfo, 190, 100);
/* Copy the Loader Block Data locally since Low-Memory will be wiped */
memcpy(&KeRosLoaderBlock, LoaderBlock, sizeof(ROS_LOADER_PARAMETER_BLOCK));
@@ -424,14 +406,6 @@
}
#ifdef _M_PPC
- if(i == 0) {
- DrawNumber(BootInfo, KeLoaderModules[i].ModStart, 10, 200);
- DrawNumber(BootInfo, KeLoaderModules[i].ModEnd - KeLoaderModules[i].ModStart, 100,
200);
- DrawNumber(BootInfo, KeLoaderModules[i].ModEnd, 190, 200);
- DrawNumber(BootInfo, KeLoaderModules[i+1].ModStart, 10, 210);
- DrawNumber(BootInfo, KeLoaderModules[i+1].ModEnd - KeLoaderModules[i+1].ModStart,
100, 210);
- DrawNumber(BootInfo, KeLoaderModules[i+1].ModEnd, 190, 210);
- }
KeLoaderModules[i].ModStart += KSEG0_BASE - StartKernelBase;
KeLoaderModules[i].ModEnd += KSEG0_BASE - StartKernelBase;
#else
@@ -453,30 +427,18 @@
}
/* 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);
+ ROUND_UP(KeLoaderModules[KeRosLoaderBlock.ModsCount - 1].ModEnd, 0x10000);
/* Select the HAL Base */
HalBase = KeLoaderModules[1].ModStart;
/* Choose Driver Base */
DriverBase = MmFreeLdrLastKernelAddress;
+#ifdef _M_PPC
+ LdrHalBase = KeLoaderModules[1].ModStart;
+#else
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 */
Modified: branches/powerpc/reactos/tools/ppc-build/elfpe/compdvr.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/tools/ppc-build…
==============================================================================
--- branches/powerpc/reactos/tools/ppc-build/elfpe/compdvr.cpp (original)
+++ branches/powerpc/reactos/tools/ppc-build/elfpe/compdvr.cpp Thu May 17 11:54:40 2007
@@ -164,6 +164,7 @@
args.insert(args.begin()+1,"-T");
args.insert(args.begin()+2,ldscript);
args.insert(args.begin()+1,"-r");
+ args.insert(args.begin()+1,"-dc");
for( size_t i = 0; i < args.size(); i++ ) {
if( args[i] == "-o" && i < args.size()-1 ) {
Modified: branches/powerpc/reactos/tools/ppc-build/elfpe/header.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/tools/ppc-build…
==============================================================================
--- branches/powerpc/reactos/tools/ppc-build/elfpe/header.cpp (original)
+++ branches/powerpc/reactos/tools/ppc-build/elfpe/header.cpp Thu May 17 11:54:40 2007
@@ -135,8 +135,7 @@
for(int i = 0; i < eof->getNumSections(); i++) {
{
const ElfObjectFile::Section § = eof->getSection(i);
- if((sect.getType() == SHT_PROGBITS) &&
- (sect.getFlags() & SHF_ALLOC)) {
+ if(sect.getFlags() & SHF_ALLOC) {
limit = roundup(start + sect.logicalSize(), sectionalign);
#if 0
fprintf(stderr, "rva[%02d:%s] = (%x %x %d)\n",