Merge zizzer:/z/m5/Bitkeeper/m5

into zizzer.eecs.umich.edu:/.automount/zazzer/z/rdreslin/m5bk/timing_L1

--HG--
extra : convert_revision : b75a46439477b3f21333a3cc9f1721923839d14c
This commit is contained in:
Ron Dreslinski 2005-03-10 14:53:34 -05:00
commit aa8c9db159
6 changed files with 92 additions and 91 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2004 The Regents of The University of Michigan
* Copyright (c) 2003-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -245,7 +245,7 @@ class Linux {
strcpy(name->machine, "alpha");
name.copyOut(xc->mem);
return SyscallReturn(0);
return 0;
}
/// Target osf_getsysyinfo() handler. Even though this call is
@ -265,7 +265,7 @@ class Linux {
// I don't think this exactly matches the HW FPCR
*fpcr = 0;
fpcr.copyOut(xc->mem);
return SyscallReturn(0);
return 0;
}
default:
@ -274,7 +274,7 @@ class Linux {
break;
}
return SyscallReturn(1);
return 1;
}
/// Target osf_setsysinfo() handler.
@ -293,7 +293,7 @@ class Linux {
fpcr.copyIn(xc->mem);
DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
" setting FPCR to 0x%x\n", *(uint64_t*)fpcr);
return SyscallReturn(0);
return 0;
}
default:
@ -302,7 +302,7 @@ class Linux {
break;
}
return SyscallReturn(1);
return 1;
}
/// Target fnctl() handler.
@ -313,7 +313,7 @@ class Linux {
int fd = xc->getSyscallArg(0);
if (fd < 0 || process->sim_fd(fd) < 0)
return SyscallReturn(-EBADF);
return -EBADF;
int cmd = xc->getSyscallArg(1);
switch (cmd) {
@ -321,18 +321,18 @@ class Linux {
// if we really wanted to support this, we'd need to do it
// in the target fd space.
warn("fcntl(%d, F_DUPFD) not supported, error returned\n", fd);
return SyscallReturn(-EMFILE);
return -EMFILE;
case 1: // F_GETFD (get close-on-exec flag)
case 2: // F_SETFD (set close-on-exec flag)
return SyscallReturn(0);
return 0;
case 3: // F_GETFL (get file flags)
case 4: // F_SETFL (set file flags)
// not sure if this is totally valid, but we'll pass it through
// to the underlying OS
warn("fcntl(%d, %d) passed through to host\n", fd, cmd);
return SyscallReturn(fcntl(process->sim_fd(fd), cmd));
return fcntl(process->sim_fd(fd), cmd);
// return 0;
case 7: // F_GETLK (get lock)
@ -340,11 +340,11 @@ class Linux {
case 9: // F_SETLKW (set lock and wait)
// don't mess with file locking... just act like it's OK
warn("File lock call (fcntl(%d, %d)) ignored.\n", fd, cmd);
return SyscallReturn(0);
return 0;
default:
warn("Unknown fcntl command %d\n", cmd);
return SyscallReturn(0);
return 0;
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2004 The Regents of The University of Michigan
* Copyright (c) 2001-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -489,7 +489,7 @@ class Tru64 {
strcpy(name->machine, "alpha");
name.copyOut(xc->mem);
return SyscallReturn(0);
return 0;
}
@ -507,21 +507,21 @@ class Tru64 {
TypedBufferArg<uint32_t> max_cpu(xc->getSyscallArg(1));
*max_cpu = process->numCpus();
max_cpu.copyOut(xc->mem);
return SyscallReturn(1);
return 1;
}
case Tru64::GSI_CPUS_IN_BOX: {
TypedBufferArg<uint32_t> cpus_in_box(xc->getSyscallArg(1));
*cpus_in_box = process->numCpus();
cpus_in_box.copyOut(xc->mem);
return SyscallReturn(1);
return 1;
}
case Tru64::GSI_PHYSMEM: {
TypedBufferArg<uint64_t> physmem(xc->getSyscallArg(1));
*physmem = 1024 * 1024; // physical memory in KB
physmem.copyOut(xc->mem);
return SyscallReturn(1);
return 1;
}
case Tru64::GSI_CPU_INFO: {
@ -538,14 +538,14 @@ class Tru64 {
infop->mhz = 667;
infop.copyOut(xc->mem);
return SyscallReturn(1);
return 1;
}
case Tru64::GSI_PROC_TYPE: {
TypedBufferArg<uint64_t> proc_type(xc->getSyscallArg(1));
*proc_type = 11;
proc_type.copyOut(xc->mem);
return SyscallReturn(1);
return 1;
}
case Tru64::GSI_PLATFORM_NAME: {
@ -554,14 +554,14 @@ class Tru64 {
"COMPAQ Professional Workstation XP1000",
nbytes);
bufArg.copyOut(xc->mem);
return SyscallReturn(1);
return 1;
}
case Tru64::GSI_CLK_TCK: {
TypedBufferArg<uint64_t> clk_hz(xc->getSyscallArg(1));
*clk_hz = 1024;
clk_hz.copyOut(xc->mem);
return SyscallReturn(1);
return 1;
}
default:
@ -570,7 +570,7 @@ class Tru64 {
break;
}
return SyscallReturn(0);
return 0;
}
/// Target fnctl() handler.
@ -581,7 +581,7 @@ class Tru64 {
int fd = xc->getSyscallArg(0);
if (fd < 0 || process->sim_fd(fd) < 0)
return SyscallReturn(-EBADF);
return -EBADF;
int cmd = xc->getSyscallArg(1);
switch (cmd) {
@ -589,18 +589,18 @@ class Tru64 {
// if we really wanted to support this, we'd need to do it
// in the target fd space.
warn("fcntl(%d, F_DUPFD) not supported, error returned\n", fd);
return SyscallReturn(-EMFILE);
return -EMFILE;
case 1: // F_GETFD (get close-on-exec flag)
case 2: // F_SETFD (set close-on-exec flag)
return SyscallReturn(0);
return 0;
case 3: // F_GETFL (get file flags)
case 4: // F_SETFL (set file flags)
// not sure if this is totally valid, but we'll pass it through
// to the underlying OS
warn("fcntl(%d, %d) passed through to host\n", fd, cmd);
return SyscallReturn(fcntl(process->sim_fd(fd), cmd));
return fcntl(process->sim_fd(fd), cmd);
// return 0;
case 7: // F_GETLK (get lock)
@ -608,11 +608,11 @@ class Tru64 {
case 9: // F_SETLKW (set lock and wait)
// don't mess with file locking... just act like it's OK
warn("File lock call (fcntl(%d, %d)) ignored.\n", fd, cmd);
return SyscallReturn(0);
return 0;
default:
warn("Unknown fcntl command %d\n", cmd);
return SyscallReturn(0);
return 0;
}
}
@ -638,7 +638,7 @@ class Tru64 {
// check for error
if (host_result < 0) {
delete [] host_buf;
return SyscallReturn(-errno);
return -errno;
}
// no error: copy results back to target space
@ -669,7 +669,7 @@ class Tru64 {
*basep = host_basep;
basep.copyOut(xc->mem);
return SyscallReturn(tgt_buf_ptr - tgt_buf);
return tgt_buf_ptr - tgt_buf;
}
/// Target sigreturn() handler.
@ -695,7 +695,7 @@ class Tru64 {
regs->miscRegs.fpcr = sc->sc_fpcr;
return SyscallReturn(0);
return 0;
}
/// Target table() handler.
@ -712,7 +712,7 @@ class Tru64 {
switch (id) {
case Tru64::TBL_SYSINFO: {
if (index != 0 || nel != 1 || lel != sizeof(Tru64::tbl_sysinfo))
return SyscallReturn(-EINVAL);
return -EINVAL;
TypedBufferArg<Tru64::tbl_sysinfo> elp(xc->getSyscallArg(2));
const int clk_hz = one_million;
@ -726,12 +726,12 @@ class Tru64 {
elp->si_boottime = seconds_since_epoch; // seconds since epoch?
elp->si_max_procs = process->numCpus();
elp.copyOut(xc->mem);
return SyscallReturn(0);
return 0;
}
default:
cerr << "table(): id " << id << " unknown." << endl;
return SyscallReturn(-EINVAL);
return -EINVAL;
}
}
@ -766,7 +766,7 @@ class Tru64 {
argp.copyOut(xc->mem);
}
return SyscallReturn(0);
return 0;
}
/// NXM library version stamp.
@ -877,7 +877,7 @@ class Tru64 {
*configptr_ptr = config_addr;
configptr_ptr.copyOut(xc->mem);
return SyscallReturn(0);
return 0;
}
/// Initialize execution context.
@ -946,7 +946,7 @@ class Tru64 {
*kidp = 99;
kidp.copyOut(xc->mem);
return SyscallReturn(0);
return 0;
} else if (attrp->type == Tru64::NXM_TYPE_VP) {
// A real "virtual processor" kernel thread. Need to fork
// this thread on another CPU.
@ -994,7 +994,7 @@ class Tru64 {
*kidp = thread_index;
kidp.copyOut(xc->mem);
return SyscallReturn(0);
return 0;
}
}
@ -1007,7 +1007,7 @@ class Tru64 {
abort();
}
return SyscallReturn(0);
return 0;
}
/// Thread idle call (like yield()).
@ -1015,7 +1015,7 @@ class Tru64 {
nxm_idleFunc(SyscallDesc *desc, int callnum, Process *process,
ExecContext *xc)
{
return SyscallReturn(0);
return 0;
}
/// Block thread.
@ -1032,7 +1032,7 @@ class Tru64 {
cout << xc->cpu->name() << ": nxm_thread_block " << tid << " " << secs
<< " " << flags << " " << action << " " << usecs << endl;
return SyscallReturn(0);
return 0;
}
/// block.
@ -1053,7 +1053,7 @@ class Tru64 {
<< " " << secs << " " << usecs
<< " " << flags << endl;
return SyscallReturn(0);
return 0;
}
/// Unblock thread.
@ -1066,7 +1066,7 @@ class Tru64 {
cout << xc->cpu->name() << ": nxm_unblock "
<< hex << uaddr << dec << endl;
return SyscallReturn(0);
return 0;
}
/// Switch thread priority.
@ -1081,7 +1081,7 @@ class Tru64 {
//
// Since we assume at most one "kernel" thread per CPU, it's
// always safe to return false here.
return SyscallReturn(0); //false;
return 0; //false;
}
@ -1165,7 +1165,7 @@ class Tru64 {
// Return 0 since we will always return to the user with the lock
// acquired. We will just keep the context inactive until that is
// true.
return SyscallReturn(0);
return 0;
}
/// Try lock (non-blocking).
@ -1182,9 +1182,9 @@ class Tru64 {
// lock is free: grab it
*lockp = 1;
lockp.copyOut(xc->mem);
return SyscallReturn(0);
return 0;
} else {
return SyscallReturn(1);
return 1;
}
}
@ -1197,7 +1197,7 @@ class Tru64 {
m5_unlock_mutex(uaddr, process, xc);
return SyscallReturn(0);
return 0;
}
/// Signal ocndition.
@ -1210,7 +1210,7 @@ class Tru64 {
// Wake up one process waiting on the condition variable.
activate_waiting_context(cond_addr, process);
return SyscallReturn(0);
return 0;
}
/// Wake up all processes waiting on the condition variable.
@ -1222,7 +1222,7 @@ class Tru64 {
activate_waiting_context(cond_addr, process, true);
return SyscallReturn(0);
return 0;
}
/// Wait on a condition.
@ -1244,7 +1244,7 @@ class Tru64 {
process->waitList.push_back(Process::WaitRec(cond_addr, xc));
xc->suspend();
return SyscallReturn(0);
return 0;
}
/// Thread exit.
@ -1255,7 +1255,7 @@ class Tru64 {
assert(xc->status() == ExecContext::Active);
xc->deallocate();
return SyscallReturn(0);
return 0;
}
/// Array of syscall descriptors for Mach syscalls, indexed by
@ -1302,7 +1302,7 @@ class Tru64 {
doSyscall(new_callnum, process, xc);
return SyscallReturn(0);
return 0;
}
}; // class Tru64

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2004 The Regents of The University of Michigan
* Copyright (c) 2003-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2004 The Regents of The University of Michigan
* Copyright (c) 2003-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -79,7 +79,7 @@ ignoreFunc(SyscallDesc *desc, int callnum, Process *process,
<< ", " << xc->getSyscallArg(1)
<< ", ...)" << endl;
return SyscallReturn(0);
return 0;
}
@ -89,14 +89,14 @@ exitFunc(SyscallDesc *desc, int callnum, Process *process,
{
new SimExitEvent("syscall caused exit", xc->getSyscallArg(0) & 0xff);
return SyscallReturn(1);
return 1;
}
SyscallReturn
getpagesizeFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{
return SyscallReturn(VMPageSize);
return VMPageSize;
}
@ -109,7 +109,8 @@ obreakFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{
p->brk_point = xc->getSyscallArg(0);
}
return SyscallReturn(p->brk_point);
DPRINTF(SyscallVerbose, "Break Point changed to: %#X\n", p->brk_point);
return p->brk_point;
}
@ -117,7 +118,7 @@ SyscallReturn
closeFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{
int fd = p->sim_fd(xc->getSyscallArg(0));
return SyscallReturn(close(fd));
return close(fd);
}
@ -133,7 +134,7 @@ readFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
if (bytes_read != -1)
bufArg.copyOut(xc->mem);
return SyscallReturn(bytes_read);
return bytes_read;
}
SyscallReturn
@ -149,7 +150,7 @@ writeFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
fsync(fd);
return SyscallReturn(bytes_written);
return bytes_written;
}
@ -162,8 +163,7 @@ lseekFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
off_t result = lseek(fd, offs, whence);
return (result == (off_t)-1) ? SyscallReturn(-errno) :
SyscallReturn(result);
return (result == (off_t)-1) ? -errno : result;
}
@ -171,7 +171,7 @@ SyscallReturn
munmapFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{
// given that we don't really implement mmap, munmap is really easy
return SyscallReturn(0);
return 0;
}
@ -187,7 +187,7 @@ gethostnameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
name.copyOut(xc->mem);
return SyscallReturn(0);
return 0;
}
SyscallReturn
@ -199,7 +199,7 @@ unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
return (TheISA::IntReg)-EFAULT;
int result = unlink(path.c_str());
return (result == -1) ? SyscallReturn(-errno) : SyscallReturn(result);
return (result == -1) ? -errno : result;
}
SyscallReturn
@ -208,14 +208,14 @@ renameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
std::string old_name;
if (xc->mem->readString(old_name, xc->getSyscallArg(0)) != No_Fault)
return SyscallReturn(-EFAULT);
return -EFAULT;
std::string new_name;
if (xc->mem->readString(new_name, xc->getSyscallArg(1)) != No_Fault)
return SyscallReturn(-EFAULT);
return -EFAULT;
int64_t result = rename(old_name.c_str(),new_name.c_str());
return (result == -1) ? SyscallReturn(-errno) : SyscallReturn(result);
return (result == -1) ? -errno : result;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2004 The Regents of The University of Michigan
* Copyright (c) 2003-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -251,7 +251,7 @@ ioctlFunc(SyscallDesc *desc, int callnum, Process *process,
if (fd < 0 || process->sim_fd(fd) < 0) {
// doesn't map to any simulator fd: not a valid target fd
return SyscallReturn(-EBADF);
return -EBADF;
}
switch (req) {
@ -263,7 +263,7 @@ ioctlFunc(SyscallDesc *desc, int callnum, Process *process,
case OS::TIOCGETC:
case OS::TIOCGETS:
case OS::TIOCGETA:
return SyscallReturn(-ENOTTY);
return -ENOTTY;
default:
fatal("Unsupported ioctl call: ioctl(%d, 0x%x, ...) @ 0x%llx\n", fd, req, xc->readPC());
@ -279,13 +279,13 @@ openFunc(SyscallDesc *desc, int callnum, Process *process,
std::string path;
if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault)
return SyscallReturn(-EFAULT);
return -EFAULT;
if (path == "/dev/sysdev0") {
// This is a memory-mapped high-resolution timer device on Alpha.
// We don't support it, so just punt.
DCOUT(SyscallWarnings) << "Ignoring open(" << path << ", ...)" << std::endl;
return SyscallReturn(-ENOENT);
return -ENOENT;
}
int tgtFlags = xc->getSyscallArg(1);
@ -311,7 +311,7 @@ openFunc(SyscallDesc *desc, int callnum, Process *process,
// open the file
int fd = open(path.c_str(), hostFlags, mode);
return (fd == -1) ? SyscallReturn(-errno) : SyscallReturn(process->open_fd(fd));
return (fd == -1) ? -errno : process->open_fd(fd);
}
@ -324,17 +324,17 @@ statFunc(SyscallDesc *desc, int callnum, Process *process,
std::string path;
if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault)
return SyscallReturn(-EFAULT);
return -EFAULT;
struct stat hostBuf;
int result = stat(path.c_str(), &hostBuf);
if (result < 0)
return SyscallReturn(errno);
return errno;
OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
return SyscallReturn(0);
return 0;
}
@ -347,17 +347,17 @@ lstatFunc(SyscallDesc *desc, int callnum, Process *process,
std::string path;
if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault)
return SyscallReturn(-EFAULT);
return -EFAULT;
struct stat hostBuf;
int result = lstat(path.c_str(), &hostBuf);
if (result < 0)
return SyscallReturn(-errno);
return -errno;
OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
return SyscallReturn(0);
return 0;
}
/// Target fstat() handler.
@ -371,17 +371,17 @@ fstatFunc(SyscallDesc *desc, int callnum, Process *process,
// DPRINTFR(SyscallVerbose, "fstat(%d, ...)\n", fd);
if (fd < 0)
return SyscallReturn(-EBADF);
return -EBADF;
struct stat hostBuf;
int result = fstat(fd, &hostBuf);
if (result < 0)
return SyscallReturn(-errno);
return -errno;
OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
return SyscallReturn(0);
return 0;
}
@ -419,7 +419,7 @@ mmapFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
"This will break if not /dev/zero.", xc->getSyscallArg(4));
}
return SyscallReturn(start);
return start;
}
/// Target getrlimit() handler.
@ -444,7 +444,7 @@ getrlimitFunc(SyscallDesc *desc, int callnum, Process *process,
}
rlp.copyOut(xc->mem);
return SyscallReturn(0);
return 0;
}
/// Target gettimeofday() handler.
@ -460,7 +460,7 @@ gettimeofdayFunc(SyscallDesc *desc, int callnum, Process *process,
tp.copyOut(xc->mem);
return SyscallReturn(0);
return 0;
}
@ -501,7 +501,7 @@ getrusageFunc(SyscallDesc *desc, int callnum, Process *process,
rup.copyOut(xc->mem);
return SyscallReturn(0);
return 0;
}
#endif // __SIM_SYSCALL_EMUL_HH__

View file

@ -34,7 +34,6 @@ sys.path.append(joinpath(mypath, '../util/pbs'))
sys.path.append(joinpath(mypath, '../sim/pyconfig'))
from importer import AddToPath, LoadMpyFile
from m5config import *
AddToPath('.')
@ -49,12 +48,14 @@ try:
else:
name = arg[:offset]
value = arg[offset+1:]
env[name] = value
os.environ[name] = value
if opt == '-I':
AddToPath(arg)
except getopt.GetoptError:
sys.exit('Improper Usage')
from m5config import *
for arg in args:
LoadMpyFile(arg)