else
{
// Large page
- // TODO:
Log_Warning("MMVirt", "TODO: Implement large pages in MM_int_SetPageInfo");
}
break;
case 20: // Section or unmapped
- Warning("TODO: Implement sections");
+ Log_Warning("MMVirt", "TODO: Implement sections in MM_int_SetPageInfo");
break;
case 24: // Supersection
// Error if not aligned
{
if( pi->PhysAddr == 0 ) {
*desc = 0;
- // TODO: Apply to all entries
- LEAVE('i', 0);
- return 0;
}
- // Apply
- *desc = pi->PhysAddr & 0xFF000000;
-// *desc |= ((pi->PhysAddr >> 32) & 0xF) << 20;
-// *desc |= ((pi->PhysAddr >> 36) & 0x7) << 5;
- *desc |= 2 | (1 << 18);
+ else {
+ // Apply
+ *desc = pi->PhysAddr & 0xFF000000;
+// *desc |= ((pi->PhysAddr >> 32) & 0xF) << 20;
+// *desc |= ((pi->PhysAddr >> 36) & 0x7) << 5;
+ *desc |= 2 | (1 << 18);
+ }
// TODO: Apply to all entries
+ Log_Warning("MMVirt", "TODO: Apply changes to all entries of supersections");
LEAVE('i', 0);
return 0;
}
// TODO: What here?
+ Log_Warning("MMVirt", "TODO: 24-bit not on supersection?");
LEAVE('i', 1);
return 1;
}
{
tPAddr table;
Uint32 *tmp_map;
- Uint32 *cur = (void*)MM_TABLE0USER;
+ Uint32 *cur = (void*)MM_TABLE1USER;
// Uint32 *cur = &FRACTAL(MM_TABLE1USER,0);
int i;
for( i = 0; i < 1024; i ++ )
{
- switch(cur[i] & 3)
+// Log_Debug("MMVirt", "cur[%i] (%p) = %x", Table*256+i, &cur[Table*256+i], cur[Table*256+i]);
+ switch(cur[Table*256+i] & 3)
{
case 0: tmp_map[i] = 0; break;
case 1:
tmp_map[i] = 0;
- Log_Error("MMVirt", "TODO: Support large pages in MM_int_CloneTable");
+ Log_Error("MMVirt", "TODO: Support large pages in MM_int_CloneTable (%p)", (Table*256+i)*0x1000);
// Large page?
break;
case 2:
Uint32 *new_lvl1_1, *new_lvl1_2, *cur;
Uint32 *tmp_map;
int i;
+
+// MM_DumpTables(0, KERNEL_BASE);
ret = MM_AllocateRootTable();
tmp_map = new_lvl1_1;
for( i = 0; i < 0x800-4; i ++ )
{
-// Log("i = %i", i);
+ // HACK! Ignore the original identity mapping
+ if( i == 0 && Threads_GetTID() == 0 ) {
+ tmp_map[0] = 0;
+ continue;
+ }
if( i == 0x400 )
tmp_map = &new_lvl1_2[-0x400];
switch( cur[i] & 3 )
sp = __SP & ~(MM_KSTACK_SIZE-1);
j = (sp / 0x1000) % 1024;
num = MM_KSTACK_SIZE/0x1000;
+
+ Log("num = %i, sp = %p, j = %i", num, sp, j);
// Copy stack pages
for(; num--; j ++, sp += 0x1000)
return ret;
}
-tPAddr MM_ClearUser(void)
+void MM_ClearUser(void)
{
- // TODO: Implement ClearUser
- return 0;
+ Log_KernelPanic("MMVirt", "TODO: Implement MM_ClearUser");
}
tVAddr MM_MapTemp(tPAddr PAddr)
if( MM_int_GetPageInfo(ret, &pi) == 0 )
continue;
-// Log("MapTemp %P at %p", PAddr, ret);
+ Log("MapTemp %P at %p by %p", PAddr, ret, __builtin_return_address(0));
MM_RefPhys(PAddr); // Counter the MM_Deallocate in FreeTemp
MM_Map(ret, PAddr);
void MM_FreeTemp(tVAddr VAddr)
{
- // TODO: Implement FreeTemp
if( VAddr < MM_TMPMAP_BASE || VAddr >= MM_TMPMAP_END ) {
Log_Warning("MMVirt", "MM_FreeTemp: Passed an addr not from MM_MapTemp (%p)", VAddr);
return ;
{
if( giMM_ZeroPage && Info->PhysAddr == giMM_ZeroPage )
{
- Log("%p => %8s - 0x%7x %i %x",
+ Debug("%p => %8s - 0x%7x %i %x",
Start, "ZERO", Len,
Info->Domain, Info->AP
);
}
else
{
- Log("%p => %8x - 0x%7x %i %x",
+ Debug("%p => %8x - 0x%7x %i %x",
Start, Info->PhysAddr-Len, Len,
Info->Domain, Info->AP
);
pi_old.Size = 0;
- Log("Page Table Dump:");
+ Debug("Page Table Dump:");
range_start = Start;
for( addr = Start; i == 0 || (addr && addr < End); i = 1 )
{
+ int rv;
// Log("addr = %p", addr);
- int rv = MM_int_GetPageInfo(addr, &pi);
+ rv = MM_int_GetPageInfo(addr, &pi);
if( rv
|| pi.Size != pi_old.Size
|| pi.Domain != pi_old.Domain
}
if(inRange)
MM_int_DumpTableEnt(range_start, addr - range_start, &pi);
- Log("Done");
+ Debug("Done");
}