41#include <sys/syscall.h>
63class LinuxLoader :
public Process::Loader
67 load(
const ProcessParams ¶ms, loader::ObjectFile *obj_file)
69 auto arch = obj_file->getArch();
70 auto opsys = obj_file->getOpSys();
76 warn(
"Unknown operating system; assuming Linux.");
84 return new X86ISA::X86_64Process(params, obj_file);
86 return new X86ISA::I386Process(params, obj_file);
90LinuxLoader linuxLoader;
116 process->Process::syscall(tc);
121 }
else if (
auto *proc32 =
dynamic_cast<I386Process *
>(process)) {
124 const auto &vsyscall = proc32->getVSyscallPage();
125 if (eip >= vsyscall.base && eip < vsyscall.base + vsyscall.size) {
126 pc.set(vsyscall.base + vsyscall.vsysexitOffset);
131 panic(
"Unrecognized process type.");
151 warn(
"Unexpected workload event at pc %#x.",
pc);
166 panic(
"Page fault at addr %#x\n\tInterrupt handler stack:\n"
Addr instAddr() const
Returns the memory address of the instruction this PC points to.
void readBlob(Addr addr, void *p, uint64_t size) const
Higher level interfaces based on the above.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual RegVal getReg(const RegId ®) const
virtual const PCStateBase & pcState() const =0
virtual Process * getProcessPtr()=0
static SyscallDescTable< SyscallABI64 > syscallDescs64
void event(ThreadContext *tc) override
void pageFault(ThreadContext *tc)
EmuLinux(const Params &p)
static SyscallDescTable< SyscallABI32 > syscallDescs32
void syscall(ThreadContext *tc) override
constexpr T mbits(T val, unsigned first, unsigned last)
Mask off the given bits in place like bits() but without shifting.
#define panic(...)
This implements a cprintf based panic() function.
const Addr syscallCodeVirtAddr
const Addr PFHandlerVirtAddr
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static const std::vector< RegId > ArgumentRegs
static const std::vector< RegId > ArgumentRegs
This file defines objects used to emulate syscalls from the target application on the host machine.