syscall_emul.hh (10796:5bcba8001c7e) | syscall_emul.hh (10831:fbdaa08aaa42) |
---|---|
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). | 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? |
|
100 101 /// Flag values for controlling syscall behavior. 102 enum Flags { 103 /// Don't set return regs according to funcPtr return value. 104 /// Used for syscalls with non-standard return conventions 105 /// that explicitly set the ThreadContext regs (e.g., 106 /// sigreturn). | 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). |
107 SuppressReturnValue = 1 | 108 SuppressReturnValue = 1, 109 WarnOnce = 2 |
108 }; 109 110 /// Constructor. 111 SyscallDesc(const char *_name, FuncPtr _funcPtr, int _flags = 0) | 110 }; 111 112 /// Constructor. 113 SyscallDesc(const char *_name, FuncPtr _funcPtr, int _flags = 0) |
112 : name(_name), funcPtr(_funcPtr), flags(_flags) | 114 : name(_name), funcPtr(_funcPtr), flags(_flags), warned(false) |
113 { 114 } 115 116 /// Emulate the syscall. Public interface for calling through funcPtr. 117 void doSyscall(int callnum, LiveProcess *proc, ThreadContext *tc); | 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); } |
|
118}; 119 120 121////////////////////////////////////////////////////////////////////// 122// 123// The following emulation functions are generic enough that they 124// don't need to be recompiled for different emulated OS's. They are 125// defined in sim/syscall_emul.cc. --- 6 unchanged lines hidden (view full) --- 132 LiveProcess *p, ThreadContext *tc); 133 134/// Handler for unimplemented syscalls that we never intend to 135/// implement (signal handling, etc.) and should not affect the correct 136/// behavior of the program. Print a warning only if the appropriate 137/// trace flag is enabled. Return success to the target program. 138SyscallReturn ignoreFunc(SyscallDesc *desc, int num, 139 LiveProcess *p, ThreadContext *tc); | 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); |
140SyscallReturn ignoreWarnOnceFunc(SyscallDesc *desc, int num, 141 LiveProcess *p, ThreadContext *tc); | |
142 143/// Target exit() handler: terminate current context. 144SyscallReturn exitFunc(SyscallDesc *desc, int num, 145 LiveProcess *p, ThreadContext *tc); 146 147/// Target exit_group() handler: terminate simulation. (exit all threads) 148SyscallReturn exitGroupFunc(SyscallDesc *desc, int num, 149 LiveProcess *p, ThreadContext *tc); --- 1325 unchanged lines hidden --- | 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 --- |