From 946b7a369d44eb7ef10c4807c06e68346a3c2bfa Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Mon, 3 Mar 2008 15:16:46 +0000 Subject: [PATCH] Added const to fetchPtr in cpu functions --- bochs/cpu/cpu.cc | 4 ++-- bochs/cpu/cpu.h | 26 +++++++++++++------------- bochs/cpu/fetchdecode.cc | 4 ++-- bochs/cpu/fetchdecode.h | 8 ++++---- bochs/cpu/fetchdecode64.cc | 4 ++-- bochs/cpu/icache.cc | 6 +++--- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/bochs/cpu/cpu.cc b/bochs/cpu/cpu.cc index b23be9f47..a96643d2b 100644 --- a/bochs/cpu/cpu.cc +++ b/bochs/cpu/cpu.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: cpu.cc,v 1.209 2008-03-03 14:35:36 sshwarts Exp $ +// $Id: cpu.cc,v 1.210 2008-03-03 15:16:46 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -616,7 +616,7 @@ void BX_CPU_C::prefetch(void) #endif } -void BX_CPU_C::boundaryFetch(Bit8u *fetchPtr, unsigned remainingInPage, bxInstruction_c *i) +void BX_CPU_C::boundaryFetch(const Bit8u *fetchPtr, unsigned remainingInPage, bxInstruction_c *i) { unsigned j; Bit8u fetchBuffer[16]; // Really only need 15 diff --git a/bochs/cpu/cpu.h b/bochs/cpu/cpu.h index 8d70fa0ba..2411e8c02 100644 --- a/bochs/cpu/cpu.h +++ b/bochs/cpu/cpu.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: cpu.h,v 1.430 2008-03-03 14:35:36 sshwarts Exp $ +// $Id: cpu.h,v 1.431 2008-03-03 15:16:46 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -2752,17 +2752,6 @@ public: // for now... BX_SMF void MONITOR(bxInstruction_c *); BX_SMF void MWAIT(bxInstruction_c *); - BX_SMF unsigned fetchDecode32(Bit8u *fetchPtr, bxInstruction_c *i, unsigned remainingInPage); -#if BX_SUPPORT_X86_64 - BX_SMF unsigned fetchDecode64(Bit8u *fetchPtr, bxInstruction_c *i, unsigned remainingInPage); -#endif -#if BX_SUPPORT_TRACE_CACHE - BX_SMF bxInstruction_c* fetchInstructionTrace(Bit32u eipBiased, unsigned *len); - BX_SMF bx_bool mergeTraces(bxICacheEntry_c *trace, bxInstruction_c *, bx_phy_address pAddr); - BX_SMF void instrumentTraces(void); -#else - BX_SMF bxInstruction_c* fetchInstruction(bxInstruction_c *iStorage, Bit32u eipBiased); -#endif BX_SMF void UndefinedOpcode(bxInstruction_c *); BX_SMF void BxError(bxInstruction_c *); @@ -2817,7 +2806,18 @@ public: // for now... // now for some ancillary functions... BX_SMF void cpu_loop(Bit32u max_instr_count); BX_SMF unsigned handleAsyncEvent(void); - BX_SMF void boundaryFetch(Bit8u *fetchPtr, unsigned remainingInPage, bxInstruction_c *); + BX_SMF unsigned fetchDecode32(const Bit8u *fetchPtr, bxInstruction_c *i, unsigned remainingInPage); +#if BX_SUPPORT_X86_64 + BX_SMF unsigned fetchDecode64(const Bit8u *fetchPtr, bxInstruction_c *i, unsigned remainingInPage); +#endif + BX_SMF void boundaryFetch(const Bit8u *fetchPtr, unsigned remainingInPage, bxInstruction_c *); +#if BX_SUPPORT_TRACE_CACHE + BX_SMF bxInstruction_c* fetchInstructionTrace(Bit32u eipBiased, unsigned *len); + BX_SMF bx_bool mergeTraces(bxICacheEntry_c *trace, bxInstruction_c *, bx_phy_address pAddr); + BX_SMF void instrumentTraces(void); +#else + BX_SMF bxInstruction_c* fetchInstruction(bxInstruction_c *iStorage, Bit32u eipBiased); +#endif BX_SMF void prefetch(void); BX_SMF BX_CPP_INLINE void invalidate_prefetch_q(void) { diff --git a/bochs/cpu/fetchdecode.cc b/bochs/cpu/fetchdecode.cc index 8a72d0d8c..cc6ff4898 100644 --- a/bochs/cpu/fetchdecode.cc +++ b/bochs/cpu/fetchdecode.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: fetchdecode.cc,v 1.169 2008-02-29 05:39:38 sshwarts Exp $ +// $Id: fetchdecode.cc,v 1.170 2008-03-03 15:16:46 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -2439,7 +2439,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo32M[512*2] = { }; unsigned -BX_CPU_C::fetchDecode32(Bit8u *iptr, bxInstruction_c *i, unsigned remainingInPage) +BX_CPU_C::fetchDecode32(const Bit8u *iptr, bxInstruction_c *i, unsigned remainingInPage) { // remain must be at least 1 unsigned remain = (remainingInPage < 15) ? remainingInPage : 15; diff --git a/bochs/cpu/fetchdecode.h b/bochs/cpu/fetchdecode.h index 16256670e..26faad600 100755 --- a/bochs/cpu/fetchdecode.h +++ b/bochs/cpu/fetchdecode.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: fetchdecode.h,v 1.54 2008-02-29 03:02:03 sshwarts Exp $ +// $Id: fetchdecode.h,v 1.55 2008-03-03 15:16:46 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (c) 2005 Stanislav Shwartsman @@ -36,14 +36,14 @@ typedef struct BxOpcodeInfo_t { // according to instruction prefixes) // -BX_CPP_INLINE Bit16u FetchWORD(Bit8u *iptr) +BX_CPP_INLINE Bit16u FetchWORD(const Bit8u *iptr) { Bit16u data; ReadHostWordFromLittleEndian(iptr, data); return data; } -BX_CPP_INLINE Bit32u FetchDWORD(Bit8u *iptr) +BX_CPP_INLINE Bit32u FetchDWORD(const Bit8u *iptr) { Bit32u data; ReadHostDWordFromLittleEndian(iptr, data); @@ -51,7 +51,7 @@ BX_CPP_INLINE Bit32u FetchDWORD(Bit8u *iptr) } #if BX_SUPPORT_X86_64 -BX_CPP_INLINE Bit64u FetchQWORD(Bit8u *iptr) +BX_CPP_INLINE Bit64u FetchQWORD(const Bit8u *iptr) { Bit64u data; ReadHostQWordFromLittleEndian(iptr, data); diff --git a/bochs/cpu/fetchdecode64.cc b/bochs/cpu/fetchdecode64.cc index 93c7b0d2e..20d2938ae 100644 --- a/bochs/cpu/fetchdecode64.cc +++ b/bochs/cpu/fetchdecode64.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: fetchdecode64.cc,v 1.176 2008-02-29 05:39:39 sshwarts Exp $ +// $Id: fetchdecode64.cc,v 1.177 2008-03-03 15:16:46 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -3354,7 +3354,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo64M[512*3] = { }; unsigned -BX_CPU_C::fetchDecode64(Bit8u *iptr, bxInstruction_c *i, unsigned remainingInPage) +BX_CPU_C::fetchDecode64(const Bit8u *iptr, bxInstruction_c *i, unsigned remainingInPage) { // remain must be at least 1 unsigned remain = (remainingInPage < 15) ? remainingInPage : 15; diff --git a/bochs/cpu/icache.cc b/bochs/cpu/icache.cc index 494248b15..7b36fdbc4 100755 --- a/bochs/cpu/icache.cc +++ b/bochs/cpu/icache.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: icache.cc,v 1.6 2008-03-03 14:35:36 sshwarts Exp $ +// $Id: icache.cc,v 1.7 2008-03-03 15:16:46 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (c) 2007 Stanislav Shwartsman @@ -111,7 +111,7 @@ bxInstruction_c* BX_CPU_C::fetchInstructionTrace(Bit32u eipBiased, unsigned *len InstrICache_Increment(iCacheMisses); unsigned remainingInPage = BX_CPU_THIS_PTR eipPageWindowSize - eipBiased; - Bit8u *fetchPtr = BX_CPU_THIS_PTR eipFetchPtr + eipBiased; + const Bit8u *fetchPtr = BX_CPU_THIS_PTR eipFetchPtr + eipBiased; unsigned ret; bxInstruction_c *i = trace->i; @@ -245,7 +245,7 @@ bxInstruction_c* BX_CPU_C::fetchInstruction(bxInstruction_c *iStorage, Bit32u ei // is in the iCache. Or we're not compiling iCache support in, in which // case we always have an iCache miss. :^) unsigned remainingInPage = BX_CPU_THIS_PTR eipPageWindowSize - eipBiased; - Bit8u *fetchPtr = BX_CPU_THIS_PTR eipFetchPtr + eipBiased; + const Bit8u *fetchPtr = BX_CPU_THIS_PTR eipFetchPtr + eipBiased; #if BX_SUPPORT_ICACHE // The entry will be marked valid if fetchdecode will succeed