Removed unecessary constructor call at each return.

arch/alpha/isa_traits.hh:
    updated copyright date

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

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. * 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
@ -79,7 +79,7 @@ ignoreFunc(SyscallDesc *desc, int callnum, Process *process,
<< ", " << xc->getSyscallArg(1) << ", " << xc->getSyscallArg(1)
<< ", ...)" << endl; << ", ...)" << 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); new SimExitEvent("syscall caused exit", xc->getSyscallArg(0) & 0xff);
return SyscallReturn(1); return 1;
} }
SyscallReturn SyscallReturn
getpagesizeFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) 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); 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) closeFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{ {
int fd = p->sim_fd(xc->getSyscallArg(0)); 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) if (bytes_read != -1)
bufArg.copyOut(xc->mem); bufArg.copyOut(xc->mem);
return SyscallReturn(bytes_read); return bytes_read;
} }
SyscallReturn SyscallReturn
@ -149,7 +150,7 @@ writeFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
fsync(fd); 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); off_t result = lseek(fd, offs, whence);
return (result == (off_t)-1) ? SyscallReturn(-errno) : return (result == (off_t)-1) ? -errno : result;
SyscallReturn(result);
} }
@ -171,7 +171,7 @@ SyscallReturn
munmapFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) munmapFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{ {
// given that we don't really implement mmap, munmap is really easy // 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); name.copyOut(xc->mem);
return SyscallReturn(0); return 0;
} }
SyscallReturn SyscallReturn
@ -199,7 +199,7 @@ unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
return (TheISA::IntReg)-EFAULT; return (TheISA::IntReg)-EFAULT;
int result = unlink(path.c_str()); int result = unlink(path.c_str());
return (result == -1) ? SyscallReturn(-errno) : SyscallReturn(result); return (result == -1) ? -errno : result;
} }
SyscallReturn SyscallReturn
@ -208,14 +208,14 @@ renameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
std::string old_name; std::string old_name;
if (xc->mem->readString(old_name, xc->getSyscallArg(0)) != No_Fault) if (xc->mem->readString(old_name, xc->getSyscallArg(0)) != No_Fault)
return SyscallReturn(-EFAULT); return -EFAULT;
std::string new_name; std::string new_name;
if (xc->mem->readString(new_name, xc->getSyscallArg(1)) != No_Fault) 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()); 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. * 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
@ -251,7 +251,7 @@ ioctlFunc(SyscallDesc *desc, int callnum, Process *process,
if (fd < 0 || process->sim_fd(fd) < 0) { if (fd < 0 || process->sim_fd(fd) < 0) {
// doesn't map to any simulator fd: not a valid target fd // doesn't map to any simulator fd: not a valid target fd
return SyscallReturn(-EBADF); return -EBADF;
} }
switch (req) { switch (req) {
@ -263,7 +263,7 @@ ioctlFunc(SyscallDesc *desc, int callnum, Process *process,
case OS::TIOCGETC: case OS::TIOCGETC:
case OS::TIOCGETS: case OS::TIOCGETS:
case OS::TIOCGETA: case OS::TIOCGETA:
return SyscallReturn(-ENOTTY); return -ENOTTY;
default: default:
fatal("Unsupported ioctl call: ioctl(%d, 0x%x, ...) @ 0x%llx\n", fd, req, xc->readPC()); 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; std::string path;
if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault) if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault)
return SyscallReturn(-EFAULT); return -EFAULT;
if (path == "/dev/sysdev0") { if (path == "/dev/sysdev0") {
// This is a memory-mapped high-resolution timer device on Alpha. // This is a memory-mapped high-resolution timer device on Alpha.
// We don't support it, so just punt. // We don't support it, so just punt.
DCOUT(SyscallWarnings) << "Ignoring open(" << path << ", ...)" << std::endl; DCOUT(SyscallWarnings) << "Ignoring open(" << path << ", ...)" << std::endl;
return SyscallReturn(-ENOENT); return -ENOENT;
} }
int tgtFlags = xc->getSyscallArg(1); int tgtFlags = xc->getSyscallArg(1);
@ -311,7 +311,7 @@ openFunc(SyscallDesc *desc, int callnum, Process *process,
// open the file // open the file
int fd = open(path.c_str(), hostFlags, mode); 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; std::string path;
if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault) if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault)
return SyscallReturn(-EFAULT); return -EFAULT;
struct stat hostBuf; struct stat hostBuf;
int result = stat(path.c_str(), &hostBuf); int result = stat(path.c_str(), &hostBuf);
if (result < 0) if (result < 0)
return SyscallReturn(errno); return errno;
OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf); 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; std::string path;
if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault) if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault)
return SyscallReturn(-EFAULT); return -EFAULT;
struct stat hostBuf; struct stat hostBuf;
int result = lstat(path.c_str(), &hostBuf); int result = lstat(path.c_str(), &hostBuf);
if (result < 0) if (result < 0)
return SyscallReturn(-errno); return -errno;
OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf); OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
return SyscallReturn(0); return 0;
} }
/// Target fstat() handler. /// Target fstat() handler.
@ -371,17 +371,17 @@ fstatFunc(SyscallDesc *desc, int callnum, Process *process,
// DPRINTFR(SyscallVerbose, "fstat(%d, ...)\n", fd); // DPRINTFR(SyscallVerbose, "fstat(%d, ...)\n", fd);
if (fd < 0) if (fd < 0)
return SyscallReturn(-EBADF); return -EBADF;
struct stat hostBuf; struct stat hostBuf;
int result = fstat(fd, &hostBuf); int result = fstat(fd, &hostBuf);
if (result < 0) if (result < 0)
return SyscallReturn(-errno); return -errno;
OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf); 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)); "This will break if not /dev/zero.", xc->getSyscallArg(4));
} }
return SyscallReturn(start); return start;
} }
/// Target getrlimit() handler. /// Target getrlimit() handler.
@ -444,7 +444,7 @@ getrlimitFunc(SyscallDesc *desc, int callnum, Process *process,
} }
rlp.copyOut(xc->mem); rlp.copyOut(xc->mem);
return SyscallReturn(0); return 0;
} }
/// Target gettimeofday() handler. /// Target gettimeofday() handler.
@ -460,7 +460,7 @@ gettimeofdayFunc(SyscallDesc *desc, int callnum, Process *process,
tp.copyOut(xc->mem); tp.copyOut(xc->mem);
return SyscallReturn(0); return 0;
} }
@ -501,7 +501,7 @@ getrusageFunc(SyscallDesc *desc, int callnum, Process *process,
rup.copyOut(xc->mem); rup.copyOut(xc->mem);
return SyscallReturn(0); return 0;
} }
#endif // __SIM_SYSCALL_EMUL_HH__ #endif // __SIM_SYSCALL_EMUL_HH__