Semaphore_Init(&gVM8086_TasksToDo, 0, 10, "VM8086", "TasksToDo");
// Lock to avoid race conditions
Mutex_Acquire( &glVM8086_Process );
// Create BIOS Call process
Semaphore_Init(&gVM8086_TasksToDo, 0, 10, "VM8086", "TasksToDo");
// Lock to avoid race conditions
Mutex_Acquire( &glVM8086_Process );
// Create BIOS Call process
- for(i=0xA0;i<0x100;i++) {
- MM_Map( i * 0x1000, i * 0x1000 );
+ for(unsigned int i = 0xA0;i<0x100;i++) {
+ MM_RefPhys(i * 0x1000);
+ MM_Map( (void*)(i * 0x1000), i * 0x1000 );
if( MM_GetRefCount(0x00000) > 2 ) {
Log_Notice("VM8086", "Ok, who's touched the IVT? (%i)",
MM_GetRefCount(0x00000));
}
if( MM_GetRefCount(0x00000) > 2 ) {
Log_Notice("VM8086", "Ok, who's touched the IVT? (%i)",
MM_GetRefCount(0x00000));
}
if( MM_GetRefCount(0x9F000) > 2 ) {
Log_Notice("VM8086", "And who's been playing with my EBDA? (%i)",
MM_GetRefCount(0x9F000));
}
// System Stack / Stub
if( MM_GetRefCount(0x9F000) > 2 ) {
Log_Notice("VM8086", "And who's been playing with my EBDA? (%i)",
MM_GetRefCount(0x9F000));
}
// System Stack / Stub
stacksetup--; *stacksetup = 0x20|3; // ES - Kernel
stacksetup--; *stacksetup = 0x20|3; // FS
stacksetup--; *stacksetup = 0x20|3; // GS
stacksetup--; *stacksetup = 0x20|3; // ES - Kernel
stacksetup--; *stacksetup = 0x20|3; // FS
stacksetup--; *stacksetup = 0x20|3; // GS
if(Regs->eip == VM8086_MAGIC_IP && Regs->cs == VM8086_MAGIC_CS
&& Threads_GetPID() == gVM8086_WorkerPID)
{
if(Regs->eip == VM8086_MAGIC_IP && Regs->cs == VM8086_MAGIC_CS
&& Threads_GetPID() == gVM8086_WorkerPID)
{
if( gpVM8086_State == (void*)-1 ) {
Log_Log("VM8086", "Worker thread ready and waiting");
gpVM8086_State = NULL;
if( gpVM8086_State == (void*)-1 ) {
Log_Log("VM8086", "Worker thread ready and waiting");
gpVM8086_State = NULL;
}
// Log_Log("VM8086", "gpVM8086_State = %p, gVM8086_CallingThread = %i",
// gpVM8086_State, gVM8086_CallingThread);
}
// Log_Log("VM8086", "gpVM8086_State = %p, gVM8086_CallingThread = %i",
// gpVM8086_State, gVM8086_CallingThread);
gpVM8086_State->AX = Regs->eax; gpVM8086_State->CX = Regs->ecx;
gpVM8086_State->DX = Regs->edx; gpVM8086_State->BX = Regs->ebx;
gpVM8086_State->BP = Regs->ebp;
gpVM8086_State->AX = Regs->eax; gpVM8086_State->CX = Regs->ecx;
gpVM8086_State->DX = Regs->edx; gpVM8086_State->BX = Regs->ebx;
gpVM8086_State->BP = Regs->ebp;
LOG("gpVM8086_State = %p", gpVM8086_State);
LOG("gpVM8086_State->Internal = %p", gpVM8086_State->Internal);
LOG("gpVM8086_State = %p", gpVM8086_State);
LOG("gpVM8086_State->Internal = %p", gpVM8086_State->Internal);
__asm__ __volatile__ ("sti");
Semaphore_Wait(&gVM8086_TasksToDo, 1);
__asm__ __volatile__ ("sti");
Semaphore_Wait(&gVM8086_TasksToDo, 1);
- MM_Map( VM8086_USER_BASE + i*PAGE_SIZE, gpVM8086_State->Internal->AllocatedPages[i].PhysAddr );
+ MM_RefPhys( gpVM8086_State->Internal->AllocatedPages[i].PhysAddr );
+ MM_Map( (tPage*)VM8086_USER_BASE + i, gpVM8086_State->Internal->AllocatedPages[i].PhysAddr );
- for( j = 0; j < 32; j++ ) {
- if( pages[i].Bitmap & (1 << j) ) {
+ // - 32 blocks per page == 128 bytes per block == 8 segments
+ for( j = 0; j < 32; j++ )
+ {
+ if( pages[i].Bitmap & (1 << j) )
+ {
*Offset = 0;
LOG("Allocated at #%i,%04x", i, base*8*16);
LOG(" - %x:%x", *Segment, *Offset);
*Offset = 0;
LOG("Allocated at #%i,%04x", i, base*8*16);
LOG(" - %x:%x", *Segment, *Offset);
*Segment = (VM8086_USER_BASE + i * 0x1000) / 16;
*Offset = 0;
LOG(" - %04x:%04x", *Segment, *Offset);
*Segment = (VM8086_USER_BASE + i * 0x1000) / 16;
*Offset = 0;
LOG(" - %04x:%04x", *Segment, *Offset);