1/* 2 * Copyright (c) 2012-2013 ARM Limited 3 * Copyright (c) 2015 Advanced Micro Devices, Inc. 4 * All rights reserved 5 * 6 * The license below extends only to copyright in the software and shall 7 * not be construed as granting a license to any other intellectual 8 * property including but not limited to intellectual property relating --- 83 unchanged lines hidden (view full) --- 92 93 /// Typedef for target syscall handler functions. 94 typedef SyscallReturn (*FuncPtr)(SyscallDesc *, int num, 95 LiveProcess *, ThreadContext *); 96 97 const char *name; //!< Syscall name (e.g., "open"). 98 FuncPtr funcPtr; //!< Pointer to emulation function. 99 int flags; //!< Flags (see Flags enum). |
100 bool warned; //!< Have we warned about unimplemented syscall? |
101 102 /// Flag values for controlling syscall behavior. 103 enum Flags { 104 /// Don't set return regs according to funcPtr return value. 105 /// Used for syscalls with non-standard return conventions 106 /// that explicitly set the ThreadContext regs (e.g., 107 /// sigreturn). |
108 SuppressReturnValue = 1, 109 WarnOnce = 2 |
110 }; 111 112 /// Constructor. 113 SyscallDesc(const char *_name, FuncPtr _funcPtr, int _flags = 0) |
114 : name(_name), funcPtr(_funcPtr), flags(_flags), warned(false) |
115 { 116 } 117 118 /// Emulate the syscall. Public interface for calling through funcPtr. 119 void doSyscall(int callnum, LiveProcess *proc, ThreadContext *tc); |
120 121 /// Is the WarnOnce flag set? 122 bool warnOnce() const { return (flags & WarnOnce); } |
123}; 124 125 126////////////////////////////////////////////////////////////////////// 127// 128// The following emulation functions are generic enough that they 129// don't need to be recompiled for different emulated OS's. They are 130// defined in sim/syscall_emul.cc. --- 6 unchanged lines hidden (view full) --- 137 LiveProcess *p, ThreadContext *tc); 138 139/// Handler for unimplemented syscalls that we never intend to 140/// implement (signal handling, etc.) and should not affect the correct 141/// behavior of the program. Print a warning only if the appropriate 142/// trace flag is enabled. Return success to the target program. 143SyscallReturn ignoreFunc(SyscallDesc *desc, int num, 144 LiveProcess *p, ThreadContext *tc); |
145 146/// Target exit() handler: terminate current context. 147SyscallReturn exitFunc(SyscallDesc *desc, int num, 148 LiveProcess *p, ThreadContext *tc); 149 150/// Target exit_group() handler: terminate simulation. (exit all threads) 151SyscallReturn exitGroupFunc(SyscallDesc *desc, int num, 152 LiveProcess *p, ThreadContext *tc); --- 1325 unchanged lines hidden --- |