From 1ced08c85055d5da845ca549c0f5fcea65ee3e08 Mon Sep 17 00:00:00 2001 From: Brandon Potter Date: Wed, 9 Nov 2016 14:27:40 -0600 Subject: 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 --- src/sim/syscall_emul.hh | 53 +++---------------------------------------------- 1 file changed, 3 insertions(+), 50 deletions(-) (limited to 'src/sim/syscall_emul.hh') diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index a3ac9ed3f..3e7221c0b 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -79,63 +79,16 @@ #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/byteswap.hh" #include "sim/emul_driver.hh" #include "sim/process.hh" +#include "sim/syscall_debug_macros.hh" #include "sim/syscall_emul_buf.hh" -#include "sim/syscallreturn.hh" +#include "sim/syscall_return.hh" #include "sim/system.hh" -// This wrapper macro helps out with readability a bit. FLAGEXT specifies -// the verbosity and FMT is the message to be appended to the syscall -// header information. The syscall header information contains the cpuid -// and thread id. -#define DPRINTF_SYSCALL(FLAGEXT, FMT, ...) \ - DPRINTFS(Syscall##FLAGEXT, tc->getCpuPtr(), "T%d : syscall " FMT, \ - tc->threadId(), __VA_ARGS__) - -/// -/// System call descriptor. -/// -class SyscallDesc { - - public: - - /// Typedef for target syscall handler functions. - typedef SyscallReturn (*FuncPtr)(SyscallDesc *, int num, - LiveProcess *, ThreadContext *); - - const char *name; //!< Syscall name (e.g., "open"). - FuncPtr funcPtr; //!< Pointer to emulation function. - int flags; //!< Flags (see Flags enum). - bool warned; //!< Have we warned about unimplemented syscall? - - /// Flag values for controlling syscall behavior. - enum Flags { - /// Don't set return regs according to funcPtr return value. - /// Used for syscalls with non-standard return conventions - /// that explicitly set the ThreadContext regs (e.g., - /// sigreturn). - SuppressReturnValue = 1, - WarnOnce = 2 - }; - - /// Constructor. - SyscallDesc(const char *_name, FuncPtr _funcPtr, int _flags = 0) - : name(_name), funcPtr(_funcPtr), flags(_flags), warned(false) - { - } - - /// Emulate the syscall. Public interface for calling through funcPtr. - void doSyscall(int callnum, LiveProcess *proc, ThreadContext *tc); - - /// Is the WarnOnce flag set? - bool warnOnce() const { return (flags & WarnOnce); } -}; - +class SyscallDesc; ////////////////////////////////////////////////////////////////////// // -- cgit v1.2.3