Merge zizzer:/bk/newmem
into zeep.eecs.umich.edu:/z/saidi/work/m5.newmem --HG-- extra : convert_revision : 9b628a0ee157657ac76c3a9455108d033c125822
This commit is contained in:
@@ -1,32 +1,42 @@
|
||||
from m5 import *
|
||||
import os, sys
|
||||
from os.path import isdir, join as joinpath
|
||||
from os import environ as env
|
||||
|
||||
import os.path
|
||||
import sys
|
||||
systemdir = None
|
||||
bindir = None
|
||||
diskdir = None
|
||||
scriptdir = None
|
||||
|
||||
# Edit the following list to include the possible paths to the binary
|
||||
# and disk image directories. The first directory on the list that
|
||||
# exists will be selected.
|
||||
SYSTEMDIR_PATH = ['/n/poolfs/z/dist/m5/system']
|
||||
def load_defaults():
|
||||
global systemdir, bindir, diskdir, scriptdir
|
||||
if not systemdir:
|
||||
try:
|
||||
path = env['M5_PATH'].split(':')
|
||||
except KeyError:
|
||||
path = [ '/dist/m5/system' ]
|
||||
|
||||
SYSTEMDIR = None
|
||||
for d in SYSTEMDIR_PATH:
|
||||
if os.path.exists(d):
|
||||
SYSTEMDIR = d
|
||||
break
|
||||
for systemdir in path:
|
||||
if os.path.isdir(systemdir):
|
||||
break
|
||||
else:
|
||||
raise ImportError, "Can't find a path to system files."
|
||||
|
||||
if not SYSTEMDIR:
|
||||
print >>sys.stderr, "Can't find a path to system files."
|
||||
sys.exit(1)
|
||||
|
||||
BINDIR = SYSTEMDIR + '/binaries'
|
||||
DISKDIR = SYSTEMDIR + '/disks'
|
||||
if not bindir:
|
||||
bindir = joinpath(systemdir, 'binaries')
|
||||
if not diskdir:
|
||||
diskdir = joinpath(systemdir, 'disks')
|
||||
if not scriptdir:
|
||||
scriptdir = joinpath(systemdir, 'boot')
|
||||
|
||||
def disk(file):
|
||||
return os.path.join(DISKDIR, file)
|
||||
load_defaults()
|
||||
return joinpath(diskdir, file)
|
||||
|
||||
def binary(file):
|
||||
return os.path.join(BINDIR, file)
|
||||
load_defaults()
|
||||
return joinpath(bindir, file)
|
||||
|
||||
def script(file):
|
||||
return os.path.join(SYSTEMDIR, 'boot', file)
|
||||
load_defaults()
|
||||
return joinpath(scriptdir, file)
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Ali Saidi
|
||||
* Nathan Binkert
|
||||
*/
|
||||
|
||||
#include "arch/alpha/ev5.hh"
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Ali Saidi
|
||||
* Nathan Binkert
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_ALPHA_SYSTEM_HH__
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Kevin Lim
|
||||
* Authors: Nathan Binkert
|
||||
* Kevin Lim
|
||||
*/
|
||||
|
||||
#ifndef __BASE_TIMEBUF_HH__
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Lisa Hsu
|
||||
* Authors: Nathan Binkert
|
||||
* Lisa Hsu
|
||||
*/
|
||||
|
||||
/** @file
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Lisa Hsu
|
||||
* Authors: Nathan Binkert
|
||||
* Lisa Hsu
|
||||
*/
|
||||
|
||||
/** @file
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Andrew Schultz
|
||||
* Nathan Binkert
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Ali Saidi
|
||||
* Authors: Nathan Binkert
|
||||
* Ali Saidi
|
||||
*/
|
||||
|
||||
#include "arch/arguments.hh"
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Ali Saidi
|
||||
* Authors: Nathan Binkert
|
||||
* Ali Saidi
|
||||
*/
|
||||
|
||||
#ifndef __KERN_LINUX_EVENTS_HH__
|
||||
|
||||
@@ -69,7 +69,7 @@ class Linux {
|
||||
typedef uint32_t gid_t;
|
||||
//@}
|
||||
|
||||
#if BSD_HOST
|
||||
#if NO_STAT64
|
||||
typedef struct stat hst_stat;
|
||||
typedef struct stat hst_stat64;
|
||||
#else
|
||||
@@ -176,7 +176,7 @@ class Linux {
|
||||
/// Helper function to convert a host stat buffer to a target stat
|
||||
/// buffer. Also copies the target buffer out to the simulated
|
||||
/// memory space. Used by stat(), fstat(), and lstat().
|
||||
#if !BSD_HOST
|
||||
#if !NO_STAT64
|
||||
static void
|
||||
copyOutStatBuf(TranslatingPort *mem, Addr addr, hst_stat *host)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Ali Saidi
|
||||
* Authors: Nathan Binkert
|
||||
* Ali Saidi
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Ali Saidi
|
||||
* Authors: Nathan Binkert
|
||||
* Ali Saidi
|
||||
*/
|
||||
|
||||
#ifndef __PRINTK_HH__
|
||||
|
||||
@@ -74,7 +74,7 @@ class Solaris {
|
||||
typedef uint32_t nlink_t;
|
||||
//@}
|
||||
|
||||
#if BSD_HOST
|
||||
#if NO_STAT64
|
||||
typedef struct stat hst_stat;
|
||||
typedef struct stat hst_stat64;
|
||||
#else
|
||||
@@ -177,7 +177,7 @@ class Solaris {
|
||||
/// Helper function to convert a host stat buffer to a target stat
|
||||
/// buffer. Also copies the target buffer out to the simulated
|
||||
/// memory space. Used by stat(), fstat(), and lstat().
|
||||
#if !BSD_HOST
|
||||
#if !NO_STAT64
|
||||
static void
|
||||
copyOutStatBuf(TranslatingPort *mem, Addr addr, hst_stat *host)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Lisa Hsu
|
||||
* Authors: Nathan Binkert
|
||||
* Lisa Hsu
|
||||
* Ali Saidi
|
||||
*/
|
||||
|
||||
|
||||
@@ -91,25 +91,23 @@ swap_byte16(uint16_t x)
|
||||
#endif
|
||||
}
|
||||
|
||||
//This lets the compiler figure out how to call the swap_byte functions above
|
||||
//for different data types.
|
||||
static inline uint64_t swap_byte(uint64_t x) {return swap_byte64(x);}
|
||||
static inline int64_t swap_byte(int64_t x) {return swap_byte64((uint64_t)x);}
|
||||
static inline uint32_t swap_byte(uint32_t x) {return swap_byte32(x);}
|
||||
static inline int32_t swap_byte(int32_t x) {return swap_byte32((uint32_t)x);}
|
||||
//This is to prevent the following two functions from compiling on
|
||||
//64bit machines. It won't detect everything, so it should be changed.
|
||||
#ifndef __x86_64__
|
||||
static inline long swap_byte(long x) {return swap_byte32((long)x);}
|
||||
static inline unsigned long swap_byte(unsigned long x)
|
||||
{ return swap_byte32((unsigned long)x);}
|
||||
#endif
|
||||
static inline uint16_t swap_byte(uint16_t x) {return swap_byte32(x);}
|
||||
static inline int16_t swap_byte(int16_t x) {return swap_byte16((uint16_t)x);}
|
||||
static inline uint8_t swap_byte(uint8_t x) {return x;}
|
||||
static inline int8_t swap_byte(int8_t x) {return x;}
|
||||
static inline double swap_byte(double x) {return swap_byte64((uint64_t)x);}
|
||||
static inline float swap_byte(float x) {return swap_byte32((uint32_t)x);}
|
||||
// This function lets the compiler figure out how to call the
|
||||
// swap_byte functions above for different data types. Since the
|
||||
// sizeof() values are known at compiel time, it should inline to a
|
||||
// direct call to the right swap_byteNN() function.
|
||||
template <typename T>
|
||||
static inline T swap_byte(T x) {
|
||||
if (sizeof(T) == 8)
|
||||
return swap_byte64((uint64_t)x);
|
||||
else if (sizeof(T) == 4)
|
||||
return swap_byte32((uint32_t)x);
|
||||
else if (sizeof(T) == 2)
|
||||
return swap_byte16((uint16_t)x);
|
||||
else if (sizeof(T) == 1)
|
||||
return x;
|
||||
else
|
||||
panic("Can't byte-swap values larger than 64 bits");
|
||||
}
|
||||
|
||||
//The conversion functions with fixed endianness on both ends don't need to
|
||||
//be in a namespace
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Erik Hallnor
|
||||
* Authors: Nathan Binkert
|
||||
* Erik Hallnor
|
||||
* Steve Reinhardt
|
||||
*/
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors: Erik Hallnor
|
||||
* Authors: Nathan Binkert
|
||||
* Erik Hallnor
|
||||
* Steve Reinhardt
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
#ifndef __SIM_SYSCALL_EMUL_HH__
|
||||
#define __SIM_SYSCALL_EMUL_HH__
|
||||
|
||||
#define BSD_HOST (defined(__APPLE__) || defined(__OpenBSD__) || \
|
||||
defined(__FreeBSD__))
|
||||
#define NO_STAT64 (defined(__APPLE__) || defined(__OpenBSD__) || \
|
||||
defined(__FreeBSD__) || defined(__CYGWIN__))
|
||||
|
||||
///
|
||||
/// @file syscall_emul.hh
|
||||
@@ -507,7 +507,7 @@ fstat64Func(SyscallDesc *desc, int callnum, Process *process,
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
#if BSD_HOST
|
||||
#if NO_STAT64
|
||||
struct stat hostBuf;
|
||||
int result = fstat(process->sim_fd(fd), &hostBuf);
|
||||
#else
|
||||
@@ -557,7 +557,7 @@ lstat64Func(SyscallDesc *desc, int callnum, Process *process,
|
||||
if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0)))
|
||||
return -EFAULT;
|
||||
|
||||
#if BSD_HOST
|
||||
#if NO_STAT64
|
||||
struct stat hostBuf;
|
||||
int result = lstat(path.c_str(), &hostBuf);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user