/*
- * 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
strcpy(name->machine, "alpha");
name.copyOut(xc->mem);
- return SyscallReturn(0);
+ return 0;
}
/// Target osf_getsysyinfo() handler. Even though this call is
// I don't think this exactly matches the HW FPCR
*fpcr = 0;
fpcr.copyOut(xc->mem);
- return SyscallReturn(0);
+ return 0;
}
default:
break;
}
- return SyscallReturn(1);
+ return 1;
}
/// Target osf_setsysinfo() handler.
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:
break;
}
- return SyscallReturn(1);
+ return 1;
}
/// Target fnctl() handler.
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) {
// 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)
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;
}
}
/*
- * 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
strcpy(name->machine, "alpha");
name.copyOut(xc->mem);
- return SyscallReturn(0);
+ return 0;
}
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: {
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: {
"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:
break;
}
- return SyscallReturn(0);
+ return 0;
}
/// Target fnctl() handler.
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) {
// 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)
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;
}
}
// check for error
if (host_result < 0) {
delete [] host_buf;
- return SyscallReturn(-errno);
+ return -errno;
}
// no error: copy results back to target space
*basep = host_basep;
basep.copyOut(xc->mem);
- return SyscallReturn(tgt_buf_ptr - tgt_buf);
+ return tgt_buf_ptr - tgt_buf;
}
/// Target sigreturn() handler.
regs->miscRegs.fpcr = sc->sc_fpcr;
- return SyscallReturn(0);
+ return 0;
}
/// Target table() handler.
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;
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;
}
}
argp.copyOut(xc->mem);
}
- return SyscallReturn(0);
+ return 0;
}
/// NXM library version stamp.
*configptr_ptr = config_addr;
configptr_ptr.copyOut(xc->mem);
- return SyscallReturn(0);
+ return 0;
}
/// Initialize execution context.
*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.
*kidp = thread_index;
kidp.copyOut(xc->mem);
- return SyscallReturn(0);
+ return 0;
}
}
abort();
}
- return SyscallReturn(0);
+ return 0;
}
/// Thread idle call (like yield()).
nxm_idleFunc(SyscallDesc *desc, int callnum, Process *process,
ExecContext *xc)
{
- return SyscallReturn(0);
+ return 0;
}
/// Block thread.
cout << xc->cpu->name() << ": nxm_thread_block " << tid << " " << secs
<< " " << flags << " " << action << " " << usecs << endl;
- return SyscallReturn(0);
+ return 0;
}
/// block.
<< " " << secs << " " << usecs
<< " " << flags << endl;
- return SyscallReturn(0);
+ return 0;
}
/// Unblock thread.
cout << xc->cpu->name() << ": nxm_unblock "
<< hex << uaddr << dec << endl;
- return SyscallReturn(0);
+ return 0;
}
/// Switch thread priority.
//
// 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;
}
// 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).
// lock is free: grab it
*lockp = 1;
lockp.copyOut(xc->mem);
- return SyscallReturn(0);
+ return 0;
} else {
- return SyscallReturn(1);
+ return 1;
}
}
m5_unlock_mutex(uaddr, process, xc);
- return SyscallReturn(0);
+ return 0;
}
/// Signal ocndition.
// 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.
activate_waiting_context(cond_addr, process, true);
- return SyscallReturn(0);
+ return 0;
}
/// Wait on a condition.
process->waitList.push_back(Process::WaitRec(cond_addr, xc));
xc->suspend();
- return SyscallReturn(0);
+ return 0;
}
/// Thread exit.
assert(xc->status() == ExecContext::Active);
xc->deallocate();
- return SyscallReturn(0);
+ return 0;
}
/// Array of syscall descriptors for Mach syscalls, indexed by
doSyscall(new_callnum, process, xc);
- return SyscallReturn(0);
+ return 0;
}
}; // class Tru64
/*
- * 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
/*
- * 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
<< ", " << xc->getSyscallArg(1)
<< ", ...)" << endl;
- return SyscallReturn(0);
+ return 0;
}
{
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;
}
{
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;
}
closeFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{
int fd = p->sim_fd(xc->getSyscallArg(0));
- return SyscallReturn(close(fd));
+ return close(fd);
}
if (bytes_read != -1)
bufArg.copyOut(xc->mem);
- return SyscallReturn(bytes_read);
+ return bytes_read;
}
SyscallReturn
fsync(fd);
- return SyscallReturn(bytes_written);
+ return bytes_written;
}
off_t result = lseek(fd, offs, whence);
- return (result == (off_t)-1) ? SyscallReturn(-errno) :
- SyscallReturn(result);
+ return (result == (off_t)-1) ? -errno : result;
}
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;
}
name.copyOut(xc->mem);
- return SyscallReturn(0);
+ return 0;
}
SyscallReturn
return (TheISA::IntReg)-EFAULT;
int result = unlink(path.c_str());
- return (result == -1) ? SyscallReturn(-errno) : SyscallReturn(result);
+ return (result == -1) ? -errno : result;
}
SyscallReturn
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;
}
/*
- * 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
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) {
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());
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);
// 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);
}
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;
}
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.
// 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;
}
"This will break if not /dev/zero.", xc->getSyscallArg(4));
}
- return SyscallReturn(start);
+ return start;
}
/// Target getrlimit() handler.
}
rlp.copyOut(xc->mem);
- return SyscallReturn(0);
+ return 0;
}
/// Target gettimeofday() handler.
tp.copyOut(xc->mem);
- return SyscallReturn(0);
+ return 0;
}
rup.copyOut(xc->mem);
- return SyscallReturn(0);
+ return 0;
}
#endif // __SIM_SYSCALL_EMUL_HH__