mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
Remaining fixes from branch transition. MmuTurnOn, now with GDB stub.
svn path=/trunk/; revision=29894
This commit is contained in:
parent
e40b261ed9
commit
f6640c9b72
|
@ -127,8 +127,6 @@ VOID
|
|||
NTAPI
|
||||
FrLdrStartup(ULONG Magic)
|
||||
{
|
||||
KernelEntryFn KernelEntryAddress =
|
||||
(KernelEntryFn)(KernelEntryPoint + KernelBase);
|
||||
ULONG_PTR i, j, page, count;
|
||||
PCHAR ModHeader;
|
||||
boot_infos_t *LocalBootInfo = &BootInfo;
|
||||
|
@ -136,6 +134,8 @@ FrLdrStartup(ULONG Magic)
|
|||
LoaderBlock.ArchExtra = (ULONG)LocalBootInfo;
|
||||
ppc_map_info_t *info = MmAllocateMemory(0x80 * sizeof(*info));
|
||||
|
||||
printf("FrLdrStartup(KernelEntry = %x)\n", KernelEntryPoint);
|
||||
|
||||
for(i = 0; i < LoaderBlock.ModsCount; i++)
|
||||
{
|
||||
ModHeader = ((PCHAR)reactos_modules[i].ModStart);
|
||||
|
@ -145,19 +145,28 @@ FrLdrStartup(ULONG Magic)
|
|||
(PCHAR)reactos_modules[i].String);
|
||||
}
|
||||
|
||||
printf("PpcInitializeMmu\n");
|
||||
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;
|
||||
|
@ -169,11 +178,14 @@ FrLdrStartup(ULONG Magic)
|
|||
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);
|
||||
|
||||
/* 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++ )
|
||||
{
|
||||
|
@ -181,6 +193,8 @@ FrLdrStartup(ULONG Magic)
|
|||
}
|
||||
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;
|
||||
|
@ -194,6 +208,7 @@ FrLdrStartup(ULONG Magic)
|
|||
{
|
||||
if(info[j].addr == page) break;
|
||||
}
|
||||
|
||||
if( j != count )
|
||||
{
|
||||
info[count].flags = MMU_ALL_RW;
|
||||
|
@ -202,9 +217,13 @@ FrLdrStartup(ULONG Magic)
|
|||
info[count].phys = page; // PpcVirt2phys(page, 0);
|
||||
count++;
|
||||
}
|
||||
printf("Mapping module name strings\n");
|
||||
MmuMapPage(info, count);
|
||||
printf("Module name strings mapped\n");
|
||||
|
||||
MmuTurnOn(KernelEntryAddress, (void*)&LoaderBlock);
|
||||
printf("MmuTurnOn(KernelEntry = %x)\n", KernelEntryPoint);
|
||||
MmuTurnOn((KernelEntryFn)KernelEntryPoint, (void*)&LoaderBlock);
|
||||
printf("MAED OF FALE!!1\n");
|
||||
|
||||
/* Nothing more */
|
||||
while(1);
|
||||
|
@ -467,7 +486,6 @@ FrLdrMapModule(FILE *KernelImage, PCHAR ImageName, PCHAR MemLoadAddr, ULONG Kern
|
|||
}
|
||||
|
||||
ImageSize = SWAPD(NtHeader->OptionalHeader.SizeOfImage);
|
||||
KernelEntryPoint = SWAPD(NtHeader->OptionalHeader.AddressOfEntryPoint);
|
||||
printf("Total image size is %x\n", ImageSize);
|
||||
|
||||
/* Handle relocation sections */
|
||||
|
@ -689,17 +707,21 @@ PVOID
|
|||
NTAPI
|
||||
FrLdrMapImage(IN FILE *Image, IN PCHAR ShortName, IN ULONG ImageType)
|
||||
{
|
||||
PVOID Result;
|
||||
PVOID Result = NULL;
|
||||
|
||||
printf("Loading image %s (type %d)\n", ShortName, ImageType);
|
||||
|
||||
if (ImageType == 1)
|
||||
{
|
||||
if(FrLdrMapKernel(Image))
|
||||
return (PVOID)KernelMemory;
|
||||
else
|
||||
return NULL;
|
||||
Result = (PVOID)KernelMemory;
|
||||
}
|
||||
else
|
||||
Result = (PVOID)FrLdrLoadModule(Image, ShortName, NULL);
|
||||
{
|
||||
PVOID ModuleBase = (PVOID)NextModuleBase;
|
||||
if(FrLdrMapModule(Image, ShortName, 0, 0))
|
||||
Result = ModuleBase;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ void TakeException(int n, ppc_trap_frame_t *tf);
|
|||
|
||||
int _mmumain(int action, void *arg1, void *arg2, void *arg3, void *tf)
|
||||
{
|
||||
void (*fun)(void *) = arg1;
|
||||
ppc_trap_frame_t *trap_frame = (action >= 0x100) ? tf : arg1;
|
||||
int ret = 0;
|
||||
|
||||
|
@ -84,14 +83,14 @@ int _mmumain(int action, void *arg1, void *arg2, void *arg3, void *tf)
|
|||
if(!ptegreload(trap_frame, trap_frame->dar))
|
||||
{
|
||||
__asm__("mfmsr 3\n\tori 3,3,0x30\n\tmtmsr 3\n\t");
|
||||
if (!callback[action](action,trap_frame)) hang(action, trap_frame);
|
||||
if (!callback[action](action,trap_frame)) TakeException(action, trap_frame);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if(!ptegreload(trap_frame, trap_frame->srr0))
|
||||
{
|
||||
__asm__("mfmsr 3\n\tori 3,3,0x30\n\tmtmsr 3\n\t");
|
||||
if (!callback[action](action,trap_frame)) hang(action, trap_frame);
|
||||
if (!callback[action](action,trap_frame)) TakeException(action, trap_frame);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -141,16 +140,7 @@ int _mmumain(int action, void *arg1, void *arg2, void *arg3, void *tf)
|
|||
ret = mmunitest();
|
||||
break;
|
||||
case 0x107:
|
||||
__asm__("mfmsr 3\n\t"
|
||||
"ori 3,3,0x30\n\t"
|
||||
"mtmsr 3\n\t"
|
||||
"mtsdr1 %0\n\t"
|
||||
"mr 0,%2\n\t"
|
||||
"mtctr 0\n\t"
|
||||
"mr 3,%1\n\t"
|
||||
"bctrl\n\t"
|
||||
: : "r" (HTABORG), "r" (arg2), "r" (fun));
|
||||
/* BYE ! */
|
||||
callkernel(arg1, arg2);
|
||||
break;
|
||||
case 0x108:
|
||||
mmusetramsize((paddr_t)arg1);
|
||||
|
@ -423,7 +413,7 @@ void mmufreevsid(int vsid, int mask)
|
|||
for(i = 0; i < 16; i++)
|
||||
{
|
||||
if(mask & (1 << i))
|
||||
allocvsid((vsid << 4) + i);
|
||||
freevsid((vsid << 4) + i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -602,3 +592,18 @@ int ptegreload(ppc_trap_frame_t *frame, vaddr_t addr)
|
|||
__asm__("tlbie %0\n\tsync\n\tisync" : : "r" (addr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
void callkernel(void *fun_ptr, void *arg)
|
||||
{
|
||||
void (*fun)(void *) = fun_ptr;
|
||||
__asm__("mfmsr 3\n\t"
|
||||
"ori 3,3,0x30\n\t"
|
||||
"mtmsr 3\n\t"
|
||||
"mtsdr1 %0\n\t"
|
||||
"mr 0,%2\n\t"
|
||||
"mtctr 0\n\t"
|
||||
"mr 3,%1\n\t"
|
||||
"bctrl\n\t"
|
||||
: : "r" (HTABORG), "r" (arg), "r" (fun));
|
||||
/* BYE ! */
|
||||
}
|
||||
|
|
|
@ -12,5 +12,6 @@ void mmuallocvsid(int vsid, int mask);
|
|||
void freevsid(int);
|
||||
void mmufreevsid(int vsid, int mask);
|
||||
int mmunitest();
|
||||
void callkernel(void *fun_ptr, void *arg);
|
||||
|
||||
#endif/*_LIBMMU_MMUOBJECT_H*/
|
||||
|
|
Loading…
Reference in a new issue