One more change to speedup memory access through HostPtr check
This commit is contained in:
parent
dcb82ec4bf
commit
aea946b4a3
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: access.cc,v 1.117 2008-08-07 22:14:38 sshwarts Exp $
|
||||
// $Id: access.cc,v 1.118 2008-08-14 22:26:14 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -282,7 +282,7 @@ BX_CPU_C::v2h_read_byte(bx_address laddr, bx_bool user)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | user))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & user)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
Bit8u *hostAddr = (Bit8u*) (hostPageAddr | pageOffset);
|
||||
@ -303,7 +303,7 @@ BX_CPU_C::v2h_write_byte(bx_address laddr, bx_bool user)
|
||||
{
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | user))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | user))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
Bit8u *hostAddr = (Bit8u*) (hostPageAddr | pageOffset);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: access32.cc,v 1.10 2008-08-12 20:24:24 sshwarts Exp $
|
||||
// $Id: access32.cc,v 1.11 2008-08-14 22:26:14 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2008 Stanislav Shwartsman
|
||||
@ -45,7 +45,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_WRITE);
|
||||
@ -97,7 +97,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_WRITE);
|
||||
@ -157,7 +157,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_WRITE);
|
||||
@ -217,7 +217,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_WRITE);
|
||||
@ -277,7 +277,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_WRITE);
|
||||
@ -334,7 +334,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_WRITE);
|
||||
@ -388,7 +388,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | USER_PL))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
|
||||
@ -438,7 +438,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | USER_PL))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_READ);
|
||||
@ -496,7 +496,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | USER_PL))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
|
||||
@ -554,7 +554,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | USER_PL))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_READ);
|
||||
@ -611,7 +611,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | USER_PL))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_READ);
|
||||
@ -665,7 +665,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | USER_PL))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_READ);
|
||||
@ -721,7 +721,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_RW);
|
||||
@ -775,7 +775,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_RW);
|
||||
@ -837,7 +837,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_RW);
|
||||
@ -899,7 +899,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_RW);
|
||||
@ -1127,7 +1127,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | user))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | user))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_WRITE);
|
||||
@ -1187,7 +1187,7 @@ accessOK:
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | user))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | user))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_WRITE);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: access64.cc,v 1.15 2008-08-12 20:24:24 sshwarts Exp $
|
||||
// $Id: access64.cc,v 1.16 2008-08-14 22:26:14 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2008 Stanislav Shwartsman
|
||||
@ -43,7 +43,7 @@ BX_CPU_C::write_virtual_byte_64(unsigned s, Bit64u offset, Bit8u data)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_WRITE);
|
||||
@ -86,7 +86,7 @@ BX_CPU_C::write_virtual_word_64(unsigned s, Bit64u offset, Bit16u data)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_WRITE);
|
||||
@ -138,7 +138,7 @@ BX_CPU_C::write_virtual_dword_64(unsigned s, Bit64u offset, Bit32u data)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_WRITE);
|
||||
@ -190,7 +190,7 @@ BX_CPU_C::write_virtual_qword_64(unsigned s, Bit64u offset, Bit64u data)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_WRITE);
|
||||
@ -242,7 +242,7 @@ BX_CPU_C::write_virtual_dqword_64(unsigned s, Bit64u offset, const BxPackedXmmRe
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_WRITE);
|
||||
@ -291,7 +291,7 @@ BX_CPU_C::write_virtual_dqword_aligned_64(unsigned s, Bit64u offset, const BxPac
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_WRITE);
|
||||
@ -336,7 +336,7 @@ BX_CPU_C::read_virtual_byte_64(unsigned s, Bit64u offset)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | USER_PL))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
|
||||
@ -377,7 +377,7 @@ BX_CPU_C::read_virtual_word_64(unsigned s, Bit64u offset)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | USER_PL))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_READ);
|
||||
@ -427,7 +427,7 @@ BX_CPU_C::read_virtual_dword_64(unsigned s, Bit64u offset)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | USER_PL))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
|
||||
@ -477,7 +477,7 @@ BX_CPU_C::read_virtual_qword_64(unsigned s, Bit64u offset)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | USER_PL))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_READ);
|
||||
@ -525,7 +525,7 @@ BX_CPU_C::read_virtual_dqword_64(unsigned s, Bit64u offset, BxPackedXmmRegister
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | USER_PL))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_READ);
|
||||
@ -569,7 +569,7 @@ BX_CPU_C::read_virtual_dqword_aligned_64(unsigned s, Bit64u offset, BxPackedXmmR
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x4 | USER_PL))) { // Read this pl OK.
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_READ);
|
||||
@ -616,7 +616,7 @@ BX_CPU_C::read_RMW_virtual_byte_64(unsigned s, Bit64u offset)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_RW);
|
||||
@ -661,7 +661,7 @@ BX_CPU_C::read_RMW_virtual_word_64(unsigned s, Bit64u offset)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_RW);
|
||||
@ -715,7 +715,7 @@ BX_CPU_C::read_RMW_virtual_dword_64(unsigned s, Bit64u offset)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_RW);
|
||||
@ -769,7 +769,7 @@ BX_CPU_C::read_RMW_virtual_qword_64(unsigned s, Bit64u offset)
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | USER_PL))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_RW);
|
||||
@ -818,7 +818,7 @@ void BX_CPU_C::write_new_stack_qword_64(Bit64u laddr, unsigned curr_pl, Bit64u d
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
// See if the TLB entry privilege level allows us write access
|
||||
// from this CPL.
|
||||
if (! (tlbEntry->accessBits & (0x6 | user))) {
|
||||
if (! (tlbEntry->accessBits & (0x2 | user))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_WRITE);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.cc,v 1.236 2008-08-12 19:25:42 sshwarts Exp $
|
||||
// $Id: cpu.cc,v 1.237 2008-08-14 22:26:14 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -644,7 +644,7 @@ void BX_CPU_C::prefetch(void)
|
||||
bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[TLB_index];
|
||||
Bit8u *fetchPtr = 0;
|
||||
|
||||
if (tlbEntry->lpf == lpf && !(tlbEntry->accessBits & (0x4 | USER_PL))) {
|
||||
if ((tlbEntry->lpf == lpf) && !(tlbEntry->accessBits & USER_PL)) {
|
||||
pAddr = A20ADDR(tlbEntry->ppf | pageOffset);
|
||||
#if BX_SupportGuest2HostTLB
|
||||
fetchPtr = (Bit8u*) (tlbEntry->hostPageAddr);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: paging.cc,v 1.151 2008-08-13 21:51:54 sshwarts Exp $
|
||||
// $Id: paging.cc,v 1.152 2008-08-14 22:26:15 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -302,8 +302,9 @@ static unsigned priv_check[BX_PRIV_CHECK_SIZE];
|
||||
// Each entry in the TLB cache has 3 entries:
|
||||
//
|
||||
// lpf: Linear Page Frame (page aligned linear address of page)
|
||||
// bits 32..12 Linear page frame.
|
||||
// bits 11...0 Invalidate index.
|
||||
// bits 32..12 Linear page frame
|
||||
// bit 11 0: TLB HostPtr access allowed, 1: not allowed
|
||||
// bit 10...0 Invalidate index
|
||||
//
|
||||
// ppf: Physical Page Frame (page aligned phy address of page)
|
||||
//
|
||||
@ -331,26 +332,24 @@ static unsigned priv_check[BX_PRIV_CHECK_SIZE];
|
||||
// value, necessitating a TLB flush when CR0.WP changes.
|
||||
//
|
||||
// The test is:
|
||||
// OK = (accessBits & ((W<<1) | U)) != 0 [W:1=write, 0=read, U:1=CPL3,0=CPL0-2]
|
||||
// OK = (accessBits & ((W<<1) | U)) <> 0 [W:1=Write, 0=Read, U:1=CPL3,0=CPL0-2]
|
||||
//
|
||||
// Or when taking into account direct access according to Host Ptr:
|
||||
// OK = (accessBits & (TLB_HostPtr | (W<<1) | U)) != 0
|
||||
|
||||
// Thus for direct reads, it is:
|
||||
// OK = 0x4 << ( U )
|
||||
// And for direct writes:
|
||||
// OK = 0x6 << ( U )
|
||||
// Thus for reads, it is:
|
||||
// OK = ( U )
|
||||
// And for writes:
|
||||
// OK = 0x2 | ( U )
|
||||
//
|
||||
// Note, that the TLB accessBits should have TLB_HostPtr bit set when
|
||||
// direct access through host pointer is NOT allowed for the page.
|
||||
// A memory operation asking for a direct access through host pointer
|
||||
// will set TLB_HostPtr bit in the accessBits and thus get non zero
|
||||
// result when the direct access is not allowed.
|
||||
// Note, that the TLB should have TLB_HostPtr bit set when direct
|
||||
// access through host pointer is NOT allowed for the page. A memory
|
||||
// operation asking for a direct access through host pointer will
|
||||
// set TLB_HostPtr bit in its lpf field and thus get TLB miss result
|
||||
// when the direct access is not allowed.
|
||||
//
|
||||
|
||||
#define TLB_SysOnly (0x01)
|
||||
#define TLB_ReadOnly (0x02)
|
||||
#define TLB_HostPtr (0x04) /* set this bit when direct access is NOT allowed */
|
||||
#define TLB_SysOnly (0x1)
|
||||
#define TLB_ReadOnly (0x2)
|
||||
|
||||
#define TLB_HostPtr (0x800) /* set this bit when direct access is NOT allowed */
|
||||
|
||||
#define TLB_GlobalPage (0x80000000)
|
||||
|
||||
@ -546,7 +545,7 @@ void BX_CPU_C::TLB_invlpg(bx_address laddr)
|
||||
unsigned TLB_index = BX_TLB_INDEX_OF(laddr, 0);
|
||||
bx_address lpf = LPFOf(laddr);
|
||||
bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[TLB_index];
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
if (LPFOf(tlbEntry->lpf) == lpf) {
|
||||
tlbEntry->lpf = BX_INVALID_TLB_ENTRY;
|
||||
}
|
||||
|
||||
@ -940,7 +939,7 @@ bx_phy_address BX_CPU_C::translate_linear(bx_address laddr, unsigned curr_pl, un
|
||||
bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[TLB_index];
|
||||
|
||||
// already looked up TLB for code access
|
||||
if (tlbEntry->lpf == lpf)
|
||||
if (LPFOf(tlbEntry->lpf) == lpf)
|
||||
{
|
||||
paddress = tlbEntry->ppf | poffset;
|
||||
|
||||
@ -1084,28 +1083,28 @@ bx_phy_address BX_CPU_C::translate_linear(bx_address laddr, unsigned curr_pl, un
|
||||
// Calculate physical memory address and fill in TLB cache entry
|
||||
paddress = ppf | poffset;
|
||||
|
||||
tlbEntry->lpf = lpf;
|
||||
// direct memory access is NOT allowed by default
|
||||
tlbEntry->lpf = lpf | TLB_HostPtr;
|
||||
tlbEntry->ppf = ppf;
|
||||
|
||||
Bit32u accessBits = TLB_HostPtr; // HostPtr is not allowed by default
|
||||
tlbEntry->accessBits = 0;
|
||||
|
||||
if ((combined_access & 4) == 0) { // System
|
||||
accessBits |= TLB_SysOnly;
|
||||
tlbEntry->accessBits |= TLB_SysOnly;
|
||||
if (! isWrite)
|
||||
accessBits |= TLB_ReadOnly;
|
||||
tlbEntry->accessBits |= TLB_ReadOnly;
|
||||
}
|
||||
else {
|
||||
// Current operation is a read or a page is read only
|
||||
// Not efficient handling of system write to user read only page:
|
||||
// hopefully it is very rare case, optimize later
|
||||
if (! isWrite || (combined_access & 2) == 0) {
|
||||
accessBits |= TLB_ReadOnly;
|
||||
tlbEntry->accessBits |= TLB_ReadOnly;
|
||||
}
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_GLOBAL_PAGES
|
||||
if (combined_access & 0x100) // Global bit
|
||||
accessBits |= TLB_GlobalPage;
|
||||
tlbEntry->accessBits |= TLB_GlobalPage;
|
||||
#endif
|
||||
|
||||
#if BX_SupportGuest2HostTLB
|
||||
@ -1120,10 +1119,9 @@ bx_phy_address BX_CPU_C::translate_linear(bx_address laddr, unsigned curr_pl, un
|
||||
#if BX_X86_DEBUGGER
|
||||
if (! hwbreakpoint_check(laddr))
|
||||
#endif
|
||||
accessBits &= ~TLB_HostPtr; // allow direct access with HostPtr
|
||||
tlbEntry->lpf = LPFOf(tlbEntry->lpf); // allow direct access with HostPtr
|
||||
}
|
||||
#endif
|
||||
tlbEntry->accessBits = accessBits;
|
||||
|
||||
return paddress;
|
||||
}
|
||||
@ -1144,7 +1142,7 @@ bx_bool BX_CPU_C::dbg_xlate_linear2phy(bx_address laddr, bx_phy_address *phy)
|
||||
unsigned TLB_index = BX_TLB_INDEX_OF(lpf, 0);
|
||||
bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[TLB_index];
|
||||
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
if (LPFOf(tlbEntry->lpf) == lpf) {
|
||||
paddress = tlbEntry->ppf | PAGE_OFFSET(laddr);
|
||||
*phy = paddress;
|
||||
return 1;
|
||||
@ -1298,7 +1296,7 @@ void BX_CPU_C::access_write_linear(bx_address laddr, unsigned len, unsigned curr
|
||||
bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex];
|
||||
bx_address lpf = LPFOf(laddr);
|
||||
|
||||
if (tlbEntry->lpf != lpf) {
|
||||
if (LPFOf(tlbEntry->lpf) != lpf) {
|
||||
// We haven't seen this page, or it's been bumped before.
|
||||
|
||||
// Request a direct write pointer so we can do either R or W.
|
||||
@ -1306,10 +1304,10 @@ void BX_CPU_C::access_write_linear(bx_address laddr, unsigned len, unsigned curr
|
||||
BX_MEM(0)->getHostMemAddr(BX_CPU_THIS, A20ADDR(lpf), BX_WRITE, DATA_ACCESS);
|
||||
|
||||
if (hostPageAddr) {
|
||||
tlbEntry->lpf = lpf;
|
||||
tlbEntry->lpf = lpf; // Got direct write pointer OK
|
||||
tlbEntry->ppf = (bx_phy_address) lpf;
|
||||
tlbEntry->hostPageAddr = hostPageAddr;
|
||||
// Got direct write pointer OK. Mark for any operation to succeed.
|
||||
// Mark for any operation to succeed.
|
||||
tlbEntry->accessBits = 0;
|
||||
}
|
||||
}
|
||||
@ -1468,18 +1466,18 @@ void BX_CPU_C::access_read_linear(bx_address laddr, unsigned len, unsigned curr_
|
||||
bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex];
|
||||
bx_address lpf = LPFOf(laddr);
|
||||
|
||||
if (tlbEntry->lpf != lpf) {
|
||||
if (LPFOf(tlbEntry->lpf) != lpf) {
|
||||
// We haven't seen this page, or it's been bumped before.
|
||||
|
||||
// Request a direct write pointer so we can do either R or W.
|
||||
bx_hostpageaddr_t hostPageAddr = (bx_hostpageaddr_t)
|
||||
BX_MEM(0)->getHostMemAddr(BX_CPU_THIS, A20ADDR(lpf), BX_READ, DATA_ACCESS);
|
||||
BX_MEM(0)->getHostMemAddr(BX_CPU_THIS, A20ADDR(lpf), BX_READ, DATA_ACCESS);
|
||||
|
||||
if (hostPageAddr) {
|
||||
tlbEntry->lpf = lpf;
|
||||
tlbEntry->lpf = lpf; // Got direct read pointer OK.
|
||||
tlbEntry->ppf = (bx_phy_address) lpf;
|
||||
tlbEntry->hostPageAddr = hostPageAddr;
|
||||
// Got direct read pointer OK. Mark for any following read to succeed.
|
||||
// Mark for any following read to succeed.
|
||||
tlbEntry->accessBits = TLB_ReadOnly;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user