Deleted Added
sdiff udiff text old ( 11801:cd7f3a1dbf55 ) new ( 11851:824055fe6b30 )
full compact
1/*
2 * Copyright (c) 2014 Advanced Micro Devices, Inc.
3 * Copyright (c) 2001-2005 The Regents of The University of Michigan
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

--- 32 unchanged lines hidden (view full) ---

41#include "arch/registers.hh"
42#include "base/statistics.hh"
43#include "base/types.hh"
44#include "config/the_isa.hh"
45#include "mem/se_translating_port_proxy.hh"
46#include "sim/fd_entry.hh"
47#include "sim/sim_object.hh"
48
49struct LiveProcessParams;
50struct ProcessParams;
51
52class EmulatedDriver;
53class PageTableBase;
54class SyscallDesc;
55class SyscallReturn;
56class System;
57class ThreadContext;
58
59template<class IntType>
60struct AuxVector

--- 104 unchanged lines hidden (view full) ---

165 void assignThreadContext(ContextID context_id)
166 {
167 contextIds.push_back(context_id);
168 }
169
170 // Find a free context to use
171 ThreadContext *findFreeContext();
172
173 // provide program name for debug messages
174 virtual const char *progName() const { return "<unknown>"; }
175
176 // generate new target fd for sim_fd
177 int allocFD(int sim_fd, const std::string& filename, int flags, int mode,
178 bool pipe);
179
180 // disassociate target fd with simulator fd and cleanup subsidiary fields
181 void resetFDEntry(int tgt_fd);
182
183 // look up simulator fd for given target fd

--- 13 unchanged lines hidden (view full) ---

197 void fixFileOffsets();
198
199 // find all offsets for currently open files and save them
200 void findFileOffsets();
201
202 // set the source of this read pipe for a checkpoint resume
203 void setReadPipeSource(int read_pipe_fd, int source_fd);
204
205 virtual void syscall(int64_t callnum, ThreadContext *tc) = 0;
206
207 void allocateMem(Addr vaddr, int64_t size, bool clobber = false);
208
209 /// Attempt to fix up a fault at vaddr by allocating a page on the stack.
210 /// @return Whether the fault has been fixed.
211 bool fixupStackFault(Addr vaddr);
212
213 /**

--- 9 unchanged lines hidden (view full) ---

223 * @return True if the map operation was successful. (At this
224 * point in time, the map operation always succeeds.)
225 */
226 bool map(Addr vaddr, Addr paddr, int size, bool cacheable = true);
227
228 void serialize(CheckpointOut &cp) const override;
229 void unserialize(CheckpointIn &cp) override;
230
231 public:
232 // Id of the owner of the process
233 uint64_t _uid;
234 uint64_t _euid;
235 uint64_t _gid;
236 uint64_t _egid;
237
238 // pid of the process and it's parent
239 uint64_t _pid;
240 uint64_t _ppid;
241
242};
243
244//
245// "Live" process with system calls redirected to host system
246//
247class ObjectFile;
248class LiveProcess : public Process
249{
250 protected:
251 ObjectFile *objFile;
252 std::vector<std::string> argv;
253 std::vector<std::string> envp;
254 std::string cwd;
255 std::string executable;
256
257 LiveProcess(LiveProcessParams *params, ObjectFile *objFile);
258
259 // Emulated drivers available to this process
260 std::vector<EmulatedDriver *> drivers;
261
262 public:
263
264 enum AuxiliaryVectorType {
265 M5_AT_NULL = 0,
266 M5_AT_IGNORE = 1,
267 M5_AT_EXECFD = 2,
268 M5_AT_PHDR = 3,
269 M5_AT_PHENT = 4,
270 M5_AT_PHNUM = 5,
271 M5_AT_PAGESZ = 6,

--- 22 unchanged lines hidden (view full) ---

294 inline uint64_t uid() { return _uid; }
295 inline uint64_t euid() { return _euid; }
296 inline uint64_t gid() { return _gid; }
297 inline uint64_t egid() { return _egid; }
298 inline uint64_t pid() { return _pid; }
299 inline uint64_t ppid() { return _ppid; }
300
301 // provide program name for debug messages
302 virtual const char *progName() const { return executable.c_str(); }
303
304 std::string
305 fullPath(const std::string &filename)
306 {
307 if (filename[0] == '/' || cwd.empty())
308 return filename;
309
310 std::string full = cwd;
311
312 if (cwd[cwd.size() - 1] != '/')
313 full += '/';
314
315 return full + filename;
316 }
317
318 std::string getcwd() const { return cwd; }
319
320 virtual void syscall(int64_t callnum, ThreadContext *tc);
321
322 virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i) = 0;
323 virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i, int width);
324 virtual void setSyscallArg(ThreadContext *tc,
325 int i, TheISA::IntReg val) = 0;
326 virtual void setSyscallReturn(ThreadContext *tc,
327 SyscallReturn return_value) = 0;
328

--- 11 unchanged lines hidden (view full) ---

340 // the object file because the parameters needed to calculate the
341 // bias are not available when the object file is created.
342 void updateBias();
343
344 ObjectFile *getInterpreter();
345
346 Addr getBias();
347 Addr getStartPC();
348
349 // this function is used to create the LiveProcess object, since
350 // we can't tell which subclass of LiveProcess to use until we
351 // open and look at the object file.
352 static LiveProcess *create(LiveProcessParams *params);
353};
354
355
356#endif // __PROCESS_HH__