diff --git a/include/cpu.h b/include/cpu.h index ef488cc1..70a13d86 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -61,9 +61,9 @@ bool CPU_LMSW(Bitu word); void CPU_VERR(Bitu selector); void CPU_VERW(Bitu selector); -void CPU_JMP(bool use32,Bitu selector,Bitu offset); -void CPU_CALL(bool use32,Bitu selector,Bitu offset); -void CPU_RET(bool use32,Bitu bytes); +void CPU_JMP(bool use32,Bitu selector,Bitu offset,Bitu opLen=0); +void CPU_CALL(bool use32,Bitu selector,Bitu offset,Bitu opLen=0); +void CPU_RET(bool use32,Bitu bytes,Bitu opLen=0); #define CPU_INT_SOFTWARE 0x1 #define CPU_INT_EXCEPTION 0x2 diff --git a/src/cpu/core_normal/prefix_66.h b/src/cpu/core_normal/prefix_66.h index 2bae5eb2..50e4ea74 100644 --- a/src/cpu/core_normal/prefix_66.h +++ b/src/cpu/core_normal/prefix_66.h @@ -145,9 +145,11 @@ CASE_D(0x5f) /* POP EDI */ reg_edi=Pop_32();break; CASE_D(0x60) /* PUSHAD */ + { + Bitu tmpesp = reg_esp; Push_32(reg_eax);Push_32(reg_ecx);Push_32(reg_edx);Push_32(reg_ebx); - Push_32(reg_esp);Push_32(reg_ebp);Push_32(reg_esi);Push_32(reg_edi); - break; + Push_32(tmpesp);Push_32(reg_ebp);Push_32(reg_esi);Push_32(reg_edi); + }; break; CASE_D(0x61) /* POPAD */ reg_edi=Pop_32();reg_esi=Pop_32();reg_ebp=Pop_32();Pop_32();//Don't save ESP reg_ebx=Pop_32();reg_edx=Pop_32();reg_ecx=Pop_32();reg_eax=Pop_32(); @@ -478,13 +480,13 @@ { Bitu words=Fetchw(); LEAVECORE; - CPU_RET(true,words); + CPU_RET(true,words,core.ip_lookup-core.op_start); goto decode_start; } CASE_D(0xcb) /* RETF */ { LEAVECORE; - CPU_RET(true,0); + CPU_RET(true,0,core.ip_lookup-core.op_start); goto decode_start; } CASE_D(0xcf) /* IRET */ @@ -528,7 +530,7 @@ Bit32u newip=Fetchd(); Bit16u newcs=Fetchw(); LEAVECORE; - CPU_JMP(true,newcs,newip); + CPU_JMP(true,newcs,newip,core.ip_lookup-core.op_start); goto decode_start; } CASE_D(0xed) /* IN EAX,DX */ @@ -615,7 +617,7 @@ Bit32u newip=LoadMd(eaa); Bit16u newcs=LoadMw(eaa+4); LEAVECORE; - CPU_JMP(true,newcs,newip); + CPU_JMP(true,newcs,newip,core.ip_lookup-core.op_start); goto decode_start; } break; diff --git a/src/cpu/core_normal/prefix_none.h b/src/cpu/core_normal/prefix_none.h index e1b2953b..464c3171 100644 --- a/src/cpu/core_normal/prefix_none.h +++ b/src/cpu/core_normal/prefix_none.h @@ -548,7 +548,7 @@ { Bit16u newip=Fetchw();Bit16u newcs=Fetchw(); LEAVECORE; - CPU_CALL(false,newcs,newip); + CPU_CALL(false,newcs,newip,core.ip_lookup-core.op_start); goto decode_start; } CASE_B(0x9b) /* WAIT */ @@ -738,12 +738,12 @@ { Bitu words=Fetchw(); LEAVECORE; - CPU_RET(false,words); + CPU_RET(false,words,core.ip_lookup-core.op_start); goto decode_start; } CASE_W(0xcb) /* RETF */ LEAVECORE; - CPU_RET(false,0); + CPU_RET(false,0,core.ip_lookup-core.op_start); goto decode_start; CASE_B(0xcc) /* INT3 */ LEAVECORE; @@ -935,7 +935,7 @@ Bit16u newip=Fetchw(); Bit16u newcs=Fetchw(); LEAVECORE; - CPU_JMP(false,newcs,newip); + CPU_JMP(false,newcs,newip,core.ip_lookup-core.op_start); goto decode_start; } CASE_B(0xeb) /* JMP Jb */ @@ -962,7 +962,7 @@ LEAVECORE; if (CPU_HLT()) { reg_eip-=core.ip_lookup-core.op_start; - CPU_StartException(); + CPU_Exception(13,0); goto decode_start; } return CBRET_NONE; //Needs to return for hlt cpu core @@ -1123,7 +1123,7 @@ Bit16u newip=LoadMw(eaa); Bit16u newcs=LoadMw(eaa+2); LEAVECORE; - CPU_CALL(false,newcs,newip); + CPU_CALL(false,newcs,newip,core.ip_lookup-core.op_start); goto decode_start; } break; @@ -1137,7 +1137,7 @@ Bit16u newip=LoadMw(eaa); Bit16u newcs=LoadMw(eaa+2); LEAVECORE; - CPU_JMP(false,newcs,newip); + CPU_JMP(false,newcs,newip,core.ip_lookup-core.op_start); goto decode_start; } break;