36#include <sys/syscall.h>
37#if !defined( __GNU_LIBRARY__ ) && (defined(__FreeBSD__) || defined(__APPLE__))
38#include <sys/sysctl.h>
54class FreebsdLoader :
public Process::Loader
58 load(
const ProcessParams ¶ms, loader::ObjectFile *obj)
override
60 auto arch = obj->getArch();
61 auto opsys = obj->getOpSys();
72 return new ArmProcess64(params, obj, arch);
74 return new ArmProcess32(params, obj, arch);
78FreebsdLoader freebsdLoader;
91#if !defined ( __GNU_LIBRARY__ )
115 uint32_t *hnamep = (uint32_t *)buf.
bufferPtr();
117 size_t *holdlenp = (
size_t *)buf3.
bufferPtr();
119 ret = sysctl((
int *)hnamep, nameLen, holdp, holdlenp, hnewp, newlen);
142#if !defined ( __GNU_LIBRARY__ )
157 process->Process::syscall(tc);
void syscall(ThreadContext *tc) override
bool copyIn(const PortProxy &memproxy)
copy data into simulator space (read from target memory)
bool copyOut(const PortProxy &memproxy)
copy data out of simulator space (write to target memory)
BufferArg represents an untyped buffer in target user space that is passed by reference to an (emulat...
void * bufferPtr()
Return a pointer to the internal simulator-space buffer.
This class provides the wrapper interface for the system call implementations which are defined in th...
This class represents the return value from an emulated system call, including any errno setting.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal getReg(const RegId ®) const
virtual Process * getProcessPtr()=0
static SyscallReturn sysctlFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> namep, size_t nameLen, VPtr<> oldp, VPtr<> oldlenp, VPtr<> newp, size_t newlen)
static SyscallReturn issetugidFunc(SyscallDesc *desc, ThreadContext *tc)
static SyscallDescTable< EmuFreebsd::SyscallABI32 > syscallDescs32({})
static SyscallDescTable< EmuFreebsd::SyscallABI64 > syscallDescs64
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
SyscallReturn brkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> new_brk)
Target brk() handler: set brk address.
SyscallReturn mmapFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> start, typename OS::size_t length, int prot, int tgt_flags, int tgt_fd, typename OS::off_t offset)
Target mmap() handler.
SyscallReturn fstatFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr< typename OS::tgt_stat > tgt_stat)
Target fstat() handler.
SyscallReturn getrusageFunc(SyscallDesc *desc, ThreadContext *tc, int who, VPtr< typename OS::rusage > rup)
Target getrusage() function.
SyscallReturn readFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, int nbytes)
SyscallReturn readlinkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr<> buf_ptr, typename OS::size_t bufsiz)
Target readlink() handler.
SyscallReturn ioctlFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, unsigned req, VPtr<> addr)
Target ioctl() handler.
SyscallReturn exitFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit() handler: terminate current context.
SyscallReturn writeFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, int nbytes)
This file defines objects used to emulate syscalls from the target application on the host machine.