process.hh (7532:3f6413fc37a2) process.hh (8325:76095b05f4da)
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

121
122 std::string prog_fname; // file name
123
124 Stats::Scalar num_syscalls; // number of syscalls executed
125
126
127 protected:
128 // constructor
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

121
122 std::string prog_fname; // file name
123
124 Stats::Scalar num_syscalls; // number of syscalls executed
125
126
127 protected:
128 // constructor
129 Process(ProcessParams * params);
129 Process(ProcessParams *params);
130
131 virtual void initState();
132
133 protected:
134 /// Memory object for initialization (image loading)
135 TranslatingPort *initVirtMem;
136
137 public:
138 PageTable *pTable;
139
140 //This id is assigned by m5 and is used to keep process' tlb entries
141 //separated.
142 uint64_t M5_pid;
143
144 class FdMap
145 {
146 public:
130
131 virtual void initState();
132
133 protected:
134 /// Memory object for initialization (image loading)
135 TranslatingPort *initVirtMem;
136
137 public:
138 PageTable *pTable;
139
140 //This id is assigned by m5 and is used to keep process' tlb entries
141 //separated.
142 uint64_t M5_pid;
143
144 class FdMap
145 {
146 public:
147 int fd;
148 std::string filename;
149 int mode;
150 int flags;
151 bool isPipe;
152 int readPipeSource;
153 uint64_t fileOffset;
147 int fd;
148 std::string filename;
149 int mode;
150 int flags;
151 bool isPipe;
152 int readPipeSource;
153 uint64_t fileOffset;
154
154
155 FdMap()
156 : fd(-1), filename("NULL"), mode(0), flags(0),
157 isPipe(false), readPipeSource(0), fileOffset(0)
158 { }
155
159
156 FdMap()
157 {
158 fd = -1;
159 filename = "NULL";
160 mode = 0;
161 flags = 0;
162 isPipe = false;
163 readPipeSource = 0;
164 fileOffset = 0;
165
166 }
167
168 void serialize(std::ostream &os);
169 void unserialize(Checkpoint *cp, const std::string &section);
160 void serialize(std::ostream &os);
161 void unserialize(Checkpoint *cp, const std::string &section);
170
171 };
172
173 private:
174 // file descriptor remapping support
175 static const int MAX_FD = 256; // max legal fd value
176 FdMap fd_map[MAX_FD+1];
177
178

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

187 // After getting registered with system object, tell process which
188 // system-wide context id it is assigned.
189 void assignThreadContext(int context_id)
190 {
191 contextIds.push_back(context_id);
192 }
193
194 // Find a free context to use
162 };
163
164 private:
165 // file descriptor remapping support
166 static const int MAX_FD = 256; // max legal fd value
167 FdMap fd_map[MAX_FD+1];
168
169

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

178 // After getting registered with system object, tell process which
179 // system-wide context id it is assigned.
180 void assignThreadContext(int context_id)
181 {
182 contextIds.push_back(context_id);
183 }
184
185 // Find a free context to use
195 ThreadContext * findFreeContext();
186 ThreadContext *findFreeContext();
196
197 // map simulator fd sim_fd to target fd tgt_fd
198 void dup_fd(int sim_fd, int tgt_fd);
199
200 // generate new target fd for sim_fd
187
188 // map simulator fd sim_fd to target fd tgt_fd
189 void dup_fd(int sim_fd, int tgt_fd);
190
191 // generate new target fd for sim_fd
201 int alloc_fd(int sim_fd, std::string filename, int flags, int mode, bool pipe);
192 int alloc_fd(int sim_fd, std::string filename, int flags, int mode,
193 bool pipe);
202
203 // free target fd (e.g., after close)
204 void free_fd(int tgt_fd);
205
206 // look up simulator fd for given target fd
207 int sim_fd(int tgt_fd);
208
209 // look up simulator fd_map object for a given target fd
194
195 // free target fd (e.g., after close)
196 void free_fd(int tgt_fd);
197
198 // look up simulator fd for given target fd
199 int sim_fd(int tgt_fd);
200
201 // look up simulator fd_map object for a given target fd
210 FdMap * sim_fd_obj(int tgt_fd);
202 FdMap *sim_fd_obj(int tgt_fd);
211
212 // fix all offsets for currently open files and save them
213 void fix_file_offsets();
214
215 // find all offsets for currently open files and save them
216 void find_file_offsets();
217
218 // set the source of this read pipe for a checkpoint resume

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

235class LiveProcess : public Process
236{
237 protected:
238 ObjectFile *objFile;
239 std::vector<std::string> argv;
240 std::vector<std::string> envp;
241 std::string cwd;
242
203
204 // fix all offsets for currently open files and save them
205 void fix_file_offsets();
206
207 // find all offsets for currently open files and save them
208 void find_file_offsets();
209
210 // set the source of this read pipe for a checkpoint resume

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

227class LiveProcess : public Process
228{
229 protected:
230 ObjectFile *objFile;
231 std::vector<std::string> argv;
232 std::vector<std::string> envp;
233 std::string cwd;
234
243 LiveProcess(LiveProcessParams * params, ObjectFile *objFile);
235 LiveProcess(LiveProcessParams *params, ObjectFile *objFile);
244
245 // Id of the owner of the process
246 uint64_t __uid;
247 uint64_t __euid;
248 uint64_t __gid;
249 uint64_t __egid;
250
251 // pid of the process and it's parent

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

311
312 virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i) = 0;
313 virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i, int width);
314 virtual void setSyscallArg(ThreadContext *tc,
315 int i, TheISA::IntReg val) = 0;
316 virtual void setSyscallReturn(ThreadContext *tc,
317 SyscallReturn return_value) = 0;
318
236
237 // Id of the owner of the process
238 uint64_t __uid;
239 uint64_t __euid;
240 uint64_t __gid;
241 uint64_t __egid;
242
243 // pid of the process and it's parent

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

303
304 virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i) = 0;
305 virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i, int width);
306 virtual void setSyscallArg(ThreadContext *tc,
307 int i, TheISA::IntReg val) = 0;
308 virtual void setSyscallReturn(ThreadContext *tc,
309 SyscallReturn return_value) = 0;
310
319 virtual SyscallDesc* getDesc(int callnum) = 0;
311 virtual SyscallDesc *getDesc(int callnum) = 0;
320
321 // this function is used to create the LiveProcess object, since
322 // we can't tell which subclass of LiveProcess to use until we
323 // open and look at the object file.
312
313 // this function is used to create the LiveProcess object, since
314 // we can't tell which subclass of LiveProcess to use until we
315 // open and look at the object file.
324 static LiveProcess *create(LiveProcessParams * params);
316 static LiveProcess *create(LiveProcessParams *params);
325};
326
327
328#endif // !FULL_SYSTEM
329
330#endif // __PROCESS_HH__
317};
318
319
320#endif // !FULL_SYSTEM
321
322#endif // __PROCESS_HH__