fixes so that M5 will compile under solaris
SConstruct: Add check to see if we need to include libsocket src/arch/sparc/floatregfile.cc: src/arch/sparc/intregfile.cc: use memset rather than bzero and include the appropriate headerfile src/base/pollevent.cc: If we're compling under solaris we need sys/file.h src/base/random.cc: src/base/random.hh: solaris doesn't have random(), so use rint with the correct rounding mode if we're compiling on solaris src/base/stats/flags.hh: u_int32_t?? src/base/time.hh: grab the timersub() define from freebsd since it doesn't exist in solaris src/cpu/inst_seq.hh: we don't need to include stdint here src/sim/byteswap.hh: the method to detect endianness on Solaris is a little more complex... --HG-- extra : convert_revision : 6b7db0e900e7bccfc250d65c125065f27280dda1
This commit is contained in:
parent
683d8f0831
commit
21cf4a46b9
10 changed files with 87 additions and 9 deletions
|
@ -270,6 +270,12 @@ if not conf.CheckLib(py_version_name):
|
|||
print "Error: can't find Python library", py_version_name
|
||||
Exit(1)
|
||||
|
||||
# On Solaris you need to use libsocket for socket ops
|
||||
if not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C', 'accept(0,NULL,NULL);'):
|
||||
if not conf.CheckLibWithHeader('socket', 'sys/socket.h', 'C', 'accept(0,NULL,NULL);'):
|
||||
print "Can't find library with socket calls (e.g. accept())"
|
||||
Exit(1)
|
||||
|
||||
# Check for zlib. If the check passes, libz will be automatically
|
||||
# added to the LIBS environment variable.
|
||||
if not conf.CheckLibWithHeader('z', 'zlib.h', 'C++'):
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include "sim/byteswap.hh"
|
||||
#include "sim/serialize.hh"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
using namespace SparcISA;
|
||||
using namespace std;
|
||||
|
||||
|
@ -55,7 +57,7 @@ string SparcISA::getFloatRegName(RegIndex index)
|
|||
|
||||
void FloatRegFile::clear()
|
||||
{
|
||||
bzero(regSpace, sizeof(regSpace));
|
||||
memset(regSpace, 0, sizeof(regSpace));
|
||||
}
|
||||
|
||||
FloatReg FloatRegFile::readReg(int floatReg, int width)
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "base/trace.hh"
|
||||
#include "sim/serialize.hh"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
using namespace SparcISA;
|
||||
using namespace std;
|
||||
|
||||
|
@ -62,7 +64,7 @@ void IntRegFile::clear()
|
|||
for (x = 0; x < MaxGL; x++)
|
||||
memset(regGlobals[x], 0, sizeof(IntReg) * RegsPerFrame);
|
||||
for(int x = 0; x < 2 * NWindows; x++)
|
||||
bzero(regSegments[x], sizeof(IntReg) * RegsPerFrame);
|
||||
memset(regSegments[x], 0, sizeof(IntReg) * RegsPerFrame);
|
||||
}
|
||||
|
||||
IntRegFile::IntRegFile()
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#if defined(__sun__)
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
|
||||
#if defined(__sun__)
|
||||
#include <ieeefp.h>
|
||||
#endif
|
||||
|
||||
#include "sim/param.hh"
|
||||
#include "base/random.hh"
|
||||
#include "base/trace.hh"
|
||||
|
@ -65,12 +69,27 @@ getLong()
|
|||
return mrand48();
|
||||
}
|
||||
|
||||
double
|
||||
m5round(double r)
|
||||
{
|
||||
#if defined(__sun__)
|
||||
double val;
|
||||
fp_rnd oldrnd = fpsetround(FP_RN);
|
||||
val = rint(r);
|
||||
fpsetround(oldrnd);
|
||||
return val;
|
||||
#else
|
||||
return round(r);
|
||||
#endif
|
||||
}
|
||||
|
||||
int64_t
|
||||
getUniform(int64_t min, int64_t max)
|
||||
{
|
||||
double r;
|
||||
r = drand48() * (max-min) + min;
|
||||
return (int64_t)round(r);
|
||||
|
||||
return (int64_t)m5round(r);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
|
@ -78,7 +97,8 @@ getUniformPos(uint64_t min, uint64_t max)
|
|||
{
|
||||
double r;
|
||||
r = drand48() * (max-min) + min;
|
||||
return (uint64_t)round(r);
|
||||
|
||||
return (uint64_t)m5round(r);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
long getLong();
|
||||
double getDouble();
|
||||
double m5random(double r);
|
||||
uint64_t getUniformPos(uint64_t min, uint64_t max);
|
||||
int64_t getUniform(int64_t min, int64_t max);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Stats {
|
|||
* Define the storage for format flags.
|
||||
* @todo Can probably shrink this.
|
||||
*/
|
||||
typedef u_int32_t StatFlags;
|
||||
typedef uint32_t StatFlags;
|
||||
|
||||
/** Nothing extra to print. */
|
||||
const StatFlags none = 0x00000000;
|
||||
|
|
|
@ -65,4 +65,48 @@ Time operator-(const Time &l, const Time &r);
|
|||
|
||||
std::ostream &operator<<(std::ostream &out, const Time &time);
|
||||
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)time.h 8.2 (Berkeley) 7/10/94
|
||||
*/
|
||||
|
||||
#if defined(__sun__)
|
||||
#define timersub(tvp, uvp, vvp) \
|
||||
do { \
|
||||
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
|
||||
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
|
||||
if ((vvp)->tv_usec < 0) { \
|
||||
(vvp)->tv_sec--; \
|
||||
(vvp)->tv_usec += 1000000; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif // __SIM_TIME_HH__
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
#ifndef __STD_TYPES_HH__
|
||||
#define __STD_TYPES_HH__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// inst sequence type, used to order instructions in the ready list,
|
||||
// if this rolls over the ready list order temporarily will get messed
|
||||
// up, but execution will continue and complete correctly
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
// If one doesn't exist, we pretty much get what is listed below, so it all
|
||||
// works out
|
||||
#include <byteswap.h>
|
||||
#elif defined (__sun__)
|
||||
#include <sys/isa_defs.h>
|
||||
#else
|
||||
#include <machine/endian.h>
|
||||
#endif
|
||||
|
@ -128,12 +130,12 @@ template <typename T> static inline T letobe(T value) {return swap_byte(value);}
|
|||
|
||||
//For conversions not involving the guest system, we can define the functions
|
||||
//conditionally based on the BYTE_ORDER macro and outside of the namespaces
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#if defined(_BIG_ENDIAN) || BYTE_ORDER == BIG_ENDIAN
|
||||
template <typename T> static inline T htole(T value) {return swap_byte(value);}
|
||||
template <typename T> static inline T letoh(T value) {return swap_byte(value);}
|
||||
template <typename T> static inline T htobe(T value) {return value;}
|
||||
template <typename T> static inline T betoh(T value) {return value;}
|
||||
#elif BYTE_ORDER == LITTLE_ENDIAN
|
||||
#elif defined(_LITTLE_ENDIAN) || BYTE_ORDER == LITTLE_ENDIAN
|
||||
template <typename T> static inline T htole(T value) {return value;}
|
||||
template <typename T> static inline T letoh(T value) {return value;}
|
||||
template <typename T> static inline T htobe(T value) {return swap_byte(value);}
|
||||
|
|
Loading…
Reference in a new issue