RETF bug fuxed
This commit is contained in:
parent
6d904d8dac
commit
5bfbc9df5f
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.h,v 1.620 2009-11-13 15:55:46 sshwarts Exp $
|
||||
// $Id: cpu.h,v 1.621 2009-11-19 20:00:34 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -3890,9 +3890,9 @@ enum {
|
||||
#define BxPrefixSSE 0x0020 // Group encoding: 0010
|
||||
#define BxPrefixSSE66 0x0030 // Group encoding: 0011
|
||||
#define BxFPEscape 0x0040 // Group encoding: 0100
|
||||
#define BxRMGroup 0x0050 // Group encoding: 0101
|
||||
#define Bx3ByteOp 0x0060 // Group encoding: 0110
|
||||
#define BxOSizeGrp 0x0070 // Group encoding: 0111
|
||||
#define Bx3ByteOp 0x0050 // Group encoding: 0101
|
||||
#define BxOSizeGrp 0x0060 // Group encoding: 0110
|
||||
// 0x0070 // Group encoding: 0111
|
||||
|
||||
#define BxLockable 0x0100 // bit 8
|
||||
#define BxArithDstRM 0x0200 // bit 9
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: fetchdecode.cc,v 1.233 2009-11-06 18:19:01 sshwarts Exp $
|
||||
// $Id: fetchdecode.cc,v 1.234 2009-11-19 20:00:34 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -2768,9 +2768,6 @@ modrm_done:
|
||||
case BxGroupN:
|
||||
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[nnn]);
|
||||
break;
|
||||
case BxRMGroup:
|
||||
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[rm]);
|
||||
break;
|
||||
#if (BX_SUPPORT_SSE >= 4) || (BX_SUPPORT_SSE >= 3 && BX_SUPPORT_SSE_EXTENSION > 0)
|
||||
case Bx3ByteOp:
|
||||
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[b3]);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: fetchdecode64.cc,v 1.235 2009-11-06 18:19:01 sshwarts Exp $
|
||||
// $Id: fetchdecode64.cc,v 1.236 2009-11-19 20:00:34 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -3674,9 +3674,6 @@ modrm_done:
|
||||
case BxGroupN:
|
||||
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[nnn & 0x7]);
|
||||
break;
|
||||
case BxRMGroup:
|
||||
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[rm & 0x7]);
|
||||
break;
|
||||
#if (BX_SUPPORT_SSE >= 4) || (BX_SUPPORT_SSE >= 3 && BX_SUPPORT_SSE_EXTENSION > 0)
|
||||
case Bx3ByteOp:
|
||||
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[b3]);
|
||||
|
@ -1,5 +1,5 @@
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ret_far.cc,v 1.22 2009-10-14 20:45:29 sshwarts Exp $
|
||||
// $Id: ret_far.cc,v 1.23 2009-11-19 20:00:35 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2005-2009 Stanislav Shwartsman
|
||||
@ -170,47 +170,55 @@ BX_CPU_C::return_protected(bxInstruction_c *i, Bit16u pop_bytes)
|
||||
exception(BX_GP_EXCEPTION, 0, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
fetch_raw_descriptor(&ss_selector, &dword1, &dword2, BX_GP_EXCEPTION);
|
||||
parse_descriptor(dword1, dword2, &ss_descriptor);
|
||||
|
||||
fetch_raw_descriptor(&ss_selector, &dword1, &dword2, BX_GP_EXCEPTION);
|
||||
parse_descriptor(dword1, dword2, &ss_descriptor);
|
||||
/* selector RPL must = RPL of the return CS selector,
|
||||
* else #GP(selector) */
|
||||
if (ss_selector.rpl != cs_selector.rpl) {
|
||||
BX_ERROR(("return_protected: ss.rpl != cs.rpl"));
|
||||
exception(BX_GP_EXCEPTION, raw_ss_selector & 0xfffc, 0);
|
||||
}
|
||||
|
||||
/* selector RPL must = RPL of the return CS selector,
|
||||
* else #GP(selector) */
|
||||
if (ss_selector.rpl != cs_selector.rpl) {
|
||||
BX_ERROR(("return_protected: ss.rpl != cs.rpl"));
|
||||
exception(BX_GP_EXCEPTION, raw_ss_selector & 0xfffc, 0);
|
||||
}
|
||||
/* descriptor AR byte must indicate a writable data segment,
|
||||
* else #GP(selector) */
|
||||
if (ss_descriptor.valid==0 || ss_descriptor.segment==0 ||
|
||||
IS_CODE_SEGMENT(ss_descriptor.type) ||
|
||||
!IS_DATA_SEGMENT_WRITEABLE(ss_descriptor.type))
|
||||
{
|
||||
BX_ERROR(("return_protected: SS.AR byte not writable data"));
|
||||
exception(BX_GP_EXCEPTION, raw_ss_selector & 0xfffc, 0);
|
||||
}
|
||||
|
||||
/* descriptor AR byte must indicate a writable data segment,
|
||||
* else #GP(selector) */
|
||||
if (ss_descriptor.valid==0 || ss_descriptor.segment==0 ||
|
||||
IS_CODE_SEGMENT(ss_descriptor.type) ||
|
||||
!IS_DATA_SEGMENT_WRITEABLE(ss_descriptor.type))
|
||||
{
|
||||
BX_ERROR(("return_protected: SS.AR byte not writable data"));
|
||||
exception(BX_GP_EXCEPTION, raw_ss_selector & 0xfffc, 0);
|
||||
}
|
||||
/* descriptor dpl must = RPL of the return CS selector,
|
||||
* else #GP(selector) */
|
||||
if (ss_descriptor.dpl != cs_selector.rpl) {
|
||||
BX_ERROR(("return_protected: SS.dpl != cs.rpl"));
|
||||
exception(BX_GP_EXCEPTION, raw_ss_selector & 0xfffc, 0);
|
||||
}
|
||||
|
||||
/* descriptor dpl must = RPL of the return CS selector,
|
||||
* else #GP(selector) */
|
||||
if (ss_descriptor.dpl != cs_selector.rpl) {
|
||||
BX_ERROR(("return_protected: SS.dpl != cs.rpl"));
|
||||
exception(BX_GP_EXCEPTION, raw_ss_selector & 0xfffc, 0);
|
||||
}
|
||||
|
||||
/* segment must be present else #SS(selector) */
|
||||
if (! IS_PRESENT(ss_descriptor)) {
|
||||
BX_ERROR(("return_protected: ss.present == 0"));
|
||||
exception(BX_SS_EXCEPTION, raw_ss_selector & 0xfffc, 0);
|
||||
/* segment must be present else #SS(selector) */
|
||||
if (! IS_PRESENT(ss_descriptor)) {
|
||||
BX_ERROR(("return_protected: ss.present == 0"));
|
||||
exception(BX_SS_EXCEPTION, raw_ss_selector & 0xfffc, 0);
|
||||
}
|
||||
}
|
||||
|
||||
branch_far64(&cs_selector, &cs_descriptor, return_RIP, cs_selector.rpl);
|
||||
|
||||
/* load SS:SP from stack */
|
||||
/* load SS-cache with return SS descriptor */
|
||||
load_ss(&ss_selector, &ss_descriptor, cs_selector.rpl);
|
||||
|
||||
if ((raw_ss_selector & 0xfffc) != 0) {
|
||||
// load SS:RSP from stack
|
||||
// load the SS-cache with SS descriptor
|
||||
load_ss(&ss_selector, &ss_descriptor, cs_selector.rpl);
|
||||
}
|
||||
#if BX_SUPPORT_X86_64
|
||||
else {
|
||||
// we are in 64-bit mode !
|
||||
load_null_selector(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS], raw_ss_selector);
|
||||
loadSRegLMNominal(BX_SEG_REG_SS, raw_ss_selector, cs_selector.rpl);
|
||||
}
|
||||
|
||||
if (StackAddrSize64())
|
||||
RSP = return_RSP + pop_bytes;
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user