// === FUNCTIONS ===
int VM8086_Install(char **Arguments)
{
- tPID pid;
-
Semaphore_Init(&gVM8086_TasksToDo, 0, 10, "VM8086", "TasksToDo");
// Lock to avoid race conditions
Mutex_Acquire( &glVM8086_Process );
// Create BIOS Call process
- pid = Proc_Clone(CLONE_VM);
- //Log_Debug("VM8086", "pid = %i", pid);
+ tPID pid = Proc_Clone(CLONE_VM);
+ LOG("pid = %i", pid);
if(pid == -1)
{
Log_Error("VM8086", "Unable to clone kernel into VM8086 worker");
{
Uint * volatile stacksetup; // Initialising Stack
Uint16 * volatile rmstack; // Real Mode Stack
- int i;
- //Log_Debug("VM8086", "Initialising worker");
+ LOG("Initialising worker");
// Set Image Name
Threads_SetName("VM8086");
// Map ROM Area
- for(i=0xA0;i<0x100;i++) {
+ for(unsigned int i = 0xA0;i<0x100;i++) {
+ MM_RefPhys(i * 0x1000);
MM_Map( (void*)(i * 0x1000), i * 0x1000 );
}
+ MM_RefPhys(0);
MM_Map( (void*)0, 0 ); // IVT / BDA
if( MM_GetRefCount(0x00000) > 2 ) {
Log_Notice("VM8086", "Ok, who's touched the IVT? (%i)",
MM_GetRefCount(0x00000));
}
+ MM_RefPhys(0x9F000);
MM_Map( (void*)0x9F000, 0x9F000 ); // Stack / EBDA
if( MM_GetRefCount(0x9F000) > 2 ) {
Log_Notice("VM8086", "And who's been playing with my EBDA? (%i)",
stacksetup--; *stacksetup = 0x20|3; // ES - Kernel
stacksetup--; *stacksetup = 0x20|3; // FS
stacksetup--; *stacksetup = 0x20|3; // GS
+ LOG("stacksetup = %p, entering vm8086");
__asm__ __volatile__ (
"mov %%eax,%%esp;\n\t" // Set stack pointer
"pop %%gs;\n\t"
gVM8086_WorkerPID = pid;
// It's released when the GPF fires
+ LOG("Waiting for worker %i to start", gVM8086_WorkerPID);
Mutex_Acquire( &glVM8086_Process );
Mutex_Release( &glVM8086_Process );
{
if( !gpVM8086_State->Internal->AllocatedPages[i].VirtBase )
continue ;
+ MM_RefPhys( gpVM8086_State->Internal->AllocatedPages[i].PhysAddr );
MM_Map( (tPage*)VM8086_USER_BASE + i, gpVM8086_State->Internal->AllocatedPages[i].PhysAddr );
}