syscall_emul: [patch 2/22] move SyscallDesc into its own .hh and .cc

The class was crammed into syscall_emul.hh which has tons of forward
declarations and template definitions. To clean it up a bit, moved the
class into separate files and commented the class with doxygen style
comments. Also, provided some encapsulation by adding some accessors and
a mutator.

The syscallreturn.hh file was renamed syscall_return.hh to make it consistent
with other similarly named files in the src/sim directory.

The DPRINTF_SYSCALL macro was moved into its own header file with the
include the Base and Verbose flags as well.

--HG--
rename : src/sim/syscallreturn.hh => src/sim/syscall_return.hh
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 499cd25..da89f7a 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -44,56 +44,21 @@
 #include "config/the_isa.hh"
 #include "cpu/base.hh"
 #include "cpu/thread_context.hh"
-#include "debug/SyscallBase.hh"
-#include "debug/SyscallVerbose.hh"
 #include "mem/page_table.hh"
 #include "sim/process.hh"
 #include "sim/sim_exit.hh"
+#include "sim/syscall_debug_macros.hh"
+#include "sim/syscall_desc.hh"
 #include "sim/system.hh"
 
 using namespace std;
 using namespace TheISA;
 
-void
-SyscallDesc::doSyscall(int callnum, LiveProcess *process, ThreadContext *tc)
-{
-    if (DTRACE(SyscallBase)) {
-        int index = 0;
-        IntReg arg[6] M5_VAR_USED;
-
-        // we can't just put the calls to getSyscallArg() in the
-        // DPRINTF arg list, because C++ doesn't guarantee their order
-        for (int i = 0; i < 6; ++i)
-            arg[i] = process->getSyscallArg(tc, index);
-
-        // Linux supports up to six system call arguments through registers
-        // so we want to print all six. Check to the relevant man page to
-        // verify how many are actually used by a given system call.
-        DPRINTF_SYSCALL(Base,
-                        "%s called w/arguments %d, %d, %d, %d, %d, %d\n",
-                        name, arg[0], arg[1], arg[2], arg[3], arg[4],
-                        arg[5]);
-    }
-
-    SyscallReturn retval = (*funcPtr)(this, callnum, process, tc);
-
-    if (retval.needsRetry()) {
-        DPRINTF_SYSCALL(Base, "%s needs retry\n", name);
-    } else {
-        DPRINTF_SYSCALL(Base, "%s returns %d\n", name,
-                        retval.encodedValue());
-    }
-
-    if (!(flags & SyscallDesc::SuppressReturnValue) && !retval.needsRetry())
-        process->setSyscallReturn(tc, retval);
-}
-
-
 SyscallReturn
 unimplementedFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
                   ThreadContext *tc)
 {
-    fatal("syscall %s (#%d) unimplemented.", desc->name, callnum);
+    fatal("syscall %s (#%d) unimplemented.", desc->name(), callnum);
 
     return 1;
 }
@@ -103,20 +68,11 @@
 ignoreFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
            ThreadContext *tc)
 {
-    int index = 0;
-    const char *extra_text = "";
-
-    if (desc->warnOnce()) {
-        if (desc->warned)
-            return 0;
-
-        desc->warned = true;
-        extra_text = "\n      (further warnings will be suppressed)";
+    if (desc->needWarning()) {
+        warn("ignoring syscall %s(...)%s", desc->name(), desc->warnOnce() ?
+             "\n      (further warnings will be suppressed)" : "");
     }
 
-    warn("ignoring syscall %s(%d, ...)%s", desc->name,
-         process->getSyscallArg(tc, index), extra_text);
-
     return 0;
 }