* Fixed behavior of BX_INSTR_MEM_DATA callback for RMW memory accesses

See instrumentation.txt for details
This commit is contained in:
Stanislav Shwartsman 2003-02-28 20:51:08 +00:00
parent 40fb37670a
commit 8665979c87
4 changed files with 19 additions and 22 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: access.cc,v 1.37 2003-02-28 02:37:17 ptrumpet Exp $
// $Id: access.cc,v 1.38 2003-02-28 20:50:54 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -654,7 +654,7 @@ BX_CPU_C::read_RMW_virtual_byte(unsigned s, bx_address offset, Bit8u *data)
unsigned pl;
accessOK:
laddr = seg->cache.u.segment.base + offset;
BX_INSTR_MEM_DATA(BX_CPU_ID, laddr, 1, BX_READ);
BX_INSTR_MEM_DATA(BX_CPU_ID, laddr, 1, BX_RW);
pl = (CPL==3);
#if BX_SupportGuest2HostTLB
@ -723,7 +723,7 @@ BX_CPU_C::read_RMW_virtual_word(unsigned s, bx_address offset, Bit16u *data)
unsigned pl;
accessOK:
laddr = seg->cache.u.segment.base + offset;
BX_INSTR_MEM_DATA(BX_CPU_ID, laddr, 2, BX_READ);
BX_INSTR_MEM_DATA(BX_CPU_ID, laddr, 2, BX_RW);
pl = (CPL==3);
#if BX_SupportGuest2HostTLB
@ -791,7 +791,7 @@ BX_CPU_C::read_RMW_virtual_dword(unsigned s, bx_address offset, Bit32u *data)
unsigned pl;
accessOK:
laddr = seg->cache.u.segment.base + offset;
BX_INSTR_MEM_DATA(BX_CPU_ID, laddr, 4, BX_READ);
BX_INSTR_MEM_DATA(BX_CPU_ID, laddr, 4, BX_RW);
pl = (CPL==3);
#if BX_SupportGuest2HostTLB
@ -850,8 +850,6 @@ accessOK:
void
BX_CPU_C::write_RMW_virtual_byte(Bit8u val8)
{
BX_INSTR_MEM_DATA(BX_CPU_ID, BX_CPU_THIS_PTR address_xlation.paddress1, 1, BX_WRITE);
if (BX_CPU_THIS_PTR address_xlation.pages > 2) {
// Pages > 2 means it stores a host address for direct access.
Bit8u * hostAddr = (Bit8u *) BX_CPU_THIS_PTR address_xlation.pages;
@ -867,8 +865,6 @@ BX_CPU_C::write_RMW_virtual_byte(Bit8u val8)
void
BX_CPU_C::write_RMW_virtual_word(Bit16u val16)
{
BX_INSTR_MEM_DATA(BX_CPU_ID, BX_CPU_THIS_PTR address_xlation.paddress1, 2, BX_WRITE);
if (BX_CPU_THIS_PTR address_xlation.pages > 2) {
// Pages > 2 means it stores a host address for direct access.
Bit16u *hostAddr = (Bit16u *) BX_CPU_THIS_PTR address_xlation.pages;
@ -896,8 +892,6 @@ BX_CPU_C::write_RMW_virtual_word(Bit16u val16)
void
BX_CPU_C::write_RMW_virtual_dword(Bit32u val32)
{
BX_INSTR_MEM_DATA(BX_CPU_ID, BX_CPU_THIS_PTR address_xlation.paddress1, 4, BX_WRITE);
if (BX_CPU_THIS_PTR address_xlation.pages > 2) {
// Pages > 2 means it stores a host address for direct access.
Bit32u *hostAddr = (Bit32u *) BX_CPU_THIS_PTR address_xlation.pages;
@ -1055,8 +1049,6 @@ accessOK:
void
BX_CPU_C::write_RMW_virtual_qword(Bit64u val64)
{
BX_INSTR_MEM_DATA(BX_CPU_ID, BX_CPU_THIS_PTR address_xlation.paddress1, 8, BX_WRITE);
if (BX_CPU_THIS_PTR address_xlation.pages > 2) {
// Pages > 2 means it stores a host address for direct access.
Bit64u *hostAddr = (Bit64u *) BX_CPU_THIS_PTR address_xlation.pages;
@ -1101,7 +1093,7 @@ BX_CPU_C::read_RMW_virtual_qword(unsigned s, bx_address offset, Bit64u *data)
unsigned pl;
accessOK:
laddr = seg->cache.u.segment.base + offset;
BX_INSTR_MEM_DATA(BX_CPU_ID, laddr, 8, BX_READ);
BX_INSTR_MEM_DATA(BX_CPU_ID, laddr, 8, BX_RW);
pl = (CPL==3);
#if BX_SupportGuest2HostTLB

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: instrument.cc,v 1.9 2003-02-13 15:04:09 sshwarts Exp $
// $Id: instrument.cc,v 1.10 2003-02-28 20:51:07 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -50,7 +50,7 @@ static struct instruction_t {
struct {
bx_address laddr; // linear address
bx_address paddr; // physical address
unsigned op; // BX_READ or BX_WRITE
unsigned op; // BX_READ, BX_WRITE or BX_RW
unsigned size; // 1 .. 8
} data_access[MAX_DATA_ACCESSES];
bx_bool is_branch;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: instrument.h,v 1.7 2003-02-13 15:04:10 sshwarts Exp $
// $Id: instrument.h,v 1.8 2003-02-28 20:51:08 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -75,7 +75,7 @@ public:
struct {
bx_address laddr; // linear address
bx_address paddr; // physical address
unsigned op; // BX_READ or BX_WRITE
unsigned op; // BX_READ, BX_WRITE or BX_RW
unsigned size; // 1 .. 8
} data_access[MAX_DATA_ACCESSES];

View File

@ -157,6 +157,13 @@ The callback is called each time, when Bochs simulator starts a new repeat
iteration.
void bx_instr_mem_code(unsigned cpu, bx_address linear, unsigned len);
void bx_instr_mem_data(unsigned cpu, bx_address linear, unsigned len, unsigned rw);
The callback is called each time, when Bochs simulator executes code or data
memory access. Possible access types are: BX_READ, BX_WRITE and BX_RW.
void bx_instr_lin_read(unsigned cpu, bx_address lin, bx_address phy, unsigned len);
void bx_instr_lin_write(unsigned cpu, bx_address lin, bx_address phy, unsigned len);
@ -185,11 +192,9 @@ These callback functions are a feedback from various system devices.
-----------------------------------------------------------------------------
Known problems:
1. BX_INSTR_MEM_DATA callback doesn't work for RMW requests
(substitutes physical address instead of linear).
2. BX_INSTR_MEM_CODE never called from Bochs's code.
3. BX_INSTR_LIN_READ doesn't work when Guest-To-Host-TLB feature is enabled.
4. BX_INSTR_LIN_WRITE doesn't work when Guest-To-Host-TLB feature is enabled.
1. BX_INSTR_MEM_CODE never called from Bochs's code.
2. BX_INSTR_LIN_READ doesn't work when Guest-To-Host-TLB feature is enabled.
3. BX_INSTR_LIN_WRITE doesn't work when Guest-To-Host-TLB feature is enabled.
Feature requests: