syscall_emul.hh (13933:b4382461066d) | syscall_emul.hh (13936:4fd3a0a20e0e) |
---|---|
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 --- 45 unchanged lines hidden (view full) --- 54#endif 55 56/// 57/// @file syscall_emul.hh 58/// 59/// This file defines objects used to emulate syscalls from the target 60/// application on the host machine. 61 | 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 --- 45 unchanged lines hidden (view full) --- 54#endif 55 56/// 57/// @file syscall_emul.hh 58/// 59/// This file defines objects used to emulate syscalls from the target 60/// application on the host machine. 61 |
62#ifdef __linux__ | 62#if defined(__linux__) |
63#include <sys/eventfd.h> 64#include <sys/statfs.h> 65 | 63#include <sys/eventfd.h> 64#include <sys/statfs.h> 65 |
66#else 67#include <sys/mount.h> 68 |
|
66#endif 67 68#ifdef __CYGWIN32__ 69#include <sys/fcntl.h> 70 71#endif 72#include <fcntl.h> 73#include <net/if.h> --- 699 unchanged lines hidden (view full) --- 773 conf->ifc_buf = (char*)ifc_buf_addr; 774 ifc_buf_arg.copyOut(tc->getMemProxy()); 775 conf_arg.copyOut(tc->getMemProxy()); 776 } 777 778 return status; 779 } 780 case SIOCGIFFLAGS: | 69#endif 70 71#ifdef __CYGWIN32__ 72#include <sys/fcntl.h> 73 74#endif 75#include <fcntl.h> 76#include <net/if.h> --- 699 unchanged lines hidden (view full) --- 776 conf->ifc_buf = (char*)ifc_buf_addr; 777 ifc_buf_arg.copyOut(tc->getMemProxy()); 778 conf_arg.copyOut(tc->getMemProxy()); 779 } 780 781 return status; 782 } 783 case SIOCGIFFLAGS: |
781#ifdef __linux__ | 784#if defined(__linux__) |
782 case SIOCGIFINDEX: 783#endif 784 case SIOCGIFNETMASK: 785 case SIOCGIFADDR: | 785 case SIOCGIFINDEX: 786#endif 787 case SIOCGIFNETMASK: 788 case SIOCGIFADDR: |
786#ifdef __linux__ | 789#if defined(__linux__) |
787 case SIOCGIFHWADDR: 788#endif 789 case SIOCGIFMTU: { 790 Addr req_addr = p->getSyscallArg(tc, index); 791 BufferArg req_arg(req_addr, sizeof(ifreq)); 792 req_arg.copyIn(tc->getMemProxy()); 793 794 status = ioctl(sfdp->getSimFD(), req, req_arg.bufferPtr()); --- 715 unchanged lines hidden (view full) --- 1510} 1511 1512/// Target statfs() handler. 1513template <class OS> 1514SyscallReturn 1515statfsFunc(SyscallDesc *desc, int callnum, Process *process, 1516 ThreadContext *tc) 1517{ | 790 case SIOCGIFHWADDR: 791#endif 792 case SIOCGIFMTU: { 793 Addr req_addr = p->getSyscallArg(tc, index); 794 BufferArg req_arg(req_addr, sizeof(ifreq)); 795 req_arg.copyIn(tc->getMemProxy()); 796 797 status = ioctl(sfdp->getSimFD(), req, req_arg.bufferPtr()); --- 715 unchanged lines hidden (view full) --- 1513} 1514 1515/// Target statfs() handler. 1516template <class OS> 1517SyscallReturn 1518statfsFunc(SyscallDesc *desc, int callnum, Process *process, 1519 ThreadContext *tc) 1520{ |
1518#ifdef __linux__ | 1521#if defined(__linux__) |
1519 std::string path; 1520 1521 int index = 0; 1522 if (!tc->getMemProxy().tryReadString(path, 1523 process->getSyscallArg(tc, index))) { 1524 return -EFAULT; 1525 } 1526 Addr bufPtr = process->getSyscallArg(tc, index); --- 1319 unchanged lines hidden (view full) --- 2846 return p->fds->allocFD(afdp); 2847} 2848 2849/// Target eventfd() function. 2850template <class OS> 2851SyscallReturn 2852eventfdFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) 2853{ | 1522 std::string path; 1523 1524 int index = 0; 1525 if (!tc->getMemProxy().tryReadString(path, 1526 process->getSyscallArg(tc, index))) { 1527 return -EFAULT; 1528 } 1529 Addr bufPtr = process->getSyscallArg(tc, index); --- 1319 unchanged lines hidden (view full) --- 2849 return p->fds->allocFD(afdp); 2850} 2851 2852/// Target eventfd() function. 2853template <class OS> 2854SyscallReturn 2855eventfdFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) 2856{ |
2854#ifdef __linux__ | 2857#if defined(__linux__) |
2855 int index = 0; 2856 unsigned initval = p->getSyscallArg(tc, index); 2857 int in_flags = p->getSyscallArg(tc, index); 2858 2859 int sim_fd = eventfd(initval, in_flags); 2860 if (sim_fd == -1) 2861 return -errno; 2862 --- 15 unchanged lines hidden --- | 2858 int index = 0; 2859 unsigned initval = p->getSyscallArg(tc, index); 2860 int in_flags = p->getSyscallArg(tc, index); 2861 2862 int sim_fd = eventfd(initval, in_flags); 2863 if (sim_fd == -1) 2864 return -errno; 2865 --- 15 unchanged lines hidden --- |