Remove 4G limit optimization that didn't work quite well
This commit is contained in:
parent
b03f940807
commit
23933d731c
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: access.cc,v 1.119 2008-09-06 17:44:02 sshwarts Exp $
|
||||
// $Id: access.cc,v 1.120 2008-09-08 20:47:33 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -39,7 +39,7 @@ BX_CPU_C::write_virtual_checks(bx_segment_reg_t *seg, Bit32u offset, unsigned le
|
||||
#if BX_SUPPORT_X86_64
|
||||
if (BX_CPU_THIS_PTR cpu_mode == BX_MODE_LONG_64) {
|
||||
// Mark cache as being OK type for succeeding reads/writes
|
||||
seg->cache.valid |= SegAccessROK | SegAccessWOK | SegAccessROK4G | SegAccessWOK4G;
|
||||
seg->cache.valid |= SegAccessROK | SegAccessWOK;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@ -80,9 +80,6 @@ BX_CPU_C::write_virtual_checks(bx_segment_reg_t *seg, Bit32u offset, unsigned le
|
||||
// limit check in other functions, and we don't want the value to roll.
|
||||
// Only normal segments (not expand down) are handled this way.
|
||||
seg->cache.valid |= SegAccessROK | SegAccessWOK;
|
||||
|
||||
if (seg->cache.u.segment.limit_scaled == 0xffffffff)
|
||||
seg->cache.valid |= SegAccessROK4G | SegAccessWOK4G;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -114,7 +111,7 @@ BX_CPU_C::read_virtual_checks(bx_segment_reg_t *seg, Bit32u offset, unsigned len
|
||||
#if BX_SUPPORT_X86_64
|
||||
if (BX_CPU_THIS_PTR cpu_mode == BX_MODE_LONG_64) {
|
||||
// Mark cache as being OK type for succeeding reads/writes
|
||||
seg->cache.valid |= SegAccessROK | SegAccessWOK | SegAccessROK4G | SegAccessWOK4G;
|
||||
seg->cache.valid |= SegAccessROK | SegAccessWOK;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@ -144,8 +141,6 @@ BX_CPU_C::read_virtual_checks(bx_segment_reg_t *seg, Bit32u offset, unsigned len
|
||||
// Mark cache as being OK type for succeeding reads. See notes for
|
||||
// write checks; similar code.
|
||||
seg->cache.valid |= SegAccessROK;
|
||||
if (seg->cache.u.segment.limit_scaled == 0xffffffff)
|
||||
seg->cache.valid |= SegAccessROK4G;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -184,7 +179,7 @@ BX_CPU_C::execute_virtual_checks(bx_segment_reg_t *seg, Bit32u offset, unsigned
|
||||
#if BX_SUPPORT_X86_64
|
||||
if (BX_CPU_THIS_PTR cpu_mode == BX_MODE_LONG_64) {
|
||||
// Mark cache as being OK type for succeeding reads/writes
|
||||
seg->cache.valid |= SegAccessROK | SegAccessWOK | SegAccessROK4G | SegAccessWOK4G;
|
||||
seg->cache.valid |= SegAccessROK | SegAccessWOK;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@ -214,8 +209,6 @@ BX_CPU_C::execute_virtual_checks(bx_segment_reg_t *seg, Bit32u offset, unsigned
|
||||
// Mark cache as being OK type for succeeding reads. See notes for
|
||||
// write checks; similar code.
|
||||
seg->cache.valid |= SegAccessROK;
|
||||
if (seg->cache.u.segment.limit_scaled == 0xffffffff)
|
||||
seg->cache.valid |= SegAccessROK4G;
|
||||
}
|
||||
break;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: descriptor.h,v 1.24 2008-05-26 18:02:07 sshwarts Exp $
|
||||
// $Id: descriptor.h,v 1.25 2008-09-08 20:47:33 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2007 Stanislav Shwartsman
|
||||
@ -58,8 +58,6 @@ typedef struct
|
||||
#define SegValidCache (0x01)
|
||||
#define SegAccessROK (0x02)
|
||||
#define SegAccessWOK (0x04)
|
||||
#define SegAccessROK4G (0x08)
|
||||
#define SegAccessWOK4G (0x10)
|
||||
|
||||
unsigned valid; // Holds above values, Or'd together. Used to
|
||||
// hold only 0 or 1.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: io.cc,v 1.65 2008-08-03 19:53:08 sshwarts Exp $
|
||||
// $Id: io.cc,v 1.66 2008-09-08 20:47:33 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -53,8 +53,12 @@ Bit32u BX_CPU_C::FastRepINSW(bxInstruction_c *i, bx_address dstOff, Bit16u port,
|
||||
Bit8u *hostAddrDst;
|
||||
unsigned count;
|
||||
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
bx_segment_reg_t *dstSegPtr = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES];
|
||||
if (!(dstSegPtr->cache.valid & SegAccessWOK4G))
|
||||
if (!(dstSegPtr->cache.valid & SegAccessWOK))
|
||||
return 0;
|
||||
if ((dstOff | 0xfff) > dstSegPtr->cache.u.segment.limit_scaled)
|
||||
return 0;
|
||||
|
||||
bx_address laddrDst = BX_CPU_THIS_PTR get_laddr(BX_SEG_REG_ES, dstOff);
|
||||
@ -137,8 +141,12 @@ Bit32u BX_CPU_C::FastRepOUTSW(bxInstruction_c *i, unsigned srcSeg, bx_address sr
|
||||
Bit8u *hostAddrSrc;
|
||||
unsigned count;
|
||||
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
bx_segment_reg_t *srcSegPtr = &BX_CPU_THIS_PTR sregs[srcSeg];
|
||||
if (!(srcSegPtr->cache.valid & SegAccessROK4G))
|
||||
if (!(srcSegPtr->cache.valid & SegAccessROK))
|
||||
return 0;
|
||||
if ((srcOff | 0xfff) > srcSegPtr->cache.u.segment.limit_scaled)
|
||||
return 0;
|
||||
|
||||
bx_address laddrSrc = BX_CPU_THIS_PTR get_laddr(srcSeg, srcOff);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: proc_ctrl.cc,v 1.258 2008-09-08 15:45:56 sshwarts Exp $
|
||||
// $Id: proc_ctrl.cc,v 1.259 2008-09-08 20:47:33 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -189,20 +189,30 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::CLFLUSH(bxInstruction_c *i)
|
||||
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[i->seg()];
|
||||
|
||||
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
||||
|
||||
// check if we could access the memory segment
|
||||
if (!(seg->cache.valid & SegAccessROK4G)) {
|
||||
if (! execute_virtual_checks(seg, eaddr, 1))
|
||||
exception(int_number(i->seg()), 0, 0);
|
||||
}
|
||||
|
||||
bx_address laddr = BX_CPU_THIS_PTR get_laddr(i->seg(), eaddr);
|
||||
|
||||
#if BX_SUPPORT_X86_64
|
||||
if (! IsCanonical(laddr)) {
|
||||
BX_ERROR(("CLFLUSH: non-canonical access !"));
|
||||
exception(int_number(i->seg()), 0, 0);
|
||||
if (BX_CPU_THIS_PTR cpu_mode == BX_MODE_LONG_64) {
|
||||
if (! IsCanonical(laddr)) {
|
||||
BX_ERROR(("CLFLUSH: non-canonical access !"));
|
||||
exception(int_number(i->seg()), 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// check if we could access the memory segment
|
||||
if (!(seg->cache.valid & SegAccessROK)) {
|
||||
if (! execute_virtual_checks(seg, eaddr, 1))
|
||||
exception(int_number(i->seg()), 0, 0);
|
||||
}
|
||||
else {
|
||||
if (eaddr > seg->cache.u.segment.limit_scaled) {
|
||||
BX_ERROR(("CLFLUSH: segment limit violation"));
|
||||
exception(int_number(i->seg()), 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bx_phy_address paddr;
|
||||
|
||||
@ -1917,8 +1927,9 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::MONITOR(bxInstruction_c *i)
|
||||
exception(BX_GP_EXCEPTION, 0, 0);
|
||||
}
|
||||
|
||||
bx_address offset, laddr;
|
||||
bx_phy_address paddr;
|
||||
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[i->seg()];
|
||||
|
||||
bx_address offset;
|
||||
|
||||
#if BX_SUPPORT_X86_64
|
||||
if (i->as64L()) {
|
||||
@ -1933,14 +1944,33 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::MONITOR(bxInstruction_c *i)
|
||||
offset = AX;
|
||||
}
|
||||
|
||||
// check if we could access the memory segment
|
||||
if (!(seg->cache.valid & SegAccessROK4G)) {
|
||||
if (! read_virtual_checks(&BX_CPU_THIS_PTR sregs[i->seg()], offset, 1))
|
||||
// set MONITOR
|
||||
bx_address laddr = BX_CPU_THIS_PTR get_laddr(i->seg(), offset);
|
||||
|
||||
#if BX_SUPPORT_X86_64
|
||||
if (BX_CPU_THIS_PTR cpu_mode == BX_MODE_LONG_64) {
|
||||
if (! IsCanonical(laddr)) {
|
||||
BX_ERROR(("MONITOR: non-canonical access !"));
|
||||
exception(int_number(i->seg()), 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// check if we could access the memory segment
|
||||
if (!(seg->cache.valid & SegAccessROK)) {
|
||||
if (! read_virtual_checks(seg, offset, 1))
|
||||
exception(int_number(i->seg()), 0, 0);
|
||||
}
|
||||
else {
|
||||
if (offset > seg->cache.u.segment.limit_scaled) {
|
||||
BX_ERROR(("MONITOR: segment limit violation"));
|
||||
exception(int_number(i->seg()), 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set MONITOR
|
||||
laddr = BX_CPU_THIS_PTR get_laddr(i->seg(), offset);
|
||||
bx_phy_address paddr;
|
||||
|
||||
if (BX_CPU_THIS_PTR cr0.get_PG()) {
|
||||
paddr = dtranslate_linear(laddr, CPL, BX_READ);
|
||||
@ -2048,7 +2078,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSENTER(bxInstruction_c *i)
|
||||
parse_selector(BX_CPU_THIS_PTR msr.sysenter_cs_msr & BX_SELECTOR_RPL_MASK,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.dpl = 0;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.segment = 1; /* data/code segment */
|
||||
@ -2076,7 +2106,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSENTER(bxInstruction_c *i)
|
||||
parse_selector((BX_CPU_THIS_PTR msr.sysenter_cs_msr + 8) & BX_SELECTOR_RPL_MASK,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.dpl = 0;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.segment = 1; /* data/code segment */
|
||||
@ -2143,7 +2173,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSEXIT(bxInstruction_c *i)
|
||||
parse_selector(((BX_CPU_THIS_PTR msr.sysenter_cs_msr + 32) & BX_SELECTOR_RPL_MASK) | 3,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.dpl = 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.segment = 1; /* data/code segment */
|
||||
@ -2165,7 +2195,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSEXIT(bxInstruction_c *i)
|
||||
parse_selector(((BX_CPU_THIS_PTR msr.sysenter_cs_msr + 16) & BX_SELECTOR_RPL_MASK) | 3,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.dpl = 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.segment = 1; /* data/code segment */
|
||||
@ -2197,7 +2227,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSEXIT(bxInstruction_c *i)
|
||||
parse_selector(((BX_CPU_THIS_PTR msr.sysenter_cs_msr + (i->os64L() ? 40:24)) & BX_SELECTOR_RPL_MASK) | 3,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.dpl = 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.segment = 1; /* data/code segment */
|
||||
@ -2249,7 +2279,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSCALL(bxInstruction_c *i)
|
||||
parse_selector((MSR_STAR >> 32) & BX_SELECTOR_RPL_MASK,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.dpl = 0;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.segment = 1; /* data/code segment */
|
||||
@ -2273,7 +2303,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSCALL(bxInstruction_c *i)
|
||||
parse_selector(((MSR_STAR >> 32) + 8) & BX_SELECTOR_RPL_MASK,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.dpl = 0;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.segment = 1; /* data/code segment */
|
||||
@ -2300,7 +2330,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSCALL(bxInstruction_c *i)
|
||||
parse_selector((MSR_STAR >> 32) & BX_SELECTOR_RPL_MASK,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.dpl = 0;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.segment = 1; /* data/code segment */
|
||||
@ -2323,7 +2353,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSCALL(bxInstruction_c *i)
|
||||
parse_selector(((MSR_STAR >> 32) + 8) & BX_SELECTOR_RPL_MASK,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.dpl = 0;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.segment = 1; /* data/code segment */
|
||||
@ -2377,7 +2407,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSRET(bxInstruction_c *i)
|
||||
parse_selector((((MSR_STAR >> 48) + 16) & BX_SELECTOR_RPL_MASK) | 3,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.dpl = 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.segment = 1; /* data/code segment */
|
||||
@ -2397,7 +2427,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSRET(bxInstruction_c *i)
|
||||
parse_selector((MSR_STAR >> 48) | 3,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.dpl = 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.segment = 1; /* data/code segment */
|
||||
@ -2424,7 +2454,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSRET(bxInstruction_c *i)
|
||||
parse_selector((Bit16u)((MSR_STAR >> 48) + 8),
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.dpl = 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.segment = 1; /* data/code segment */
|
||||
@ -2437,7 +2467,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSRET(bxInstruction_c *i)
|
||||
parse_selector((MSR_STAR >> 48) | 3,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.dpl = 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.segment = 1; /* data/code segment */
|
||||
@ -2460,7 +2490,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSRET(bxInstruction_c *i)
|
||||
parse_selector((Bit16u)((MSR_STAR >> 48) + 8),
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.dpl = 3;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.segment = 1; /* data/code segment */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: smm.cc,v 1.44 2008-09-08 15:45:57 sshwarts Exp $
|
||||
// $Id: smm.cc,v 1.45 2008-09-08 20:47:33 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2006 Stanislav Shwartsman
|
||||
@ -148,7 +148,7 @@ void BX_CPU_C::enter_system_management_mode(void)
|
||||
parse_selector(BX_CPU_THIS_PTR smbase >> 4,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.dpl = 0;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.segment = 1; /* data/code segment */
|
||||
@ -175,7 +175,7 @@ void BX_CPU_C::enter_system_management_mode(void)
|
||||
parse_selector(0x0000,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector);
|
||||
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.valid = SegValidCache | SegAccessROK4G | SegAccessWOK4G;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.valid = SegValidCache | SegAccessROK | SegAccessWOK;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.p = 1;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.dpl = 0;
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.segment = 1; /* data/code segment */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: string.cc,v 1.63 2008-08-03 19:53:09 sshwarts Exp $
|
||||
// $Id: string.cc,v 1.64 2008-09-08 20:47:33 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -49,12 +49,18 @@ Bit32u BX_CPU_C::FastRepMOVSB(bxInstruction_c *i, unsigned srcSeg, bx_address sr
|
||||
bx_address laddrDst, laddrSrc;
|
||||
Bit8u *hostAddrSrc, *hostAddrDst;
|
||||
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
bx_segment_reg_t *srcSegPtr = &BX_CPU_THIS_PTR sregs[srcSeg];
|
||||
if (!(srcSegPtr->cache.valid & SegAccessROK4G))
|
||||
if (!(srcSegPtr->cache.valid & SegAccessROK))
|
||||
return 0;
|
||||
if ((srcOff | 0xfff) > srcSegPtr->cache.u.segment.limit_scaled)
|
||||
return 0;
|
||||
|
||||
bx_segment_reg_t *dstSegPtr = &BX_CPU_THIS_PTR sregs[dstSeg];
|
||||
if (!(dstSegPtr->cache.valid & SegAccessWOK4G))
|
||||
if (!(dstSegPtr->cache.valid & SegAccessWOK))
|
||||
return 0;
|
||||
if ((dstOff | 0xfff) > dstSegPtr->cache.u.segment.limit_scaled)
|
||||
return 0;
|
||||
|
||||
laddrSrc = BX_CPU_THIS_PTR get_laddr(srcSeg, srcOff);
|
||||
@ -144,12 +150,18 @@ Bit32u BX_CPU_C::FastRepMOVSW(bxInstruction_c *i, unsigned srcSeg, bx_address sr
|
||||
bx_address laddrDst, laddrSrc;
|
||||
Bit8u *hostAddrSrc, *hostAddrDst;
|
||||
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
bx_segment_reg_t *srcSegPtr = &BX_CPU_THIS_PTR sregs[srcSeg];
|
||||
if (!(srcSegPtr->cache.valid & SegAccessROK4G))
|
||||
if (!(srcSegPtr->cache.valid & SegAccessROK))
|
||||
return 0;
|
||||
if ((srcOff | 0xfff) > srcSegPtr->cache.u.segment.limit_scaled)
|
||||
return 0;
|
||||
|
||||
bx_segment_reg_t *dstSegPtr = &BX_CPU_THIS_PTR sregs[dstSeg];
|
||||
if (!(dstSegPtr->cache.valid & SegAccessWOK4G))
|
||||
if (!(dstSegPtr->cache.valid & SegAccessWOK))
|
||||
return 0;
|
||||
if ((dstOff | 0xfff) > dstSegPtr->cache.u.segment.limit_scaled)
|
||||
return 0;
|
||||
|
||||
laddrSrc = BX_CPU_THIS_PTR get_laddr(srcSeg, srcOff);
|
||||
@ -242,12 +254,18 @@ Bit32u BX_CPU_C::FastRepMOVSD(bxInstruction_c *i, unsigned srcSeg, bx_address sr
|
||||
bx_address laddrDst, laddrSrc;
|
||||
Bit8u *hostAddrSrc, *hostAddrDst;
|
||||
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
bx_segment_reg_t *srcSegPtr = &BX_CPU_THIS_PTR sregs[srcSeg];
|
||||
if (!(srcSegPtr->cache.valid & SegAccessROK4G))
|
||||
if (!(srcSegPtr->cache.valid & SegAccessROK))
|
||||
return 0;
|
||||
if ((srcOff | 0xfff) > srcSegPtr->cache.u.segment.limit_scaled)
|
||||
return 0;
|
||||
|
||||
bx_segment_reg_t *dstSegPtr = &BX_CPU_THIS_PTR sregs[dstSeg];
|
||||
if (!(dstSegPtr->cache.valid & SegAccessWOK4G))
|
||||
if (!(dstSegPtr->cache.valid & SegAccessWOK))
|
||||
return 0;
|
||||
if ((dstOff | 0xfff) > dstSegPtr->cache.u.segment.limit_scaled)
|
||||
return 0;
|
||||
|
||||
laddrSrc = BX_CPU_THIS_PTR get_laddr(srcSeg, srcOff);
|
||||
@ -340,8 +358,12 @@ Bit32u BX_CPU_C::FastRepSTOSB(bxInstruction_c *i, unsigned dstSeg, bx_address ds
|
||||
bx_address laddrDst;
|
||||
Bit8u *hostAddrDst;
|
||||
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
bx_segment_reg_t *dstSegPtr = &BX_CPU_THIS_PTR sregs[dstSeg];
|
||||
if ((dstSegPtr->cache.valid & SegAccessWOK4G) != SegAccessWOK4G)
|
||||
if (!(dstSegPtr->cache.valid & SegAccessWOK))
|
||||
return 0;
|
||||
if ((dstOff | 0xfff) > dstSegPtr->cache.u.segment.limit_scaled)
|
||||
return 0;
|
||||
|
||||
laddrDst = BX_CPU_THIS_PTR get_laddr(dstSeg, dstOff);
|
||||
@ -405,8 +427,12 @@ Bit32u BX_CPU_C::FastRepSTOSW(bxInstruction_c *i, unsigned dstSeg, bx_address ds
|
||||
bx_address laddrDst;
|
||||
Bit8u *hostAddrDst;
|
||||
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
bx_segment_reg_t *dstSegPtr = &BX_CPU_THIS_PTR sregs[dstSeg];
|
||||
if ((dstSegPtr->cache.valid & SegAccessWOK4G) != SegAccessWOK4G)
|
||||
if (!(dstSegPtr->cache.valid & SegAccessWOK))
|
||||
return 0;
|
||||
if ((dstOff | 0xfff) > dstSegPtr->cache.u.segment.limit_scaled)
|
||||
return 0;
|
||||
|
||||
laddrDst = BX_CPU_THIS_PTR get_laddr(dstSeg, dstOff);
|
||||
@ -472,8 +498,12 @@ Bit32u BX_CPU_C::FastRepSTOSD(bxInstruction_c *i, unsigned dstSeg, bx_address ds
|
||||
bx_address laddrDst;
|
||||
Bit8u *hostAddrDst;
|
||||
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
bx_segment_reg_t *dstSegPtr = &BX_CPU_THIS_PTR sregs[dstSeg];
|
||||
if (!(dstSegPtr->cache.valid & SegAccessWOK4G))
|
||||
if (!(dstSegPtr->cache.valid & SegAccessWOK))
|
||||
return 0;
|
||||
if ((dstOff | 0xfff) > dstSegPtr->cache.u.segment.limit_scaled)
|
||||
return 0;
|
||||
|
||||
laddrDst = BX_CPU_THIS_PTR get_laddr(dstSeg, dstOff);
|
||||
|
Loading…
Reference in New Issue
Block a user