53 strcpy(
name->sysname,
"Linux");
54 strcpy(
name->nodename,
"sim.gem5.org");
55 strcpy(
name->release, process->release.c_str());
56 strcpy(
name->version,
"#1 Mon Aug 18 11:32:15 EDT 2003");
57 strcpy(
name->machine,
"x86_64");
73 uint64_t fsBase, gsBase;
84 p.write(
addr, fsBase);
92 p.write(
addr, gsBase);
103 const int minTLSEntry = 6;
104 const int numTLSEntries = 3;
105 const int maxTLSEntry = minTLSEntry + numTLSEntries - 1;
113 assert((maxTLSEntry + 1) *
sizeof(uint64_t) <= x86p->
gdtSize());
116 gdt(x86p->
gdtStart() + minTLSEntry *
sizeof(uint64_t),
117 numTLSEntries *
sizeof(uint64_t));
120 panic(
"Failed to copy in GDT for %s.\n", desc->
name());
122 if (userDesc->entry_number == (uint32_t)(-1)) {
124 for (
int i = 0;
i < numTLSEntries;
i++) {
126 userDesc->entry_number =
i + minTLSEntry;
131 if (userDesc->entry_number == (uint32_t)(-1))
135 int index = userDesc->entry_number;
140 index -= minTLSEntry;
143 SegDescriptor segDesc = 0;
144 UserDescFlags
flags = userDesc->flags;
146 segDesc.limitLow =
bits(userDesc->limit, 15, 0);
147 segDesc.baseLow =
bits(userDesc->base_addr, 23, 0);
149 if (!
flags.read_exec_only)
154 segDesc.type.codeOrData = 1;
157 if (!
flags.seg_not_present)
159 segDesc.limitHigh =
bits(userDesc->limit, 19, 16);
165 if (
flags.limit_in_pages)
167 segDesc.baseHigh =
bits(userDesc->base_addr, 31, 24);
169 gdt[
index] = (uint64_t)segDesc;
172 panic(
"Failed to copy out GDT for %s.\n", desc->
name());
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)
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 void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
virtual Process * getProcessPtr()=0
TypedBufferArg is a class template; instances of this template represent typed buffers in target user...
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
#define panic(...)
This implements a cprintf based panic() function.
SyscallReturn unameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< Linux::utsname > name)
Target uname() handler.
SyscallReturn archPrctlFunc(SyscallDesc *desc, ThreadContext *tc, int code, uint64_t addr)
SyscallReturn setThreadArea32Func(SyscallDesc *desc, ThreadContext *tc, VPtr< UserDesc32 > userDesc)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
This file defines objects used to emulate syscalls from the target application on the host machine.
const std::string & name()