summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.hh
diff options
context:
space:
mode:
authorVince Weaver <vince@csl.cornell.edu>2009-09-15 22:36:47 -0700
committerVince Weaver <vince@csl.cornell.edu>2009-09-15 22:36:47 -0700
commit9b8e61beb38af081454ffd5e06d14458080b98e0 (patch)
tree8855dd8467c3ae14f00eb413478976501ce3f9f3 /src/sim/syscall_emul.hh
parent0f569b4d9dd5b7be253d45c22e9c40f615e90ecd (diff)
downloadgem5-9b8e61beb38af081454ffd5e06d14458080b98e0.tar.xz
Syscalls: Implement sysinfo() syscall.
Diffstat (limited to 'src/sim/syscall_emul.hh')
-rw-r--r--src/sim/syscall_emul.hh17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 5f2ebd428..c00edfdc6 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -59,6 +59,7 @@
#include "cpu/thread_context.hh"
#include "mem/translating_port.hh"
#include "mem/page_table.hh"
+#include "sim/system.hh"
#include "sim/process.hh"
///
@@ -558,6 +559,22 @@ openFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
}
+/// Target sysinfo() handler.
+template <class OS>
+SyscallReturn
+sysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
+ ThreadContext *tc)
+{
+
+ TypedBufferArg<typename OS::tgt_sysinfo> sysinfo(process->getSyscallArg(tc, 0));
+
+ sysinfo->uptime=seconds_since_epoch;
+ sysinfo->totalram=process->system->memSize();
+
+ sysinfo.copyOut(tc->getMemPort());
+
+ return 0;
+}
/// Target chmod() handler.
template <class OS>