Merge zeep.pool:/z/saidi/work/m5.newmem

into  zeep.pool:/z/saidi/work/m5.suncc

--HG--
extra : convert_revision : 20f61a524a3b53fc0afcf53a24b5a1fe1d96f579
This commit is contained in:
Ali Saidi 2007-01-26 18:49:40 -05:00
commit fd8a4ff5a8
52 changed files with 236 additions and 134 deletions

View file

@ -66,6 +66,7 @@
# Python library imports # Python library imports
import sys import sys
import os import os
import subprocess
from os.path import join as joinpath from os.path import join as joinpath
# Check for recent-enough Python and SCons versions. If your system's # Check for recent-enough Python and SCons versions. If your system's
@ -206,11 +207,36 @@ if False:
# M5_PLY is used by isa_parser.py to find the PLY package. # M5_PLY is used by isa_parser.py to find the PLY package.
env.Append(ENV = { 'M5_PLY' : Dir('ext/ply') }) env.Append(ENV = { 'M5_PLY' : Dir('ext/ply') })
env['GCC'] = False
env['SUNCC'] = False
env['GCC'] = subprocess.Popen(env['CXX'] + ' --version', shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
close_fds=True).communicate()[0].find('GCC') >= 0
env['SUNCC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
close_fds=True).communicate()[0].find('Sun C++') >= 0
if (env['GCC'] and env['SUNCC']):
print 'Error: How can we have both g++ and Sun C++ at the same time?'
Exit(1)
# Set up default C++ compiler flags # Set up default C++ compiler flags
env.Append(CCFLAGS='-pipe') if env['GCC']:
env.Append(CCFLAGS='-fno-strict-aliasing') env.Append(CCFLAGS='-pipe')
env.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef')) env.Append(CCFLAGS='-fno-strict-aliasing')
env.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
elif env['SUNCC']:
env.Append(CCFLAGS='-Qoption ccfe')
env.Append(CCFLAGS='-features=gcc')
env.Append(CCFLAGS='-features=extensions')
env.Append(CCFLAGS='-library=stlport4')
env.Append(CCFLAGS='-xar')
# env.Append(CCFLAGS='-instances=semiexplicit')
else:
print 'Error: Don\'t know what compiler options to use for your compiler.'
print ' Please fix SConstruct and try again.'
Exit(1)
if sys.platform == 'cygwin': if sys.platform == 'cygwin':
# cygwin has some header file issues... # cygwin has some header file issues...
env.Append(CCFLAGS=Split("-Wno-uninitialized")) env.Append(CCFLAGS=Split("-Wno-uninitialized"))
@ -293,7 +319,7 @@ if not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'):
# Check for zlib. If the check passes, libz will be automatically # Check for zlib. If the check passes, libz will be automatically
# added to the LIBS environment variable. # added to the LIBS environment variable.
if not conf.CheckLibWithHeader('z', 'zlib.h', 'C++'): if not conf.CheckLibWithHeader('z', 'zlib.h', 'C++','zlibVersion();'):
print 'Error: did not find needed zlib compression library '\ print 'Error: did not find needed zlib compression library '\
'and/or zlib.h header file.' 'and/or zlib.h header file.'
print ' Please install zlib and try again.' print ' Please install zlib and try again.'

View file

@ -311,30 +311,41 @@ def makeEnv(label, objsfx, strip = False, **kwargs):
envList.append(newEnv) envList.append(newEnv)
# Debug binary # Debug binary
# Solaris seems to have some issue with DWARF2 debugging information, it's ok ccflags = {}
# with stabs though if env['GCC']:
if sys.platform == 'sunos5': if sys.platform == 'sunos5':
debug_flag = '-gstabs+' ccflags['debug'] = '-gstabs+'
else:
ccflags['debug'] = '-ggdb3'
ccflags['opt'] = '-g -O3'
ccflags['fast'] = '-O3'
ccflags['prof'] = '-O3 -g -pg'
elif env['SUNCC']:
ccflags['debug'] = '-g0'
ccflags['opt'] = '-g -O'
ccflags['fast'] = '-fast'
ccflags['prof'] = '-fast -g -pg'
else: else:
debug_flag = '-ggdb3' print 'Unknown compiler, please fix compiler options'
Exit(1)
makeEnv('debug', '.do', makeEnv('debug', '.do',
CCFLAGS = Split('%s -O0' % debug_flag), CCFLAGS = Split(ccflags['debug']),
CPPDEFINES = ['DEBUG', 'TRACING_ON=1']) CPPDEFINES = ['DEBUG', 'TRACING_ON=1'])
# Optimized binary # Optimized binary
makeEnv('opt', '.o', makeEnv('opt', '.o',
CCFLAGS = Split('-g -O3'), CCFLAGS = Split(ccflags['opt']),
CPPDEFINES = ['TRACING_ON=1']) CPPDEFINES = ['TRACING_ON=1'])
# "Fast" binary # "Fast" binary
makeEnv('fast', '.fo', strip = True, makeEnv('fast', '.fo', strip = True,
CCFLAGS = Split('-O3'), CCFLAGS = Split(ccflags['fast']),
CPPDEFINES = ['NDEBUG', 'TRACING_ON=0']) CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'])
# Profiled binary # Profiled binary
makeEnv('prof', '.po', makeEnv('prof', '.po',
CCFLAGS = Split('-O3 -g -pg'), CCFLAGS = Split(ccflags['prof']),
CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'], CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
LINKFLAGS = '-pg') LINKFLAGS = '-pg')

View file

@ -691,8 +691,8 @@ decode OP default Unknown::unknown()
Fsr &= ~(0x1F); Fsr &= ~(0x1F);
}}); }});
0x0B: Trap::fabsq({{fault = new FpDisabled;}}); 0x0B: Trap::fabsq({{fault = new FpDisabled;}});
0x29: fsqrts({{Frds.sf = sqrt(Frs2s.sf);}}); 0x29: fsqrts({{Frds.sf = std::sqrt(Frs2s.sf);}});
0x2A: fsqrtd({{Frd.df = sqrt(Frs2.df);}}); 0x2A: fsqrtd({{Frd.df = std::sqrt(Frs2.df);}});
0x2B: Trap::fsqrtq({{fault = new FpDisabled;}}); 0x2B: Trap::fsqrtq({{fault = new FpDisabled;}});
0x41: fadds({{Frds.sf = Frs1s.sf + Frs2s.sf;}}); 0x41: fadds({{Frds.sf = Frs1s.sf + Frs2s.sf;}});
0x42: faddd({{Frd.df = Frs1.df + Frs2.df;}}); 0x42: faddd({{Frd.df = Frs1.df + Frs2.df;}});

View file

@ -1,4 +1,4 @@
// Copyright (c) 2006 The Regents of The University of Michigan // Copyright (c) 2006-2007 The Regents of The University of Michigan
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
@ -38,6 +38,7 @@ def template BasicExecPanic {{
Fault execute(%(CPU_exec_context)s *, Trace::InstRecord *) const Fault execute(%(CPU_exec_context)s *, Trace::InstRecord *) const
{ {
panic("Execute method called when it shouldn't!"); panic("Execute method called when it shouldn't!");
M5_DUMMY_RETURN
} }
}}; }};

View file

@ -1,4 +1,4 @@
// Copyright (c) 2006 The Regents of The University of Michigan // Copyright (c) 2006-2007 The Regents of The University of Michigan
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
@ -154,7 +154,7 @@ output decoder {{
bool IntOp::printPseudoOps(std::ostream &os, Addr pc, bool IntOp::printPseudoOps(std::ostream &os, Addr pc,
const SymbolTable *symbab) const const SymbolTable *symbab) const
{ {
if(!strcmp(mnemonic, "or") && _srcRegIdx[0] == 0) if(!std::strcmp(mnemonic, "or") && _srcRegIdx[0] == 0)
{ {
printMnemonic(os, "mov"); printMnemonic(os, "mov");
printSrcReg(os, 1); printSrcReg(os, 1);
@ -168,7 +168,7 @@ output decoder {{
bool IntOpImm::printPseudoOps(std::ostream &os, Addr pc, bool IntOpImm::printPseudoOps(std::ostream &os, Addr pc,
const SymbolTable *symbab) const const SymbolTable *symbab) const
{ {
if(!strcmp(mnemonic, "or")) if(!std::strcmp(mnemonic, "or"))
{ {
if(_numSrcRegs > 0 && _srcRegIdx[0] == 0) if(_numSrcRegs > 0 && _srcRegIdx[0] == 0)
{ {

View file

@ -34,6 +34,7 @@
// //
output header {{ output header {{
#include <cstring>
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
@ -65,6 +66,7 @@ output exec {{
#endif #endif
#include <limits> #include <limits>
#include <cmath>
#include "arch/sparc/asi.hh" #include "arch/sparc/asi.hh"
#include "cpu/base.hh" #include "cpu/base.hh"
#include "cpu/exetrace.hh" #include "cpu/exetrace.hh"

View file

@ -59,7 +59,7 @@ namespace SparcISA
// These enumerate all the registers for dependence tracking. // These enumerate all the registers for dependence tracking.
enum DependenceTags { enum DependenceTags {
FP_Base_DepTag = 33, FP_Base_DepTag = 33,
Ctrl_Base_DepTag = 97, Ctrl_Base_DepTag = 97
}; };
// semantically meaningful register indices // semantically meaningful register indices

View file

@ -195,6 +195,7 @@ bool
SparcSystem::breakpoint() SparcSystem::breakpoint()
{ {
panic("Need to implement"); panic("Need to implement");
M5_DUMMY_RETURN
} }
void void

View file

@ -28,6 +28,8 @@
* Authors: Ali Saidi * Authors: Ali Saidi
*/ */
#include <cstring>
#include "arch/sparc/asi.hh" #include "arch/sparc/asi.hh"
#include "arch/sparc/miscregfile.hh" #include "arch/sparc/miscregfile.hh"
#include "arch/sparc/tlb.hh" #include "arch/sparc/tlb.hh"
@ -53,7 +55,7 @@ TLB::TLB(const std::string &name, int s)
fatal("SPARC T1 TLB registers don't support more than 64 TLB entries."); fatal("SPARC T1 TLB registers don't support more than 64 TLB entries.");
tlb = new TlbEntry[size]; tlb = new TlbEntry[size];
memset(tlb, 0, sizeof(TlbEntry) * size); std::memset(tlb, 0, sizeof(TlbEntry) * size);
for (int x = 0; x < size; x++) for (int x = 0; x < size; x++)
freeList.push_back(&tlb[x]); freeList.push_back(&tlb[x]);

View file

@ -50,7 +50,7 @@ namespace SparcISA
inline ExtMachInst inline ExtMachInst
makeExtMI(MachInst inst, ThreadContext * xc) { makeExtMI(MachInst inst, ThreadContext * xc) {
ExtMachInst emi = (unsigned MachInst) inst; ExtMachInst emi = (MachInst) inst;
//The I bit, bit 13, is used to figure out where the ASI //The I bit, bit 13, is used to figure out where the ASI
//should come from. Use that in the ExtMachInst. This is //should come from. Use that in the ExtMachInst. This is
//slightly redundant, but it removes the need to put a condition //slightly redundant, but it removes the need to put a condition

View file

@ -32,8 +32,8 @@
* LZSSCompression definitions. * LZSSCompression definitions.
*/ */
#include <assert.h> #include <cassert>
#include <cstring>
#include "base/compression/lzss_compression.hh" #include "base/compression/lzss_compression.hh"
#include "base/misc.hh" //for fatal #include "base/misc.hh" //for fatal
@ -134,7 +134,7 @@ LZSSCompression::compress(uint8_t *dest, uint8_t *src, int size)
if (dest_index >= size) { if (dest_index >= size) {
// Have expansion instead of compression, just copy. // Have expansion instead of compression, just copy.
memcpy(dest,src,size); std::memcpy(dest,src,size);
return size; return size;
} }
return dest_index; return dest_index;

View file

@ -50,11 +50,13 @@ class NullCompression : public CompressionAlgorithm
int uncompress(uint8_t * dest, uint8_t *src, int size) int uncompress(uint8_t * dest, uint8_t *src, int size)
{ {
fatal("Can't uncompress data"); fatal("Can't uncompress data");
M5_DUMMY_RETURN
} }
int compress(uint8_t *dest, uint8_t *src, int size) int compress(uint8_t *dest, uint8_t *src, int size)
{ {
fatal("Can't compress data"); fatal("Can't compress data");
M5_DUMMY_RETURN
} }
}; };

View file

@ -136,10 +136,10 @@ operator,(ArgList &alist, ArgListNull)
inline void inline void
__cprintf(const std::string &format, ArgList &args) __cprintf(const std::string &format, ArgList &args)
{ args.dump(format); delete &args; } { args.dump(format); delete &args; }
#define __cprintf__(format, args...) \ #define __cprintf__(format, ...) \
cp::__cprintf(format, (*(new cp::ArgList), args)) cp::__cprintf(format, (*(new cp::ArgList), __VA_ARGS__))
#define cprintf(args...) \ #define cprintf(...) \
__cprintf__(args, cp::ArgListNull()) __cprintf__(__VA_ARGS__, cp::ArgListNull())
// //
// ccprintf(stream, format, args, ...) prints to the specified stream // ccprintf(stream, format, args, ...) prints to the specified stream
@ -148,10 +148,10 @@ __cprintf(const std::string &format, ArgList &args)
inline void inline void
__ccprintf(std::ostream &stream, const std::string &format, ArgList &args) __ccprintf(std::ostream &stream, const std::string &format, ArgList &args)
{ args.dump(stream, format); delete &args; } { args.dump(stream, format); delete &args; }
#define __ccprintf__(stream, format, args...) \ #define __ccprintf__(stream, format, ...) \
cp::__ccprintf(stream, format, (*(new cp::ArgList), args)) cp::__ccprintf(stream, format, (*(new cp::ArgList), __VA_ARGS__))
#define ccprintf(stream, args...) \ #define ccprintf(stream, ...) \
__ccprintf__(stream, args, cp::ArgListNull()) __ccprintf__(stream, __VA_ARGS__, cp::ArgListNull())
// //
// csprintf(format, args, ...) returns a string // csprintf(format, args, ...) returns a string
@ -160,10 +160,10 @@ __ccprintf(std::ostream &stream, const std::string &format, ArgList &args)
inline std::string inline std::string
__csprintf(const std::string &format, ArgList &args) __csprintf(const std::string &format, ArgList &args)
{ std::string s = args.dumpToString(format); delete &args; return s; } { std::string s = args.dumpToString(format); delete &args; return s; }
#define __csprintf__(format, args...) \ #define __csprintf__(format, ...) \
cp::__csprintf(format, (*(new cp::ArgList), args)) cp::__csprintf(format, (*(new cp::ArgList), __VA_ARGS__))
#define csprintf(args...) \ #define csprintf(...) \
__csprintf__(args, cp::ArgListNull()) __csprintf__(__VA_ARGS__, cp::ArgListNull())
} }

View file

@ -59,7 +59,7 @@ namespace m5 {
// //
namespace __hash_namespace { namespace __hash_namespace {
#if !defined(__LP64__) && !defined(__alpha__) #if !defined(__LP64__) && !defined(__alpha__) && !defined(__SUNPRO_CC)
template<> template<>
struct hash<uint64_t> { struct hash<uint64_t> {
size_t operator()(uint64_t r) const { size_t operator()(uint64_t r) const {

View file

@ -33,6 +33,7 @@
#include <math.h> #include <math.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <string> #include <string>

View file

@ -101,7 +101,7 @@ ObjectFile::close()
} }
if (fileData) { if (fileData) {
::munmap(fileData, len); ::munmap((char*)fileData, len);
fileData = NULL; fileData = NULL;
} }
} }
@ -147,7 +147,7 @@ createObjectFile(const string &fname, bool raw)
// don't know what it is // don't know what it is
close(fd); close(fd);
munmap(fileData, len); munmap((char*)fileData, len);
return NULL; return NULL;
} }

View file

@ -33,8 +33,13 @@
#define __MISC_HH__ #define __MISC_HH__
#include <assert.h> #include <assert.h>
#include "base/compiler.hh"
#include "base/cprintf.hh" #include "base/cprintf.hh"
#if defined(__SUNPRO_CC)
#define __FUNCTION__ "how to fix me?"
#endif
// //
// This implements a cprintf based panic() function. panic() should // This implements a cprintf based panic() function. panic() should
// be called when something happens that should never ever happen // be called when something happens that should never ever happen
@ -43,12 +48,13 @@
// //
// //
void __panic(const std::string&, cp::ArgList &, const char*, const char*, int) void __panic(const std::string&, cp::ArgList &, const char*, const char*, int)
__attribute__((noreturn)); M5_ATTR_NORETURN;
#define __panic__(format, args...) \ #define __panic__(format, ...) \
__panic(format, (*(new cp::ArgList), args), \ __panic(format, (*(new cp::ArgList), __VA_ARGS__), \
__FUNCTION__, __FILE__, __LINE__) __FUNCTION__ , __FILE__, __LINE__)
#define panic(args...) \ #define panic(...) \
__panic__(args, cp::ArgListNull()) __panic__(__VA_ARGS__, cp::ArgListNull())
M5_PRAGMA_NORETURN(__panic)
// //
// This implements a cprintf based fatal() function. fatal() should // This implements a cprintf based fatal() function. fatal() should
@ -59,32 +65,33 @@ void __panic(const std::string&, cp::ArgList &, const char*, const char*, int)
// panic() does. // panic() does.
// //
void __fatal(const std::string&, cp::ArgList &, const char*, const char*, int) void __fatal(const std::string&, cp::ArgList &, const char*, const char*, int)
__attribute__((noreturn)); M5_ATTR_NORETURN;
#define __fatal__(format, args...) \ #define __fatal__(format, ...) \
__fatal(format, (*(new cp::ArgList), args), \ __fatal(format, (*(new cp::ArgList), __VA_ARGS__), \
__FUNCTION__, __FILE__, __LINE__) __FUNCTION__ , __FILE__, __LINE__)
#define fatal(args...) \ #define fatal(...) \
__fatal__(args, cp::ArgListNull()) __fatal__(__VA_ARGS__, cp::ArgListNull())
M5_PRAGMA_NORETURN(__fatal)
// //
// This implements a cprintf based warn // This implements a cprintf based warn
// //
void __warn(const std::string&, cp::ArgList &, const char*, const char*, int); void __warn(const std::string&, cp::ArgList &, const char*, const char*, int);
#define __warn__(format, args...) \ #define __warn__(format, ...) \
__warn(format, (*(new cp::ArgList), args), \ __warn(format, (*(new cp::ArgList), __VA_ARGS__), \
__FUNCTION__, __FILE__, __LINE__) __FUNCTION__ , __FILE__, __LINE__)
#define warn(args...) \ #define warn(...) \
__warn__(args, cp::ArgListNull()) __warn__(__VA_ARGS__, cp::ArgListNull())
// Only print the warning message the first time it is seen. This // Only print the warning message the first time it is seen. This
// doesn't check the warning string itself, it just only lets one // doesn't check the warning string itself, it just only lets one
// warning come from the statement. So, even if the arguments change // warning come from the statement. So, even if the arguments change
// and that would have resulted in a different warning message, // and that would have resulted in a different warning message,
// subsequent messages would still be supressed. // subsequent messages would still be supressed.
#define warn_once(args...) do { \ #define warn_once(...) do { \
static bool once = false; \ static bool once = false; \
if (!once) { \ if (!once) { \
__warn__(args, cp::ArgListNull()); \ __warn__(__VA_ARGS__, cp::ArgListNull()); \
once = true; \ once = true; \
} \ } \
} while (0) } while (0)

View file

@ -30,7 +30,7 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/types.h> #include <sys/types.h>
#if defined(__sun__) #if defined(__sun__) || defined(__SUNPRO_CC)
#include <sys/file.h> #include <sys/file.h>
#endif #endif

View file

@ -29,12 +29,17 @@
* Ali Saidi * Ali Saidi
*/ */
#if defined(__sun)
#include <ieeefp.h>
#endif
#ifdef __SUNPRO_CC
#include <stdlib.h>
#include <math.h>
#endif
#include <cstdlib> #include <cstdlib>
#include <cmath> #include <cmath>
#if defined(__sun__)
#include <ieeefp.h>
#endif
#include "sim/param.hh" #include "sim/param.hh"
#include "base/random.hh" #include "base/random.hh"
@ -72,7 +77,7 @@ getLong()
double double
m5round(double r) m5round(double r)
{ {
#if defined(__sun__) #if defined(__sun)
double val; double val;
fp_rnd oldrnd = fpsetround(FP_RN); fp_rnd oldrnd = fpsetround(FP_RN);
val = rint(r); val = rint(r);

View file

@ -610,7 +610,7 @@ BaseRemoteGDB::trap(int type)
uint64_t val; uint64_t val;
size_t datalen, len; size_t datalen, len;
char data[GDBPacketBufLen + 1]; char data[GDBPacketBufLen + 1];
char buffer[gdbregs.bytes() * 2 + 256]; char *buffer;
const char *p; const char *p;
char command, subcmd; char command, subcmd;
string var; string var;
@ -619,6 +619,8 @@ BaseRemoteGDB::trap(int type)
if (!attached) if (!attached)
return false; return false;
buffer = (char*)malloc(gdbregs.bytes() * 2 + 256);
DPRINTF(GDBMisc, "trap: PC=%#x NPC=%#x\n", DPRINTF(GDBMisc, "trap: PC=%#x NPC=%#x\n",
context->readPC(), context->readNextPC()); context->readPC(), context->readNextPC());
@ -916,6 +918,7 @@ BaseRemoteGDB::trap(int type)
} }
out: out:
free(buffer);
return true; return true;
} }

View file

@ -50,6 +50,9 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#ifdef __SUNPRO_CC
#include <math.h>
#endif
#include <cmath> #include <cmath>
#include <functional> #include <functional>
#include <iosfwd> #include <iosfwd>
@ -1410,7 +1413,7 @@ struct DistStor
else if (val > params.max) else if (val > params.max)
overflow += number; overflow += number;
else { else {
int index = (int)floor((val - params.min) / params.bucket_size); int index = (int)std::floor((val - params.min) / params.bucket_size);
assert(index < size(params)); assert(index < size(params));
cvec[index] += number; cvec[index] += number;
} }

View file

@ -32,6 +32,10 @@
#define _GLIBCPP_USE_C99 1 #define _GLIBCPP_USE_C99 1
#endif #endif
#if defined(__sun)
#include <math.h>
#endif
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>

View file

@ -105,7 +105,11 @@ Time::date(string format) const
char buf[256]; char buf[256];
if (format.empty()) { if (format.empty()) {
#ifdef __SUNPRO_CC
ctime_r(&sec, buf, 256);
#else
ctime_r(&sec, buf); ctime_r(&sec, buf);
#endif
buf[24] = '\0'; buf[24] = '\0';
return buf; return buf;
} }

View file

@ -97,7 +97,7 @@ std::ostream &operator<<(std::ostream &out, const Time &time);
* @(#)time.h 8.2 (Berkeley) 7/10/94 * @(#)time.h 8.2 (Berkeley) 7/10/94
*/ */
#if defined(__sun__) #if defined(__sun)
#define timersub(tvp, uvp, vvp) \ #define timersub(tvp, uvp, vvp) \
do { \ do { \
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \

View file

@ -33,6 +33,7 @@
#define __BASE_TIMEBUF_HH__ #define __BASE_TIMEBUF_HH__
#include <cassert> #include <cassert>
#include <cstring>
#include <vector> #include <vector>
template <class T> template <class T>
@ -143,7 +144,7 @@ class TimeBuffer
char *ptr = data; char *ptr = data;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
index[i] = ptr; index[i] = ptr;
memset(ptr, 0, sizeof(T)); std::memset(ptr, 0, sizeof(T));
new (ptr) T; new (ptr) T;
ptr += sizeof(T); ptr += sizeof(T);
} }
@ -171,7 +172,7 @@ class TimeBuffer
if (ptr >= size) if (ptr >= size)
ptr -= size; ptr -= size;
(reinterpret_cast<T *>(index[ptr]))->~T(); (reinterpret_cast<T *>(index[ptr]))->~T();
memset(index[ptr], 0, sizeof(T)); std::memset(index[ptr], 0, sizeof(T));
new (index[ptr]) T; new (index[ptr]) T;
} }

View file

@ -186,39 +186,39 @@ do { \
Trace::dataDump(curTick, name(), data, count); \ Trace::dataDump(curTick, name(), data, count); \
} while (0) } while (0)
#define __dprintf(cycle, name, format, args...) \ #define __dprintf(cycle, name, format, ...) \
Trace::dprintf(format, (*(new cp::ArgList), args), cycle, name) Trace::dprintf(format, (*(new cp::ArgList), __VA_ARGS__), cycle, name)
#define DPRINTF(x, args...) \ #define DPRINTF(x, ...) \
do { \ do { \
if (Trace::IsOn(Trace::x)) \ if (Trace::IsOn(Trace::x)) \
__dprintf(curTick, name(), args, cp::ArgListNull()); \ __dprintf(curTick, name(), __VA_ARGS__, cp::ArgListNull()); \
} while (0) } while (0)
#define DPRINTFR(x, args...) \ #define DPRINTFR(x, ...) \
do { \ do { \
if (Trace::IsOn(Trace::x)) \ if (Trace::IsOn(Trace::x)) \
__dprintf((Tick)-1, std::string(), args, cp::ArgListNull()); \ __dprintf((Tick)-1, std::string(), __VA_ARGS__, cp::ArgListNull()); \
} while (0) } while (0)
#define DPRINTFN(args...) \ #define DPRINTFN(...) \
do { \ do { \
__dprintf(curTick, name(), args, cp::ArgListNull()); \ __dprintf(curTick, name(), __VA_ARGS__, cp::ArgListNull()); \
} while (0) } while (0)
#define DPRINTFNR(args...) \ #define DPRINTFNR(...) \
do { \ do { \
__dprintf((Tick)-1, string(), args, cp::ArgListNull()); \ __dprintf((Tick)-1, string(), __VA_ARGS__, cp::ArgListNull()); \
} while (0) } while (0)
#else // !TRACING_ON #else // !TRACING_ON
#define DTRACE(x) (false) #define DTRACE(x) (false)
#define DCOUT(x) if (0) DebugOut() #define DCOUT(x) if (0) DebugOut()
#define DPRINTF(x, args...) do {} while (0) #define DPRINTF(x, ...) do {} while (0)
#define DPRINTFR(args...) do {} while (0) #define DPRINTFR(...) do {} while (0)
#define DPRINTFN(args...) do {} while (0) #define DPRINTFN(...) do {} while (0)
#define DPRINTFNR(args...) do {} while (0) #define DPRINTFNR(...) do {} while (0)
#define DDUMP(x, data, count) do {} while (0) #define DDUMP(x, data, count) do {} while (0)
#endif // TRACING_ON #endif // TRACING_ON

View file

@ -54,18 +54,18 @@ execfile(models_db.srcnode().abspath)
exec_sig_template = ''' exec_sig_template = '''
virtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0; virtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0;
virtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const virtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const
{ panic("initiateAcc not defined!"); }; { panic("initiateAcc not defined!"); M5_DUMMY_RETURN };
virtual Fault completeAcc(Packet *pkt, %s *xc, virtual Fault completeAcc(Packet *pkt, %s *xc,
Trace::InstRecord *traceData) const Trace::InstRecord *traceData) const
{ panic("completeAcc not defined!"); }; { panic("completeAcc not defined!"); M5_DUMMY_RETURN };
''' '''
mem_ini_sig_template = ''' mem_ini_sig_template = '''
virtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); }; virtual Fault initiateAcc(%s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); M5_DUMMY_RETURN };
''' '''
mem_comp_sig_template = ''' mem_comp_sig_template = '''
virtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; }; virtual Fault completeAcc(uint8_t *data, %s *xc, Trace::InstRecord *traceData) const { panic("Not defined!"); return NoFault; M5_DUMMY_RETURN };
''' '''
# Generate a temporary CPU list, including the CheckerCPU if # Generate a temporary CPU list, including the CheckerCPU if

View file

@ -28,6 +28,8 @@
* Authors: Kevin Lim * Authors: Kevin Lim
*/ */
#include <cstring>
#include "base/timebuf.hh" #include "base/timebuf.hh"
#include "cpu/activity.hh" #include "cpu/activity.hh"
@ -37,7 +39,7 @@ ActivityRecorder::ActivityRecorder(int num_stages, int longest_latency,
activityCount(activity), numStages(num_stages) activityCount(activity), numStages(num_stages)
{ {
stageActive = new bool[numStages]; stageActive = new bool[numStages];
memset(stageActive, 0, numStages); std::memset(stageActive, 0, numStages);
} }
void void
@ -114,7 +116,7 @@ void
ActivityRecorder::reset() ActivityRecorder::reset()
{ {
activityCount = 0; activityCount = 0;
memset(stageActive, 0, numStages); std::memset(stageActive, 0, numStages);
for (int i = 0; i < longestLatency + 1; ++i) for (int i = 0; i < longestLatency + 1; ++i)
activityBuffer.advance(); activityBuffer.advance();
} }

View file

@ -32,6 +32,7 @@
#ifndef __EXETRACE_HH__ #ifndef __EXETRACE_HH__
#define __EXETRACE_HH__ #define __EXETRACE_HH__
#include <cstring>
#include <fstream> #include <fstream>
#include <vector> #include <vector>
@ -169,7 +170,7 @@ InstRecord::setRegs(const IntRegFile &regs)
if (!iregs) if (!iregs)
iregs = new iRegFile; iregs = new iRegFile;
memcpy(&iregs->regs, &regs, sizeof(IntRegFile)); std::memcpy(&iregs->regs, &regs, sizeof(IntRegFile));
regs_valid = true; regs_valid = true;
} }

View file

@ -186,7 +186,8 @@ class BaseSimpleCPU : public BaseCPU
// These functions are only used in CPU models that split // These functions are only used in CPU models that split
// effective address computation from the actual memory access. // effective address computation from the actual memory access.
void setEA(Addr EA) { panic("BaseSimpleCPU::setEA() not implemented\n"); } void setEA(Addr EA) { panic("BaseSimpleCPU::setEA() not implemented\n"); }
Addr getEA() { panic("BaseSimpleCPU::getEA() not implemented\n"); } Addr getEA() { panic("BaseSimpleCPU::getEA() not implemented\n");
M5_DUMMY_RETURN}
void prefetch(Addr addr, unsigned flags) void prefetch(Addr addr, unsigned flags)
{ {

View file

@ -56,12 +56,14 @@ Tick
BadDevice::read(PacketPtr pkt) BadDevice::read(PacketPtr pkt)
{ {
panic("Device %s not imlpmented\n", devname); panic("Device %s not imlpmented\n", devname);
M5_DUMMY_RETURN
} }
Tick Tick
BadDevice::write(PacketPtr pkt) BadDevice::write(PacketPtr pkt)
{ {
panic("Device %s not imlpmented\n", devname); panic("Device %s not imlpmented\n", devname);
M5_DUMMY_RETURN
} }
BEGIN_DECLARE_SIM_OBJECT_PARAMS(BadDevice) BEGIN_DECLARE_SIM_OBJECT_PARAMS(BadDevice)

View file

@ -35,7 +35,7 @@
#if defined(linux) #if defined(linux)
#include <endian.h> #include <endian.h>
#elif defined(__sun__) #elif defined(__sun)
#include <sys/isa_defs.h> #include <sys/isa_defs.h>
#else #else
#include <machine/endian.h> #include <machine/endian.h>

View file

@ -109,7 +109,7 @@ class DmaPort : public Port
virtual bool recvTiming(PacketPtr pkt); virtual bool recvTiming(PacketPtr pkt);
virtual Tick recvAtomic(PacketPtr pkt) virtual Tick recvAtomic(PacketPtr pkt)
{ panic("dma port shouldn't be used for pio access."); } { panic("dma port shouldn't be used for pio access."); M5_DUMMY_RETURN }
virtual void recvFunctional(PacketPtr pkt) virtual void recvFunctional(PacketPtr pkt)
{ panic("dma port shouldn't be used for pio access."); } { panic("dma port shouldn't be used for pio access."); }

View file

@ -83,8 +83,10 @@ PciConfigAll::write(PacketPtr pkt)
{ {
assert(pkt->result == Packet::Unknown); assert(pkt->result == Packet::Unknown);
panic("Attempting to write to config space on non-existant device\n"); panic("Attempting to write to config space on non-existant device\n");
M5_DUMMY_RETURN
} }
void void
PciConfigAll::addressRanges(AddrRangeList &range_list) PciConfigAll::addressRanges(AddrRangeList &range_list)
{ {

View file

@ -37,6 +37,8 @@
#ifndef __DEV_PCIDEV_HH__ #ifndef __DEV_PCIDEV_HH__
#define __DEV_PCIDEV_HH__ #define __DEV_PCIDEV_HH__
#include <cstring>
#include "dev/io_device.hh" #include "dev/io_device.hh"
#include "dev/pcireg.h" #include "dev/pcireg.h"
#include "dev/platform.hh" #include "dev/platform.hh"
@ -62,8 +64,8 @@ class PciConfigData : public SimObject
PciConfigData(const std::string &name) PciConfigData(const std::string &name)
: SimObject(name) : SimObject(name)
{ {
memset(config.data, 0, sizeof(config.data)); std::memset(config.data, 0, sizeof(config.data));
memset(BARSize, 0, sizeof(BARSize)); std::memset(BARSize, 0, sizeof(BARSize));
} }
/** The first 64 bytes */ /** The first 64 bytes */

View file

@ -62,6 +62,7 @@ Addr
Platform::pciToDma(Addr pciAddr) const Platform::pciToDma(Addr pciAddr) const
{ {
panic("No PCI dma support in platform."); panic("No PCI dma support in platform.");
M5_DUMMY_RETURN
} }
void void

View file

@ -33,6 +33,8 @@
* in legion. Any access is translated to an offset in the disk image. * in legion. Any access is translated to an offset in the disk image.
*/ */
#include <cstring>
#include "base/trace.hh" #include "base/trace.hh"
#include "dev/sparc/mm_disk.hh" #include "dev/sparc/mm_disk.hh"
#include "dev/platform.hh" #include "dev/platform.hh"
@ -45,7 +47,7 @@
MmDisk::MmDisk(Params *p) MmDisk::MmDisk(Params *p)
: BasicPioDevice(p), image(p->image), curSector((uint64_t)-1), dirty(false) : BasicPioDevice(p), image(p->image), curSector((uint64_t)-1), dirty(false)
{ {
memset(&bytes, 0, SectorSize); std::memset(&bytes, 0, SectorSize);
pioSize = image->size() * SectorSize; pioSize = image->size() * SectorSize;
} }
@ -99,6 +101,7 @@ Tick
MmDisk::write(PacketPtr pkt) MmDisk::write(PacketPtr pkt)
{ {
panic("need to implement\n"); panic("need to implement\n");
M5_DUMMY_RETURN
} }

View file

@ -57,6 +57,7 @@ Tick
T1000::intrFrequency() T1000::intrFrequency()
{ {
panic("Need implementation\n"); panic("Need implementation\n");
M5_DUMMY_RETURN
} }
void void
@ -89,6 +90,7 @@ Addr
T1000::pciToDma(Addr pciAddr) const T1000::pciToDma(Addr pciAddr) const
{ {
panic("Need implementation\n"); panic("Need implementation\n");
M5_DUMMY_RETURN
} }
@ -96,6 +98,7 @@ Addr
T1000::calcConfigAddr(int bus, int dev, int func) T1000::calcConfigAddr(int bus, int dev, int func)
{ {
panic("Need implementation\n"); panic("Need implementation\n");
M5_DUMMY_RETURN
} }
void void

View file

@ -40,6 +40,7 @@
#include <cassert> #include <cassert>
#include <iostream> #include <iostream>
#include <cstring>
#include <string> #include <string>
#include "sim/host.hh" #include "sim/host.hh"
@ -125,7 +126,7 @@ Cache<TagStore,Coherence>::handleAccess(PacketPtr &pkt, int & lat,
assert(offset < blkSize); assert(offset < blkSize);
assert(pkt->getSize() <= blkSize); assert(pkt->getSize() <= blkSize);
assert(offset+pkt->getSize() <= blkSize); assert(offset+pkt->getSize() <= blkSize);
memcpy(blk->data + offset, pkt->getPtr<uint8_t>(), std::memcpy(blk->data + offset, pkt->getPtr<uint8_t>(),
pkt->getSize()); pkt->getSize());
} else if (!(pkt->flags & SATISFIED)) { } else if (!(pkt->flags & SATISFIED)) {
pkt->flags |= SATISFIED; pkt->flags |= SATISFIED;
@ -133,7 +134,7 @@ Cache<TagStore,Coherence>::handleAccess(PacketPtr &pkt, int & lat,
assert(offset < blkSize); assert(offset < blkSize);
assert(pkt->getSize() <= blkSize); assert(pkt->getSize() <= blkSize);
assert(offset + pkt->getSize() <=blkSize); assert(offset + pkt->getSize() <=blkSize);
memcpy(pkt->getPtr<uint8_t>(), blk->data + offset, std::memcpy(pkt->getPtr<uint8_t>(), blk->data + offset,
pkt->getSize()); pkt->getSize());
} }
return blk; return blk;
@ -176,7 +177,7 @@ Cache<TagStore,Coherence>::handleAccess(PacketPtr &pkt, int & lat,
if (blk->checkWrite(pkt->req)) { if (blk->checkWrite(pkt->req)) {
write_data = true; write_data = true;
blk->status |= BlkDirty; blk->status |= BlkDirty;
memcpy(blk->data + offset, pkt->getPtr<uint8_t>(), std::memcpy(blk->data + offset, pkt->getPtr<uint8_t>(),
pkt->getSize()); pkt->getSize());
} }
} else { } else {
@ -184,7 +185,7 @@ Cache<TagStore,Coherence>::handleAccess(PacketPtr &pkt, int & lat,
if (pkt->req->isLocked()) { if (pkt->req->isLocked()) {
blk->trackLoadLocked(pkt->req); blk->trackLoadLocked(pkt->req);
} }
memcpy(pkt->getPtr<uint8_t>(), blk->data + offset, std::memcpy(pkt->getPtr<uint8_t>(), blk->data + offset,
pkt->getSize()); pkt->getSize());
} }
@ -228,7 +229,7 @@ Cache<TagStore,Coherence>::handleFill(BlkType *blk, PacketPtr &pkt,
if (pkt->isRead()) { if (pkt->isRead()) {
memcpy(blk->data, pkt->getPtr<uint8_t>(), blkSize); std::memcpy(blk->data, pkt->getPtr<uint8_t>(), blkSize);
} }
blk->whenReady = pkt->finishTime; blk->whenReady = pkt->finishTime;
@ -249,14 +250,14 @@ Cache<TagStore,Coherence>::handleFill(BlkType *blk, PacketPtr &pkt,
if (target->isWrite()) { if (target->isWrite()) {
if (blk->checkWrite(pkt->req)) { if (blk->checkWrite(pkt->req)) {
blk->status |= BlkDirty; blk->status |= BlkDirty;
memcpy(blk->data + target->getOffset(blkSize), std::memcpy(blk->data + target->getOffset(blkSize),
target->getPtr<uint8_t>(), target->getSize()); target->getPtr<uint8_t>(), target->getSize());
} }
} else { } else {
if (pkt->req->isLocked()) { if (pkt->req->isLocked()) {
blk->trackLoadLocked(pkt->req); blk->trackLoadLocked(pkt->req);
} }
memcpy(target->getPtr<uint8_t>(), std::memcpy(target->getPtr<uint8_t>(),
blk->data + target->getOffset(blkSize), blk->data + target->getOffset(blkSize),
target->getSize()); target->getSize());
} }
@ -285,7 +286,7 @@ Cache<TagStore,Coherence>::handleFill(BlkType *blk, MSHR * mshr,
blk = doReplacement(blk, pkt, new_state, writebacks); blk = doReplacement(blk, pkt, new_state, writebacks);
if (pkt->isRead()) { if (pkt->isRead()) {
memcpy(blk->data, pkt->getPtr<uint8_t>(), blkSize); std::memcpy(blk->data, pkt->getPtr<uint8_t>(), blkSize);
} }
blk->whenReady = pkt->finishTime; blk->whenReady = pkt->finishTime;
@ -337,14 +338,14 @@ Cache<TagStore,Coherence>::handleFill(BlkType *blk, MSHR * mshr,
if (target->isWrite()) { if (target->isWrite()) {
if (blk->checkWrite(pkt->req)) { if (blk->checkWrite(pkt->req)) {
blk->status |= BlkDirty; blk->status |= BlkDirty;
memcpy(blk->data + target->getOffset(blkSize), std::memcpy(blk->data + target->getOffset(blkSize),
target->getPtr<uint8_t>(), target->getSize()); target->getPtr<uint8_t>(), target->getSize());
} }
} else { } else {
if (pkt->req->isLocked()) { if (pkt->req->isLocked()) {
blk->trackLoadLocked(pkt->req); blk->trackLoadLocked(pkt->req);
} }
memcpy(target->getPtr<uint8_t>(), std::memcpy(target->getPtr<uint8_t>(),
blk->data + target->getOffset(blkSize), blk->data + target->getOffset(blkSize),
target->getSize()); target->getSize());
} }
@ -384,7 +385,7 @@ Cache<TagStore,Coherence>::handleSnoop(BlkType *blk,
assert(offset < blkSize); assert(offset < blkSize);
assert(pkt->getSize() <= blkSize); assert(pkt->getSize() <= blkSize);
assert(offset + pkt->getSize() <=blkSize); assert(offset + pkt->getSize() <=blkSize);
memcpy(pkt->getPtr<uint8_t>(), blk->data + offset, pkt->getSize()); std::memcpy(pkt->getPtr<uint8_t>(), blk->data + offset, pkt->getSize());
handleSnoop(blk, new_state); handleSnoop(blk, new_state);
} }
@ -431,7 +432,7 @@ Cache<TagStore,Coherence>::writebackBlk(BlkType *blk)
new Request(tags->regenerateBlkAddr(blk->tag, blk->set), blkSize, 0); new Request(tags->regenerateBlkAddr(blk->tag, blk->set), blkSize, 0);
PacketPtr writeback = new Packet(writebackReq, Packet::Writeback, -1); PacketPtr writeback = new Packet(writebackReq, Packet::Writeback, -1);
writeback->allocate(); writeback->allocate();
memcpy(writeback->getPtr<uint8_t>(),blk->data,blkSize); std::memcpy(writeback->getPtr<uint8_t>(),blk->data,blkSize);
blk->status &= ~BlkDirty; blk->status &= ~BlkDirty;
return writeback; return writeback;
@ -463,7 +464,7 @@ Cache<TagStore,Coherence>::verifyData(BlkType *blk)
assert(blkSize == blk->size); assert(blkSize == blk->size);
} }
retval = memcmp(tmp_data, blk->data, blkSize) == 0; retval = std::memcmp(tmp_data, blk->data, blkSize) == 0;
delete [] tmp_data; delete [] tmp_data;
return retval; return retval;
} }
@ -664,7 +665,7 @@ Cache<TagStore,Coherence>::sendResult(PacketPtr &pkt, MSHR* mshr,
DPRINTF(Cache, "Block for blk addr %x moving from state " DPRINTF(Cache, "Block for blk addr %x moving from state "
"%i to %i\n", pkt->getAddr(), old_state, new_state); "%i to %i\n", pkt->getAddr(), old_state, new_state);
//Set the state on the upgrade //Set the state on the upgrade
memcpy(pkt->getPtr<uint8_t>(), blk->data, blkSize); std::memcpy(pkt->getPtr<uint8_t>(), blk->data, blkSize);
PacketList writebacks; PacketList writebacks;
handleFill(blk, mshr, new_state, writebacks, pkt); handleFill(blk, mshr, new_state, writebacks, pkt);
assert(writebacks.empty()); assert(writebacks.empty());
@ -839,7 +840,7 @@ Cache<TagStore,Coherence>::snoop(PacketPtr &pkt)
assert(offset < blkSize); assert(offset < blkSize);
assert(pkt->getSize() <= blkSize); assert(pkt->getSize() <= blkSize);
assert(offset + pkt->getSize() <=blkSize); assert(offset + pkt->getSize() <=blkSize);
memcpy(pkt->getPtr<uint8_t>(), mshr->pkt->getPtr<uint8_t>() + offset, pkt->getSize()); std::memcpy(pkt->getPtr<uint8_t>(), mshr->pkt->getPtr<uint8_t>() + offset, pkt->getSize());
respondToSnoop(pkt, curTick + hitLatency); respondToSnoop(pkt, curTick + hitLatency);
} }

View file

@ -32,6 +32,7 @@
* @file * @file
* Definitions of a simple buffer for a blocking cache. * Definitions of a simple buffer for a blocking cache.
*/ */
#include <cstring>
#include "mem/cache/base_cache.hh" #include "mem/cache/base_cache.hh"
#include "mem/cache/miss/blocking_buffer.hh" #include "mem/cache/miss/blocking_buffer.hh"
@ -60,7 +61,7 @@ BlockingBuffer::handleMiss(PacketPtr &pkt, int blk_size, Tick time)
wb.allocate(pkt->cmd, blk_addr, blk_size, pkt); wb.allocate(pkt->cmd, blk_addr, blk_size, pkt);
} }
memcpy(wb.pkt->getPtr<uint8_t>(), pkt->getPtr<uint8_t>(), blk_size); std::memcpy(wb.pkt->getPtr<uint8_t>(), pkt->getPtr<uint8_t>(), blk_size);
cache->setBlocked(Blocked_NoWBBuffers); cache->setBlocked(Blocked_NoWBBuffers);
cache->setMasterRequest(Request_WB, time); cache->setMasterRequest(Request_WB, time);
@ -147,7 +148,7 @@ BlockingBuffer::handleResponse(PacketPtr &pkt, Tick time)
PacketPtr target = ((MSHR*)(pkt->senderState))->getTarget(); PacketPtr target = ((MSHR*)(pkt->senderState))->getTarget();
((MSHR*)(pkt->senderState))->popTarget(); ((MSHR*)(pkt->senderState))->popTarget();
if (pkt->isRead()) { if (pkt->isRead()) {
memcpy(target->getPtr<uint8_t>(), pkt->getPtr<uint8_t>(), target->getSize()); std::memcpy(target->getPtr<uint8_t>(), pkt->getPtr<uint8_t>(), target->getSize());
} }
cache->respond(target, time); cache->respond(target, time);
assert(!((MSHR*)(pkt->senderState))->hasTargets()); assert(!((MSHR*)(pkt->senderState))->hasTargets());
@ -191,7 +192,7 @@ BlockingBuffer::doWriteback(Addr addr,
PacketPtr pkt = new Packet(req, Packet::Writeback, -1); PacketPtr pkt = new Packet(req, Packet::Writeback, -1);
pkt->allocate(); pkt->allocate();
if (data) { if (data) {
memcpy(pkt->getPtr<uint8_t>(), data, size); std::memcpy(pkt->getPtr<uint8_t>(), data, size);
} }
if (compressed) { if (compressed) {
@ -217,7 +218,7 @@ BlockingBuffer::doWriteback(PacketPtr &pkt)
// Since allocate as buffer copies the request, // Since allocate as buffer copies the request,
// need to copy data here. // need to copy data here.
memcpy(wb.pkt->getPtr<uint8_t>(), pkt->getPtr<uint8_t>(), pkt->getSize()); std::memcpy(wb.pkt->getPtr<uint8_t>(), pkt->getPtr<uint8_t>(), pkt->getSize());
cache->setBlocked(Blocked_NoWBBuffers); cache->setBlocked(Blocked_NoWBBuffers);
cache->setMasterRequest(Request_WB, curTick); cache->setMasterRequest(Request_WB, curTick);

View file

@ -90,6 +90,7 @@ public:
PacketPtr &target) PacketPtr &target)
{ {
fatal("Unimplemented"); fatal("Unimplemented");
M5_DUMMY_RETURN
} }
/** /**
@ -201,6 +202,7 @@ public:
MSHR* allocateTargetList(Addr addr) MSHR* allocateTargetList(Addr addr)
{ {
fatal("Unimplemented"); fatal("Unimplemented");
M5_DUMMY_RETURN
} }
}; };

View file

@ -527,7 +527,7 @@ IIC::hash(Addr addr) const {
tag = extractTag(addr); tag = extractTag(addr);
mask = hashSets-1; /* assumes iic_hash_size is a power of 2 */ mask = hashSets-1; /* assumes iic_hash_size is a power of 2 */
x = tag & mask; x = tag & mask;
y = (tag >> (int)(::log(hashSets)/::log(2))) & mask; y = (tag >> (int)(::log((double)hashSets)/::log((double)2))) & mask;
assert (x < hashSets && y < hashSets); assert (x < hashSets && y < hashSets);
return x ^ y; return x ^ y;
#endif #endif

View file

@ -36,6 +36,7 @@
#ifndef __LRU_HH__ #ifndef __LRU_HH__
#define __LRU_HH__ #define __LRU_HH__
#include <cstring>
#include <list> #include <list>
#include "mem/cache/cache_blk.hh" // base class #include "mem/cache/cache_blk.hh" // base class
@ -273,7 +274,7 @@ public:
*/ */
void readData(LRUBlk *blk, uint8_t *data) void readData(LRUBlk *blk, uint8_t *data)
{ {
memcpy(data, blk->data, blk->size); std::memcpy(data, blk->data, blk->size);
} }
/** /**

View file

@ -36,6 +36,7 @@
#ifndef __SPLIT_HH__ #ifndef __SPLIT_HH__
#define __SPLIT_HH__ #define __SPLIT_HH__
#include <cstring>
#include <list> #include <list>
#include "mem/cache/cache_blk.hh" // base class #include "mem/cache/cache_blk.hh" // base class
@ -234,6 +235,7 @@ class Split : public BaseTags
int extractSet(Addr addr) const int extractSet(Addr addr) const
{ {
panic("should never call this!\n"); panic("should never call this!\n");
M5_DUMMY_RETURN
} }
/** /**
@ -281,7 +283,7 @@ class Split : public BaseTags
*/ */
void readData(SplitBlk *blk, uint8_t *data) void readData(SplitBlk *blk, uint8_t *data)
{ {
memcpy(data, blk->data, blk->size); std::memcpy(data, blk->data, blk->size);
} }
/** /**

View file

@ -36,6 +36,7 @@
#ifndef __SPLIT_LIFO_HH__ #ifndef __SPLIT_LIFO_HH__
#define __SPLIT_LIFO_HH__ #define __SPLIT_LIFO_HH__
#include <cstring>
#include <list> #include <list>
#include "mem/cache/cache_blk.hh" // base class #include "mem/cache/cache_blk.hh" // base class
@ -296,7 +297,7 @@ public:
*/ */
void readData(SplitBlk *blk, uint8_t *data) void readData(SplitBlk *blk, uint8_t *data)
{ {
memcpy(data, blk->data, blk->size); std::memcpy(data, blk->data, blk->size);
} }
/** /**

View file

@ -36,6 +36,7 @@
#ifndef __SPLIT_LRU_HH__ #ifndef __SPLIT_LRU_HH__
#define __SPLIT_LRU_HH__ #define __SPLIT_LRU_HH__
#include <cstring>
#include <list> #include <list>
#include "mem/cache/cache_blk.hh" // base class #include "mem/cache/cache_blk.hh" // base class
@ -279,7 +280,7 @@ public:
*/ */
void readData(SplitBlk *blk, uint8_t *data) void readData(SplitBlk *blk, uint8_t *data)
{ {
memcpy(data, blk->data, blk->size); std::memcpy(data, blk->data, blk->size);
} }
/** /**

View file

@ -102,7 +102,7 @@ Kluwer Academic, pages 291-310, March, 2000.
#include "mem/dram.hh" #include "mem/dram.hh"
#include "sim/builder.hh" #include "sim/builder.hh"
#include <stdlib.h>
#include <string> #include <string>
extern int maxThreadsPerCPU; extern int maxThreadsPerCPU;
@ -203,7 +203,7 @@ DRAMMemory::DRAMMemory(Params *p)
last_bank = num_banks+1; last_bank = num_banks+1;
last_row = num_rows; last_row = num_rows;
busy_until = new Tick[num_banks]; busy_until = new Tick[num_banks];
memset(busy_until,0,sizeof(Tick)*num_banks); /* initiliaze */ std::memset(busy_until,0,sizeof(Tick)*num_banks); /* initiliaze */
} }

View file

@ -36,7 +36,7 @@
*/ */
#include <iostream> #include <iostream>
#include <cstring>
#include "base/misc.hh" #include "base/misc.hh"
#include "base/trace.hh" #include "base/trace.hh"
#include "mem/packet.hh" #include "mem/packet.hh"
@ -183,7 +183,7 @@ fixPacket(PacketPtr func, PacketPtr timing)
if (func->isRead()) { if (func->isRead()) {
if (funcStart >= timingStart && funcEnd <= timingEnd) { if (funcStart >= timingStart && funcEnd <= timingEnd) {
func->allocate(); func->allocate();
memcpy(func->getPtr<uint8_t>(), timing->getPtr<uint8_t>() + std::memcpy(func->getPtr<uint8_t>(), timing->getPtr<uint8_t>() +
funcStart - timingStart, func->getSize()); funcStart - timingStart, func->getSize());
func->result = Packet::Success; func->result = Packet::Success;
func->flags |= SATISFIED; func->flags |= SATISFIED;
@ -199,11 +199,11 @@ fixPacket(PacketPtr func, PacketPtr timing)
} }
} else if (func->isWrite()) { } else if (func->isWrite()) {
if (funcStart >= timingStart) { if (funcStart >= timingStart) {
memcpy(timing->getPtr<uint8_t>() + (funcStart - timingStart), std::memcpy(timing->getPtr<uint8_t>() + (funcStart - timingStart),
func->getPtr<uint8_t>(), func->getPtr<uint8_t>(),
(std::min(funcEnd, timingEnd) - funcStart) + 1); (std::min(funcEnd, timingEnd) - funcStart) + 1);
} else { // timingStart > funcStart } else { // timingStart > funcStart
memcpy(timing->getPtr<uint8_t>(), std::memcpy(timing->getPtr<uint8_t>(),
func->getPtr<uint8_t>() + (timingStart - funcStart), func->getPtr<uint8_t>() + (timingStart - funcStart),
(std::min(funcEnd, timingEnd) - timingStart) + 1); (std::min(funcEnd, timingEnd) - timingStart) + 1);
} }

View file

@ -59,7 +59,7 @@ PhysicalMemory::PhysicalMemory(Params *p)
int map_flags = MAP_ANON | MAP_PRIVATE; int map_flags = MAP_ANON | MAP_PRIVATE;
pmemAddr = (uint8_t *)mmap(NULL, params()->addrRange.size(), PROT_READ | PROT_WRITE, pmemAddr = (uint8_t *)mmap(NULL, params()->addrRange.size(), PROT_READ | PROT_WRITE,
map_flags, -1, 0); map_flags, -1, 0);
if (pmemAddr == (void *)MAP_FAILED) { if (pmemAddr == (void *)MAP_FAILED) {
perror("mmap"); perror("mmap");
@ -84,7 +84,7 @@ PhysicalMemory::init()
PhysicalMemory::~PhysicalMemory() PhysicalMemory::~PhysicalMemory()
{ {
if (pmemAddr) if (pmemAddr)
munmap(pmemAddr, params()->addrRange.size()); munmap((char*)pmemAddr, params()->addrRange.size());
//Remove memPorts? //Remove memPorts?
} }
@ -430,7 +430,7 @@ PhysicalMemory::unserialize(Checkpoint *cp, const string &section)
// unmap file that was mmaped in the constructor // unmap file that was mmaped in the constructor
// This is done here to make sure that gzip and open don't muck with our // This is done here to make sure that gzip and open don't muck with our
// nice large space of memory before we reallocate it // nice large space of memory before we reallocate it
munmap(pmemAddr, params()->addrRange.size()); munmap((char*)pmemAddr, params()->addrRange.size());
pmemAddr = (uint8_t *)mmap(NULL, params()->addrRange.size(), PROT_READ | PROT_WRITE, pmemAddr = (uint8_t *)mmap(NULL, params()->addrRange.size(), PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0); MAP_ANON | MAP_PRIVATE, -1, 0);

View file

@ -32,6 +32,7 @@
* @file * @file
* Port object definitions. * Port object definitions.
*/ */
#include <cstring>
#include "base/chunk_generator.hh" #include "base/chunk_generator.hh"
#include "base/trace.hh" #include "base/trace.hh"
@ -78,7 +79,7 @@ Port::memsetBlob(Addr addr, uint8_t val, int size)
// quick and dirty... // quick and dirty...
uint8_t *buf = new uint8_t[size]; uint8_t *buf = new uint8_t[size];
memset(buf, val, size); std::memset(buf, val, size);
blobHelper(addr, buf, size, Packet::WriteReq); blobHelper(addr, buf, size, Packet::WriteReq);
delete [] buf; delete [] buf;

View file

@ -159,7 +159,7 @@ class Port
this function to be called, a DMA interface doesn't really have a this function to be called, a DMA interface doesn't really have a
block size, so it is defaulted to a panic. block size, so it is defaulted to a panic.
*/ */
virtual int deviceBlockSize() { panic("??"); } virtual int deviceBlockSize() { panic("??"); M5_DUMMY_RETURN }
/** The peer port is requesting us to reply with a list of the ranges we /** The peer port is requesting us to reply with a list of the ranges we
are responsible for. are responsible for.
@ -261,8 +261,10 @@ class FunctionalPort : public Port
{} {}
protected: protected:
virtual bool recvTiming(PacketPtr pkt) { panic("FuncPort is UniDir"); } virtual bool recvTiming(PacketPtr pkt) { panic("FuncPort is UniDir");
virtual Tick recvAtomic(PacketPtr pkt) { panic("FuncPort is UniDir"); } M5_DUMMY_RETURN }
virtual Tick recvAtomic(PacketPtr pkt) { panic("FuncPort is UniDir");
M5_DUMMY_RETURN }
virtual void recvFunctional(PacketPtr pkt) { panic("FuncPort is UniDir"); } virtual void recvFunctional(PacketPtr pkt) { panic("FuncPort is UniDir"); }
virtual void recvStatusChange(Status status) {} virtual void recvStatusChange(Status status) {}

View file

@ -47,7 +47,7 @@
// If one doesn't exist, we pretty much get what is listed below, so it all // If one doesn't exist, we pretty much get what is listed below, so it all
// works out // works out
#include <byteswap.h> #include <byteswap.h>
#elif defined (__sun__) #elif defined (__sun)
#include <sys/isa_defs.h> #include <sys/isa_defs.h>
#else #else
#include <machine/endian.h> #include <machine/endian.h>