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);
135 { 3,
"read", readFunc<ArmFreebsd64> },
136 { 4,
"write", writeFunc<ArmFreebsd64> },
138 { 54,
"ioctl", ioctlFunc<ArmFreebsd64> },
139 { 58,
"readlink", readlinkFunc<ArmFreebsd64> },
140 { 117,
"getrusage", getrusageFunc<ArmFreebsd64> },
141 { 189,
"fstat", fstatFunc<ArmFreebsd64> },
142#if !defined ( __GNU_LIBRARY__ )
148 { 477,
"mmap", mmapFunc<ArmFreebsd64> }
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 Arm Limited All rights reserved.
SyscallReturn brkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> new_brk)
Target brk() handler: set brk address.
SyscallReturn exitFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit() handler: terminate current context.
This file defines objects used to emulate syscalls from the target application on the host machine.