#define gaPAE_TmpDir ((tTabEnt*)PAE_TMP_DIR_ADDR)
#define gaPAE_TmpPDPT ((tTabEnt*)PAE_TMP_PDPT_ADDR)
int gbUsePAE = 0;
- int gilTempMappings = 0;
- int gilTempFractal = 0;
+tMutex glTempMappings;
+tMutex glTempFractal;
Uint32 gWorkerStacks[(NUM_WORKER_STACKS+31)/32];
int giLastUsedWorker = 0;
tVAddr kStackBase = Proc_GetCurThread()->KernelStack - KERNEL_STACK_SIZE;
void *tmp;
- LOCK( &gilTempFractal );
+ Mutex_Acquire( &glTempFractal );
// Create Directory Table
*gpTmpCR3 = MM_AllocPhys() | 3;
}
ret = *gpTmpCR3 & ~0xFFF;
- RELEASE( &gilTempFractal );
+ Mutex_Release( &glTempFractal );
//LEAVE('x', ret);
return ret;
*/
tVAddr MM_NewKStack(void)
{
- tVAddr base = KERNEL_STACKS;
+ tVAddr base;
Uint i;
- for(;base<KERNEL_STACKS_END;base+=KERNEL_STACK_SIZE)
+ for(base = KERNEL_STACKS; base < KERNEL_STACKS_END; base += KERNEL_STACK_SIZE)
{
if(MM_GetPhysAddr(base) != 0) continue;
- for(i=0;i<KERNEL_STACK_SIZE;i+=0x1000) {
+ for(i = 0; i < KERNEL_STACK_SIZE; i += 0x1000) {
MM_Allocate(base+i);
}
+ Log("MM_NewKStack - Allocated %p", base + KERNEL_STACK_SIZE);
return base+KERNEL_STACK_SIZE;
}
Warning("MM_NewKStack - No address space left\n");
//Log(" MM_NewWorkerStack: base = 0x%x", base);
// Acquire the lock for the temp fractal mappings
- LOCK(&gilTempFractal);
+ Mutex_Acquire(&glTempFractal);
// Set the temp fractals to TID0's address space
*gpTmpCR3 = ((Uint)gaInitPageDir - KERNEL_BASE) | 3;
}
*gpTmpCR3 = 0;
// Release the temp mapping lock
- RELEASE(&gilTempFractal);
+ Mutex_Release(&glTempFractal);
// Copy the old stack
oldstack = (esp + KERNEL_STACK_SIZE-1) & ~(KERNEL_STACK_SIZE-1);
PAddr &= ~0xFFF;
- //LOG("gilTempMappings = %i", gilTempMappings);
+ //LOG("glTempMappings = %i", glTempMappings);
for(;;)
{
- LOCK( &gilTempMappings );
+ Mutex_Acquire( &glTempMappings );
for( i = 0; i < NUM_TEMP_PAGES; i ++ )
{
gaPageTable[ (TEMP_MAP_ADDR >> 12) + i ] = PAddr | 3;
INVLPG( TEMP_MAP_ADDR + (i << 12) );
//LEAVE('p', TEMP_MAP_ADDR + (i << 12));
- RELEASE( &gilTempMappings );
+ Mutex_Release( &glTempMappings );
return TEMP_MAP_ADDR + (i << 12);
}
- RELEASE( &gilTempMappings );
- Threads_Yield();
+ Mutex_Release( &glTempMappings );
+ Threads_Yield(); // TODO: Less expensive
}
}
i = VAddr >> 12;
- LOCK( &gilTempMappings ); // Temp and HW share a directory, so they share a lock
-
+ Mutex_Acquire( &glTempMappings ); // Temp and HW share a directory, so they share a lock
for( j = 0; j < Number; j++ )
{
gaPageTable[ i + j ] = 0;
}
- RELEASE( &gilTempMappings );
+ Mutex_Release( &glTempMappings );
}
// --- EXPORTS ---