syscall_emul.hh (11799:e47703369039) | syscall_emul.hh (11800:54436a1784dc) |
---|---|
1/* 2 * Copyright (c) 2012-2013, 2015 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 --- 48 unchanged lines hidden (view full) --- 57 58/// 59/// @file syscall_emul.hh 60/// 61/// This file defines objects used to emulate syscalls from the target 62/// application on the host machine. 63 64#ifdef __CYGWIN32__ | 1/* 2 * Copyright (c) 2012-2013, 2015 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 --- 48 unchanged lines hidden (view full) --- 57 58/// 59/// @file syscall_emul.hh 60/// 61/// This file defines objects used to emulate syscalls from the target 62/// application on the host machine. 63 64#ifdef __CYGWIN32__ |
65#include <sys/fcntl.h> // for O_BINARY | 65#include |
66 67#endif 68#include <fcntl.h> 69#include <sys/mman.h> 70#include <sys/stat.h> 71#if (NO_STATFS == 0) 72#include <sys/statfs.h> 73#endif 74#include <sys/time.h> 75#include <sys/uio.h> 76#include <unistd.h> 77 78#include <cerrno> 79#include <string> 80 | 66 67#endif 68#include <fcntl.h> 69#include <sys/mman.h> 70#include <sys/stat.h> 71#if (NO_STATFS == 0) 72#include <sys/statfs.h> 73#endif 74#include <sys/time.h> 75#include <sys/uio.h> 76#include <unistd.h> 77 78#include <cerrno> 79#include <string> 80 |
81#include "base/chunk_generator.hh" 82#include "base/intmath.hh" // for RoundUp | 81#include "base/intmath.hh" |
83#include "base/loader/object_file.hh" 84#include "base/misc.hh" 85#include "base/trace.hh" 86#include "base/types.hh" 87#include "config/the_isa.hh" 88#include "cpu/base.hh" 89#include "cpu/thread_context.hh" 90#include "mem/page_table.hh" | 82#include "base/loader/object_file.hh" 83#include "base/misc.hh" 84#include "base/trace.hh" 85#include "base/types.hh" 86#include "config/the_isa.hh" 87#include "cpu/base.hh" 88#include "cpu/thread_context.hh" 89#include "mem/page_table.hh" |
91#include "sim/byteswap.hh" | |
92#include "sim/emul_driver.hh" 93#include "sim/process.hh" 94#include "sim/syscall_debug_macros.hh" 95#include "sim/syscall_emul_buf.hh" 96#include "sim/syscall_return.hh" | 90#include "sim/emul_driver.hh" 91#include "sim/process.hh" 92#include "sim/syscall_debug_macros.hh" 93#include "sim/syscall_emul_buf.hh" 94#include "sim/syscall_return.hh" |
97#include "sim/system.hh" | |
98 99class SyscallDesc; 100 101////////////////////////////////////////////////////////////////////// 102// 103// The following emulation functions are generic enough that they 104// don't need to be recompiled for different emulated OS's. They are 105// defined in sim/syscall_emul.cc. --- 45 unchanged lines hidden (view full) --- 151 LiveProcess *p, ThreadContext *tc); 152 153/// Target lseek() handler. 154SyscallReturn lseekFunc(SyscallDesc *desc, int num, 155 LiveProcess *p, ThreadContext *tc); 156 157/// Target _llseek() handler. 158SyscallReturn _llseekFunc(SyscallDesc *desc, int num, | 95 96class SyscallDesc; 97 98////////////////////////////////////////////////////////////////////// 99// 100// The following emulation functions are generic enough that they 101// don't need to be recompiled for different emulated OS's. They are 102// defined in sim/syscall_emul.cc. --- 45 unchanged lines hidden (view full) --- 148 LiveProcess *p, ThreadContext *tc); 149 150/// Target lseek() handler. 151SyscallReturn lseekFunc(SyscallDesc *desc, int num, 152 LiveProcess *p, ThreadContext *tc); 153 154/// Target _llseek() handler. 155SyscallReturn _llseekFunc(SyscallDesc *desc, int num, |
159 LiveProcess *p, ThreadContext *tc); | 156 LiveProcess *p, ThreadContext *tc); |
160 161/// Target munmap() handler. 162SyscallReturn munmapFunc(SyscallDesc *desc, int num, 163 LiveProcess *p, ThreadContext *tc); 164 165/// Target gethostname() handler. 166SyscallReturn gethostnameFunc(SyscallDesc *desc, int num, 167 LiveProcess *p, ThreadContext *tc); --- 63 unchanged lines hidden (view full) --- 231 LiveProcess *process, ThreadContext *tc); 232 233/// Target fnctl() handler. 234SyscallReturn fcntlFunc(SyscallDesc *desc, int num, 235 LiveProcess *process, ThreadContext *tc); 236 237/// Target fcntl64() handler. 238SyscallReturn fcntl64Func(SyscallDesc *desc, int num, | 157 158/// Target munmap() handler. 159SyscallReturn munmapFunc(SyscallDesc *desc, int num, 160 LiveProcess *p, ThreadContext *tc); 161 162/// Target gethostname() handler. 163SyscallReturn gethostnameFunc(SyscallDesc *desc, int num, 164 LiveProcess *p, ThreadContext *tc); --- 63 unchanged lines hidden (view full) --- 228 LiveProcess *process, ThreadContext *tc); 229 230/// Target fnctl() handler. 231SyscallReturn fcntlFunc(SyscallDesc *desc, int num, 232 LiveProcess *process, ThreadContext *tc); 233 234/// Target fcntl64() handler. 235SyscallReturn fcntl64Func(SyscallDesc *desc, int num, |
239 LiveProcess *process, ThreadContext *tc); | 236 LiveProcess *process, ThreadContext *tc); |
240 241/// Target setuid() handler. 242SyscallReturn setuidFunc(SyscallDesc *desc, int num, | 237 238/// Target setuid() handler. 239SyscallReturn setuidFunc(SyscallDesc *desc, int num, |
243 LiveProcess *p, ThreadContext *tc); | 240 LiveProcess *p, ThreadContext *tc); |
244 245/// Target getpid() handler. 246SyscallReturn getpidFunc(SyscallDesc *desc, int num, | 241 242/// Target getpid() handler. 243SyscallReturn getpidFunc(SyscallDesc *desc, int num, |
247 LiveProcess *p, ThreadContext *tc); | 244 LiveProcess *p, ThreadContext *tc); |
248 249/// Target getuid() handler. 250SyscallReturn getuidFunc(SyscallDesc *desc, int num, | 245 246/// Target getuid() handler. 247SyscallReturn getuidFunc(SyscallDesc *desc, int num, |
251 LiveProcess *p, ThreadContext *tc); | 248 LiveProcess *p, ThreadContext *tc); |
252 253/// Target getgid() handler. 254SyscallReturn getgidFunc(SyscallDesc *desc, int num, | 249 250/// Target getgid() handler. 251SyscallReturn getgidFunc(SyscallDesc *desc, int num, |
255 LiveProcess *p, ThreadContext *tc); | 252 LiveProcess *p, ThreadContext *tc); |
256 257/// Target getppid() handler. 258SyscallReturn getppidFunc(SyscallDesc *desc, int num, | 253 254/// Target getppid() handler. 255SyscallReturn getppidFunc(SyscallDesc *desc, int num, |
259 LiveProcess *p, ThreadContext *tc); | 256 LiveProcess *p, ThreadContext *tc); |
260 261/// Target geteuid() handler. 262SyscallReturn geteuidFunc(SyscallDesc *desc, int num, | 257 258/// Target geteuid() handler. 259SyscallReturn geteuidFunc(SyscallDesc *desc, int num, |
263 LiveProcess *p, ThreadContext *tc); | 260 LiveProcess *p, ThreadContext *tc); |
264 265/// Target getegid() handler. 266SyscallReturn getegidFunc(SyscallDesc *desc, int num, | 261 262/// Target getegid() handler. 263SyscallReturn getegidFunc(SyscallDesc *desc, int num, |
267 LiveProcess *p, ThreadContext *tc); | 264 LiveProcess *p, ThreadContext *tc); |
268 269/// Target clone() handler. 270SyscallReturn cloneFunc(SyscallDesc *desc, int num, | 265 266/// Target clone() handler. 267SyscallReturn cloneFunc(SyscallDesc *desc, int num, |
271 LiveProcess *p, ThreadContext *tc); | 268 LiveProcess *p, ThreadContext *tc); |
272 273/// Target access() handler 274SyscallReturn accessFunc(SyscallDesc *desc, int num, 275 LiveProcess *p, ThreadContext *tc); 276SyscallReturn accessFunc(SyscallDesc *desc, int num, 277 LiveProcess *p, ThreadContext *tc, 278 int index); 279 --- 1385 unchanged lines hidden --- | 269 270/// Target access() handler 271SyscallReturn accessFunc(SyscallDesc *desc, int num, 272 LiveProcess *p, ThreadContext *tc); 273SyscallReturn accessFunc(SyscallDesc *desc, int num, 274 LiveProcess *p, ThreadContext *tc, 275 int index); 276 --- 1385 unchanged lines hidden --- |