vm86 mode(problem with #gp)
Posted: Thu Apr 16, 2009 9:05 am
Hello every body i'm trying to write vm8086 program
it run very good i use int 0x10 i know it should go to
#Gp handler and thats happen the problem when it back
from #GP handler **0x10 handler doesn't run but #GP handler still
repeat himself
that is my code
#gp handler
adding vm8086 code
thanks
it run very good i use int 0x10 i know it should go to
#Gp handler and thats happen the problem when it back
from #GP handler **0x10 handler doesn't run but #GP handler still
repeat himself
that is my code
#gp handler
Code: Select all
void GP::handle(regs r)
{
uchar *ip;
regs *vr=&r;
ushort *ivt=(ushort*)0x0;
ip = (uchar*)r.eip;
if(ip[0] = 0xCD)
{
vr->cs = ivt[ip[1]*2+1];
vr->eip= ivt[ip[1] * 2];
vr->eflags=0x23202;
return;
}
while(1);
}
Code: Select all
tasks[id].uesp = (uint)kh.alloc(stacksz)+stacksz-1;
tasks[id].kesp = (uint)kh.alloc(stacksz)-1;
uint *stack = (uint*)tasks[id].uesp;
*--stack = (ushort)(add >> 16);
*--stack = (ushort)(add >> 16);
*--stack = (ushort)(add >> 16);
*--stack = (ushort)(add >> 16);
*--stack = 0x10;
*--stack= 0xFFFe;
*--stack = 0x20202|0x200;
*--stack = (ushort)add>>16;
*--stack = (ushort)add&0xFFFF;
*--stack = 0;
*--stack = 0;
*--stack = 0;
*--stack = 0;
*--stack = 0;
*--stack = 0;
*--stack = 0;
*--stack =(iss)?0x10:0x10;
*--stack =(iss)?0x10:0x10;
*--stack =(iss)?0x10:0x10;
*--stack =(iss)?0x10:0x10;