cur += 256*Table;
- tmp_map = (void*)MM_MapTemp(table);
+ tmp_map = MM_MapTemp(table);
for( i = 0; i < 1024; i ++ )
{
tPAddr newpage;
newpage = MM_AllocPhys();
src = (void*)( (Table*256+i)*0x1000 );
- dst = (void*)MM_MapTemp(newpage);
+ dst = MM_MapTemp(newpage);
// Debug("Taking a copy of kernel page %p (%P)", src, cur[i] & ~0xFFF);
memcpy(dst, src, PAGE_SIZE);
- MM_FreeTemp( (tVAddr)dst );
+ MM_FreeTemp( dst );
tmp_map[i] = newpage | (cur[i] & 0xFFF);
}
else
break;
}
}
- MM_FreeTemp( (tVAddr) tmp_map );
+ MM_FreeTemp( tmp_map );
DestEnt[0] = table + 0*0x400 + 1;
DestEnt[1] = table + 1*0x400 + 1;
ret = MM_AllocateRootTable();
cur = (void*)MM_TABLE0USER;
- new_lvl1_1 = (void*)MM_MapTemp(ret);
- new_lvl1_2 = (void*)MM_MapTemp(ret+0x1000);
+ new_lvl1_1 = MM_MapTemp(ret);
+ new_lvl1_2 = MM_MapTemp(ret+0x1000);
tmp_map = new_lvl1_1;
for( i = 0; i < 0x800-4; i ++ )
{
{
int j, num;
tPAddr tmp = MM_AllocPhys();
- Uint32 *table = (void*)MM_MapTemp(tmp);
+ Uint32 *table = MM_MapTemp(tmp);
Uint32 sp;
register Uint32 __SP asm("sp");
// Log("page = %P", page);
table[j] = page | 0x813;
- tmp_page = (void*)MM_MapTemp(page);
+ tmp_page = MM_MapTemp(page);
memcpy(tmp_page, (void*)sp, 0x1000);
- MM_FreeTemp( (tVAddr) tmp_page );
+ MM_FreeTemp( tmp_page );
}
- MM_FreeTemp( (tVAddr)table );
+ MM_FreeTemp( table );
}
- MM_FreeTemp( (tVAddr)new_lvl1_1 );
- MM_FreeTemp( (tVAddr)new_lvl1_2 );
+ MM_FreeTemp( new_lvl1_1 );
+ MM_FreeTemp( new_lvl1_2 );
// Log("MM_Clone: ret = %P", ret);
// MM_DumpTables(0, 0x80000000);
}
-tVAddr MM_MapTemp(tPAddr PAddr)
+void *MM_MapTemp(tPAddr PAddr)
{
tVAddr ret;
tMM_PageInfo pi;
MM_RefPhys(PAddr); // Counter the MM_Deallocate in FreeTemp
MM_Map(ret, PAddr);
- return ret;
+ return (void*)ret;
}
Log_Warning("MMVirt", "MM_MapTemp: All slots taken");
return 0;
}
-void MM_FreeTemp(tVAddr VAddr)
+void MM_FreeTemp(void *Ptr)
{
+ tVAddr VAddr = (tVAddr)Ptr;
if( VAddr < MM_TMPMAP_BASE || VAddr >= MM_TMPMAP_END ) {
Log_Warning("MMVirt", "MM_FreeTemp: Passed an addr not from MM_MapTemp (%p)", VAddr);
return ;
Log_Error("MMVirt", "Unable to allocate new page for COW");
for(;;);
}
- dst = (void*)MM_MapTemp(newpage);
+ dst = MM_MapTemp(newpage);
src = (void*)(Addr & ~(PAGE_SIZE-1));
memcpy( dst, src, PAGE_SIZE );
- MM_FreeTemp( (tVAddr)dst );
+ MM_FreeTemp( dst );
#if TRACE_COW
Log_Notice("MMVirt", "COW %p caused by %p, %P duped to %P (RefCnt(%i)--)", Addr, PC,
ASSERT(paddr != curpage);
- tmp = (void*)MM_MapTemp(paddr);
+ tmp = MM_MapTemp(paddr);
memcpy( tmp, NextLevel, 0x1000 );
- MM_FreeTemp( (tVAddr)tmp );
+ MM_FreeTemp( tmp );
#if TRACE_COW
Log_Debug("MMVirt", "COW ent at %p (%p) from %P to %P", Ent, NextLevel, curpage, paddr);
}
// --- Tempory Mappings ---
-tVAddr MM_MapTemp(tPAddr PAddr)
+void *MM_MapTemp(tPAddr PAddr)
{
const int max_slots = (MM_TMPMAP_END - MM_TMPMAP_BASE) / PAGE_SIZE;
tVAddr ret = MM_TMPMAP_BASE;
*ent = PAddr | 3;
MM_RefPhys(PAddr);
INVLPG(ret);
- return ret;
+ return (void*)ret;
}
return 0;
}
-void MM_FreeTemp(tVAddr VAddr)
+void MM_FreeTemp(void *Ptr)
{
- MM_Deallocate(VAddr);
+ MM_Deallocate((tVAddr)Ptr);
return ;
}
for( i = 1; i < KERNEL_STACK_SIZE/0x1000; i ++ )
{
tPAddr phys = MM_AllocPhys();
- tVAddr tmpmapping;
+ void *tmpmapping;
MM_MapEx(kstackbase+i*0x1000, phys, 1, 0);
tmpmapping = MM_MapTemp(phys);
if( MM_GetPhysAddr( kstackbase+i*0x1000 ) )
- memcpy((void*)tmpmapping, (void*)(kstackbase+i*0x1000), 0x1000);
+ memcpy(tmpmapping, (void*)(kstackbase+i*0x1000), 0x1000);
else
- memset((void*)tmpmapping, 0, 0x1000);
+ memset(tmpmapping, 0, 0x1000);
// if( i == 0xF )
// Debug_HexDump("MM_Clone: *tmpmapping = ", (void*)tmpmapping, 0x1000);
MM_FreeTemp(tmpmapping);
Log_Error("MM", "MM_NewWorkerStack: StackSize(0x%x) > 0x1000, cbf handling", StackSize);
}
else {
- tVAddr tmp_addr, dest;
+ void *tmp_addr, *dest;
tmp_addr = MM_MapTemp(phys);
- dest = tmp_addr + (0x1000 - StackSize);
- memcpy( (void*)dest, StackData, StackSize );
+ dest = (char*)tmp_addr + (0x1000 - StackSize);
+ memcpy( dest, StackData, StackSize );
Log_Debug("MM", "MM_NewWorkerStack: %p->%p %i bytes (i=%i)", StackData, dest, StackSize, i);
Log_Debug("MM", "MM_NewWorkerStack: ret = %p", ret);
MM_FreeTemp(tmp_addr);