Added const to fetchPtr in cpu functions

This commit is contained in:
Stanislav Shwartsman 2008-03-03 15:16:46 +00:00
parent 382901c273
commit 946b7a369d
6 changed files with 26 additions and 26 deletions

View File

@ -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. // Copyright (C) 2001 MandrakeSoft S.A.
@ -616,7 +616,7 @@ void BX_CPU_C::prefetch(void)
#endif #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; unsigned j;
Bit8u fetchBuffer[16]; // Really only need 15 Bit8u fetchBuffer[16]; // Really only need 15

View File

@ -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. // Copyright (C) 2001 MandrakeSoft S.A.
@ -2752,17 +2752,6 @@ public: // for now...
BX_SMF void MONITOR(bxInstruction_c *); BX_SMF void MONITOR(bxInstruction_c *);
BX_SMF void MWAIT(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 UndefinedOpcode(bxInstruction_c *);
BX_SMF void BxError(bxInstruction_c *); BX_SMF void BxError(bxInstruction_c *);
@ -2817,7 +2806,18 @@ public: // for now...
// now for some ancillary functions... // now for some ancillary functions...
BX_SMF void cpu_loop(Bit32u max_instr_count); BX_SMF void cpu_loop(Bit32u max_instr_count);
BX_SMF unsigned handleAsyncEvent(void); 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 void prefetch(void);
BX_SMF BX_CPP_INLINE void invalidate_prefetch_q(void) BX_SMF BX_CPP_INLINE void invalidate_prefetch_q(void)
{ {

View File

@ -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. // Copyright (C) 2001 MandrakeSoft S.A.
@ -2439,7 +2439,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo32M[512*2] = {
}; };
unsigned 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 // remain must be at least 1
unsigned remain = (remainingInPage < 15) ? remainingInPage : 15; unsigned remain = (remainingInPage < 15) ? remainingInPage : 15;

View File

@ -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 // Copyright (c) 2005 Stanislav Shwartsman
@ -36,14 +36,14 @@ typedef struct BxOpcodeInfo_t {
// according to instruction prefixes) // according to instruction prefixes)
// //
BX_CPP_INLINE Bit16u FetchWORD(Bit8u *iptr) BX_CPP_INLINE Bit16u FetchWORD(const Bit8u *iptr)
{ {
Bit16u data; Bit16u data;
ReadHostWordFromLittleEndian(iptr, data); ReadHostWordFromLittleEndian(iptr, data);
return data; return data;
} }
BX_CPP_INLINE Bit32u FetchDWORD(Bit8u *iptr) BX_CPP_INLINE Bit32u FetchDWORD(const Bit8u *iptr)
{ {
Bit32u data; Bit32u data;
ReadHostDWordFromLittleEndian(iptr, data); ReadHostDWordFromLittleEndian(iptr, data);
@ -51,7 +51,7 @@ BX_CPP_INLINE Bit32u FetchDWORD(Bit8u *iptr)
} }
#if BX_SUPPORT_X86_64 #if BX_SUPPORT_X86_64
BX_CPP_INLINE Bit64u FetchQWORD(Bit8u *iptr) BX_CPP_INLINE Bit64u FetchQWORD(const Bit8u *iptr)
{ {
Bit64u data; Bit64u data;
ReadHostQWordFromLittleEndian(iptr, data); ReadHostQWordFromLittleEndian(iptr, data);

View File

@ -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. // Copyright (C) 2001 MandrakeSoft S.A.
@ -3354,7 +3354,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo64M[512*3] = {
}; };
unsigned 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 // remain must be at least 1
unsigned remain = (remainingInPage < 15) ? remainingInPage : 15; unsigned remain = (remainingInPage < 15) ? remainingInPage : 15;

View File

@ -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 // Copyright (c) 2007 Stanislav Shwartsman
@ -111,7 +111,7 @@ bxInstruction_c* BX_CPU_C::fetchInstructionTrace(Bit32u eipBiased, unsigned *len
InstrICache_Increment(iCacheMisses); InstrICache_Increment(iCacheMisses);
unsigned remainingInPage = BX_CPU_THIS_PTR eipPageWindowSize - eipBiased; 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; unsigned ret;
bxInstruction_c *i = trace->i; 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 // is in the iCache. Or we're not compiling iCache support in, in which
// case we always have an iCache miss. :^) // case we always have an iCache miss. :^)
unsigned remainingInPage = BX_CPU_THIS_PTR eipPageWindowSize - eipBiased; 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 #if BX_SUPPORT_ICACHE
// The entry will be marked valid if fetchdecode will succeed // The entry will be marked valid if fetchdecode will succeed