process.cc (10929:b2bbfec74eca) | process.cc (10930:ddc3d96d6313) |
---|---|
1/* 2 * Copyright (c) 2014 Advanced Micro Devices, Inc. 3 * Copyright (c) 2012 ARM Limited 4 * All rights reserved 5 * 6 * The license below extends only to copyright in the software and shall 7 * not be construed as granting a license to any other intellectual 8 * property including but not limited to intellectual property relating --- 33 unchanged lines hidden (view full) --- 42 * Steve Reinhardt 43 * Ali Saidi 44 */ 45 46#include <fcntl.h> 47#include <unistd.h> 48 49#include <cstdio> | 1/* 2 * Copyright (c) 2014 Advanced Micro Devices, Inc. 3 * Copyright (c) 2012 ARM Limited 4 * All rights reserved 5 * 6 * The license below extends only to copyright in the software and shall 7 * not be construed as granting a license to any other intellectual 8 * property including but not limited to intellectual property relating --- 33 unchanged lines hidden (view full) --- 42 * Steve Reinhardt 43 * Ali Saidi 44 */ 45 46#include <fcntl.h> 47#include <unistd.h> 48 49#include <cstdio> |
50#include <map> |
|
50#include <string> 51 52#include "base/loader/object_file.hh" 53#include "base/loader/symtab.hh" 54#include "base/intmath.hh" 55#include "base/statistics.hh" 56#include "config/the_isa.hh" 57#include "cpu/thread_context.hh" --- 40 unchanged lines hidden (view full) --- 98{ 99 a_type = TheISA::htog(type); 100 a_val = TheISA::htog(val); 101} 102 103template struct AuxVector<uint32_t>; 104template struct AuxVector<uint64_t>; 105 | 51#include <string> 52 53#include "base/loader/object_file.hh" 54#include "base/loader/symtab.hh" 55#include "base/intmath.hh" 56#include "base/statistics.hh" 57#include "config/the_isa.hh" 58#include "cpu/thread_context.hh" --- 40 unchanged lines hidden (view full) --- 99{ 100 a_type = TheISA::htog(type); 101 a_val = TheISA::htog(val); 102} 103 104template struct AuxVector<uint32_t>; 105template struct AuxVector<uint64_t>; 106 |
107static int 108openFile(const string& filename, int flags, mode_t mode) 109{ 110 int sim_fd = open(filename.c_str(), flags, mode); 111 if (sim_fd != -1) 112 return sim_fd; 113 fatal("Unable to open %s with mode %O", filename, mode); 114} 115 116static int 117openInputFile(const string &filename) 118{ 119 return openFile(filename, O_RDONLY, 0); 120} 121 122static int 123openOutputFile(const string &filename) 124{ 125 return openFile(filename, O_WRONLY | O_CREAT | O_TRUNC, 0664); 126} 127 |
|
106Process::Process(ProcessParams * params) 107 : SimObject(params), system(params->system), 108 brk_point(0), stack_base(0), stack_size(0), stack_min(0), 109 max_stack_size(params->max_stack_size), 110 next_thread_stack_base(0), 111 M5_pid(system->allocatePID()), 112 useArchPT(params->useArchPT), 113 kvmInSE(params->kvmInSE), 114 pTable(useArchPT ? 115 static_cast<PageTableBase *>(new ArchPageTable(name(), M5_pid, system)) : 116 static_cast<PageTableBase *>(new FuncPageTable(name(), M5_pid)) ), 117 initVirtMem(system->getSystemPort(), this, 118 SETranslatingPortProxy::Always), | 128Process::Process(ProcessParams * params) 129 : SimObject(params), system(params->system), 130 brk_point(0), stack_base(0), stack_size(0), stack_min(0), 131 max_stack_size(params->max_stack_size), 132 next_thread_stack_base(0), 133 M5_pid(system->allocatePID()), 134 useArchPT(params->useArchPT), 135 kvmInSE(params->kvmInSE), 136 pTable(useArchPT ? 137 static_cast<PageTableBase *>(new ArchPageTable(name(), M5_pid, system)) : 138 static_cast<PageTableBase *>(new FuncPageTable(name(), M5_pid)) ), 139 initVirtMem(system->getSystemPort(), this, 140 SETranslatingPortProxy::Always), |
119 fd_map(new FdMap[NUM_FDS]) | 141 fd_array(make_shared<array<FDEntry, NUM_FDS>>()), 142 imap {{"", -1}, 143 {"cin", STDIN_FILENO}, 144 {"stdin", STDIN_FILENO}}, 145 oemap{{"", -1}, 146 {"cout", STDOUT_FILENO}, 147 {"stdout", STDOUT_FILENO}, 148 {"cerr", STDERR_FILENO}, 149 {"stderr", STDERR_FILENO}} |
120{ | 150{ |
121 string in = params->input; 122 string out = params->output; 123 string err = params->errout; | 151 int sim_fd; 152 std::map<string,int>::iterator it; |
124 | 153 |
125 // initialize file descriptors to default: same as simulator 126 int stdin_fd, stdout_fd, stderr_fd; 127 128 if (in == "stdin" || in == "cin") 129 stdin_fd = STDIN_FILENO; 130 else if (in == "None") 131 stdin_fd = -1; | 154 // Search through the input options and set fd if match is found; 155 // otherwise, open an input file and seek to location. 156 FDEntry *fde_stdin = get_fd_entry(STDIN_FILENO); 157 if ((it = imap.find(params->input)) != imap.end()) 158 sim_fd = it->second; |
132 else | 159 else |
133 stdin_fd = Process::openInputFile(in); | 160 sim_fd = openInputFile(params->input); 161 fde_stdin->set(sim_fd, params->input, O_RDONLY, -1, false); |
134 | 162 |
135 if (out == "stdout" || out == "cout") 136 stdout_fd = STDOUT_FILENO; 137 else if (out == "stderr" || out == "cerr") 138 stdout_fd = STDERR_FILENO; 139 else if (out == "None") 140 stdout_fd = -1; | 163 // Search through the output/error options and set fd if match is found; 164 // otherwise, open an output file and seek to location. 165 FDEntry *fde_stdout = get_fd_entry(STDOUT_FILENO); 166 if ((it = oemap.find(params->output)) != oemap.end()) 167 sim_fd = it->second; |
141 else | 168 else |
142 stdout_fd = Process::openOutputFile(out); | 169 sim_fd = openOutputFile(params->output); 170 fde_stdout->set(sim_fd, params->output, O_WRONLY | O_CREAT | O_TRUNC, 171 0664, false); |
143 | 172 |
144 if (err == "stdout" || err == "cout") 145 stderr_fd = STDOUT_FILENO; 146 else if (err == "stderr" || err == "cerr") 147 stderr_fd = STDERR_FILENO; 148 else if (err == "None") 149 stderr_fd = -1; 150 else if (err == out) 151 stderr_fd = stdout_fd; | 173 FDEntry *fde_stderr = get_fd_entry(STDERR_FILENO); 174 if (params->output == params->errout) 175 // Reuse the same file descriptor if these match. 176 sim_fd = fde_stdout->fd; 177 else if ((it = oemap.find(params->errout)) != oemap.end()) 178 sim_fd = it->second; |
152 else | 179 else |
153 stderr_fd = Process::openOutputFile(err); | 180 sim_fd = openOutputFile(params->errout); 181 fde_stderr->set(sim_fd, params->errout, O_WRONLY | O_CREAT | O_TRUNC, 182 0664, false); |
154 | 183 |
155 // initialize first 3 fds (stdin, stdout, stderr) 156 Process::FdMap *fdo = &fd_map[STDIN_FILENO]; 157 fdo->fd = stdin_fd; 158 fdo->filename = in; 159 fdo->flags = O_RDONLY; 160 fdo->mode = -1; 161 fdo->fileOffset = 0; 162 163 fdo = &fd_map[STDOUT_FILENO]; 164 fdo->fd = stdout_fd; 165 fdo->filename = out; 166 fdo->flags = O_WRONLY | O_CREAT | O_TRUNC; 167 fdo->mode = 0774; 168 fdo->fileOffset = 0; 169 170 fdo = &fd_map[STDERR_FILENO]; 171 fdo->fd = stderr_fd; 172 fdo->filename = err; 173 fdo->flags = O_WRONLY; 174 fdo->mode = -1; 175 fdo->fileOffset = 0; 176 177 178 // mark remaining fds as free 179 for (int i = 3; i < NUM_FDS; ++i) { 180 fdo = &fd_map[i]; 181 fdo->fd = -1; 182 } 183 | |
184 mmap_start = mmap_end = 0; 185 nxm_start = nxm_end = 0; 186 // other parameters will be initialized when the program is loaded 187} 188 189 190void 191Process::regStats() 192{ 193 using namespace Stats; 194 195 num_syscalls 196 .name(name() + ".num_syscalls") 197 .desc("Number of system calls") 198 ; 199} 200 | 184 mmap_start = mmap_end = 0; 185 nxm_start = nxm_end = 0; 186 // other parameters will be initialized when the program is loaded 187} 188 189 190void 191Process::regStats() 192{ 193 using namespace Stats; 194 195 num_syscalls 196 .name(name() + ".num_syscalls") 197 .desc("Number of system calls") 198 ; 199} 200 |
201// 202// static helper functions 203// 204 205int 206Process::openInputFile(const string &filename) | 201void 202Process::inheritFdArray(Process *p) |
207{ | 203{ |
208 int fd = open(filename.c_str(), O_RDONLY); 209 210 if (fd == -1) { 211 perror(NULL); 212 cerr << "unable to open \"" << filename << "\" for reading\n"; 213 fatal("can't open input file"); 214 } 215 216 return fd; | 204 fd_array = p->fd_array; |
217} 218 | 205} 206 |
219 220int 221Process::openOutputFile(const string &filename) 222{ 223 int fd = open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0664); 224 225 if (fd == -1) { 226 perror(NULL); 227 cerr << "unable to open \"" << filename << "\" for writing\n"; 228 fatal("can't open output file"); 229 } 230 231 return fd; 232} 233 | |
234ThreadContext * 235Process::findFreeContext() 236{ 237 for (int id : contextIds) { 238 ThreadContext *tc = system->getThreadContext(id); 239 if (tc->status() == ThreadContext::Halted) 240 return tc; 241 } --- 21 unchanged lines hidden (view full) --- 263 find_file_offsets(); 264 return DrainState::Drained; 265} 266 267int 268Process::alloc_fd(int sim_fd, const string& filename, int flags, int mode, 269 bool pipe) 270{ | 207ThreadContext * 208Process::findFreeContext() 209{ 210 for (int id : contextIds) { 211 ThreadContext *tc = system->getThreadContext(id); 212 if (tc->status() == ThreadContext::Halted) 213 return tc; 214 } --- 21 unchanged lines hidden (view full) --- 236 find_file_offsets(); 237 return DrainState::Drained; 238} 239 240int 241Process::alloc_fd(int sim_fd, const string& filename, int flags, int mode, 242 bool pipe) 243{ |
271 // in case open() returns an error, don't allocate a new fd | |
272 if (sim_fd == -1) 273 return -1; 274 | 244 if (sim_fd == -1) 245 return -1; 246 |
275 // find first free target fd 276 for (int free_fd = 0; free_fd < NUM_FDS; ++free_fd) { 277 Process::FdMap *fdo = &fd_map[free_fd]; 278 if (fdo->fd == -1 && fdo->driver == NULL) { 279 fdo->fd = sim_fd; 280 fdo->filename = filename; 281 fdo->mode = mode; 282 fdo->fileOffset = 0; 283 fdo->flags = flags; 284 fdo->isPipe = pipe; 285 fdo->readPipeSource = 0; | 247 for (int free_fd = 0; free_fd < fd_array->size(); free_fd++) { 248 FDEntry *fde = get_fd_entry(free_fd); 249 if (fde->isFree()) { 250 fde->set(sim_fd, filename, flags, mode, pipe); |
286 return free_fd; 287 } 288 } 289 | 251 return free_fd; 252 } 253 } 254 |
290 panic("Process::alloc_fd: out of file descriptors!"); | 255 fatal("Out of target file descriptors"); |
291} 292 293void | 256} 257 258void |
294Process::free_fdmap_entry(int tgt_fd) | 259Process::reset_fd_entry(int tgt_fd) |
295{ | 260{ |
296 Process::FdMap *fdo = &fd_map[tgt_fd]; 297 assert(fd_map[tgt_fd].fd > -1); | 261 FDEntry *fde = get_fd_entry(tgt_fd); 262 assert(fde->fd > -1); |
298 | 263 |
299 fdo->fd = -1; 300 fdo->filename = "NULL"; 301 fdo->mode = 0; 302 fdo->fileOffset = 0; 303 fdo->flags = 0; 304 fdo->isPipe = false; 305 fdo->readPipeSource = 0; 306 fdo->driver = NULL; | 264 fde->reset(); |
307} 308 309int 310Process::sim_fd(int tgt_fd) 311{ | 265} 266 267int 268Process::sim_fd(int tgt_fd) 269{ |
312 FdMap *obj = sim_fd_obj(tgt_fd); 313 return obj ? obj->fd : -1; | 270 FDEntry *entry = get_fd_entry(tgt_fd); 271 return entry ? entry->fd : -1; |
314} 315 | 272} 273 |
316Process::FdMap * 317Process::sim_fd_obj(int tgt_fd) | 274FDEntry * 275Process::get_fd_entry(int tgt_fd) |
318{ | 276{ |
319 if (tgt_fd < 0 || tgt_fd >= NUM_FDS) 320 return NULL; 321 return &fd_map[tgt_fd]; | 277 assert(0 <= tgt_fd && tgt_fd < fd_array->size()); 278 return &(*fd_array)[tgt_fd]; |
322} 323 324int 325Process::tgt_fd(int sim_fd) 326{ | 279} 280 281int 282Process::tgt_fd(int sim_fd) 283{ |
327 for (int index = 0; index < NUM_FDS; ++index) 328 if (fd_map[index].fd == sim_fd) | 284 for (int index = 0; index < fd_array->size(); index++) 285 if ((*fd_array)[index].fd == sim_fd) |
329 return index; 330 return -1; 331} 332 333void 334Process::allocateMem(Addr vaddr, int64_t size, bool clobber) 335{ 336 int npages = divCeil(size, (int64_t)PageBytes); --- 21 unchanged lines hidden (view full) --- 358 allocateMem(stack_min, TheISA::PageBytes); 359 inform("Increasing stack size by one page."); 360 }; 361 return true; 362 } 363 return false; 364} 365 | 286 return index; 287 return -1; 288} 289 290void 291Process::allocateMem(Addr vaddr, int64_t size, bool clobber) 292{ 293 int npages = divCeil(size, (int64_t)PageBytes); --- 21 unchanged lines hidden (view full) --- 315 allocateMem(stack_min, TheISA::PageBytes); 316 inform("Increasing stack size by one page."); 317 }; 318 return true; 319 } 320 return false; 321} 322 |
366// find all offsets for currently open files and save them | |
367void 368Process::fix_file_offsets() 369{ | 323void 324Process::fix_file_offsets() 325{ |
370 Process::FdMap *fdo_stdin = &fd_map[STDIN_FILENO]; 371 Process::FdMap *fdo_stdout = &fd_map[STDOUT_FILENO]; 372 Process::FdMap *fdo_stderr = &fd_map[STDERR_FILENO]; 373 string in = fdo_stdin->filename; 374 string out = fdo_stdout->filename; 375 string err = fdo_stderr->filename; | 326 auto seek = [] (FDEntry *fde) 327 { 328 if (lseek(fde->fd, fde->fileOffset, SEEK_SET) < 0) 329 fatal("Unable to see to location in %s", fde->filename); 330 }; |
376 | 331 |
377 // initialize file descriptors to default: same as simulator 378 int stdin_fd, stdout_fd, stderr_fd; | 332 std::map<string,int>::iterator it; |
379 | 333 |
380 if (in == "stdin" || in == "cin") 381 stdin_fd = STDIN_FILENO; 382 else if (in == "NULL") 383 stdin_fd = -1; 384 else { 385 // open standard in and seek to the right location 386 stdin_fd = Process::openInputFile(in); 387 if (lseek(stdin_fd, fdo_stdin->fileOffset, SEEK_SET) < 0) 388 panic("Unable to seek to correct location in file: %s", in); | 334 // Search through the input options and set fd if match is found; 335 // otherwise, open an input file and seek to location. 336 FDEntry *fde_stdin = get_fd_entry(STDIN_FILENO); 337 if ((it = imap.find(fde_stdin->filename)) != imap.end()) { 338 fde_stdin->fd = it->second; 339 } else { 340 fde_stdin->fd = openInputFile(fde_stdin->filename); 341 seek(fde_stdin); |
389 } 390 | 342 } 343 |
391 if (out == "stdout" || out == "cout") 392 stdout_fd = STDOUT_FILENO; 393 else if (out == "stderr" || out == "cerr") 394 stdout_fd = STDERR_FILENO; 395 else if (out == "NULL") 396 stdout_fd = -1; 397 else { 398 stdout_fd = Process::openOutputFile(out); 399 if (lseek(stdout_fd, fdo_stdout->fileOffset, SEEK_SET) < 0) 400 panic("Unable to seek to correct location in file: %s", out); | 344 // Search through the output/error options and set fd if match is found; 345 // otherwise, open an output file and seek to location. 346 FDEntry *fde_stdout = get_fd_entry(STDOUT_FILENO); 347 if ((it = oemap.find(fde_stdout->filename)) != oemap.end()) { 348 fde_stdout->fd = it->second; 349 } else { 350 fde_stdout->fd = openOutputFile(fde_stdout->filename); 351 seek(fde_stdout); |
401 } 402 | 352 } 353 |
403 if (err == "stdout" || err == "cout") 404 stderr_fd = STDOUT_FILENO; 405 else if (err == "stderr" || err == "cerr") 406 stderr_fd = STDERR_FILENO; 407 else if (err == "NULL") 408 stderr_fd = -1; 409 else if (err == out) 410 stderr_fd = stdout_fd; 411 else { 412 stderr_fd = Process::openOutputFile(err); 413 if (lseek(stderr_fd, fdo_stderr->fileOffset, SEEK_SET) < 0) 414 panic("Unable to seek to correct location in file: %s", err); | 354 FDEntry *fde_stderr = get_fd_entry(STDERR_FILENO); 355 if (fde_stdout->filename == fde_stderr->filename) { 356 // Reuse the same file descriptor if these match. 357 fde_stderr->fd = fde_stdout->fd; 358 } else if ((it = oemap.find(fde_stderr->filename)) != oemap.end()) { 359 fde_stderr->fd = it->second; 360 } else { 361 fde_stderr->fd = openOutputFile(fde_stderr->filename); 362 seek(fde_stderr); |
415 } 416 | 363 } 364 |
417 fdo_stdin->fd = stdin_fd; 418 fdo_stdout->fd = stdout_fd; 419 fdo_stderr->fd = stderr_fd; | 365 for (int tgt_fd = 3; tgt_fd < fd_array->size(); tgt_fd++) { 366 FDEntry *fde = get_fd_entry(tgt_fd); 367 if (fde->fd == -1) 368 continue; |
420 | 369 |
370 if (fde->isPipe) { 371 if (fde->filename == "PIPE-WRITE") 372 continue; 373 assert(fde->filename == "PIPE-READ"); |
|
421 | 374 |
422 for (int free_fd = 3; free_fd < NUM_FDS; ++free_fd) { 423 Process::FdMap *fdo = &fd_map[free_fd]; 424 if (fdo->fd != -1) { 425 if (fdo->isPipe){ 426 if (fdo->filename == "PIPE-WRITE") 427 continue; 428 else { 429 assert (fdo->filename == "PIPE-READ"); 430 //create a new pipe 431 int fds[2]; 432 int pipe_retval = pipe(fds); | 375 int fds[2]; 376 if (pipe(fds) < 0) 377 fatal("Unable to create new pipe"); |
433 | 378 |
434 if (pipe_retval < 0) { 435 // error 436 panic("Unable to create new pipe."); 437 } 438 fdo->fd = fds[0]; //set read pipe 439 Process::FdMap *fdo_write = &fd_map[fdo->readPipeSource]; 440 if (fdo_write->filename != "PIPE-WRITE") 441 panic ("Couldn't find write end of the pipe"); | 379 fde->fd = fds[0]; |
442 | 380 |
443 fdo_write->fd = fds[1];//set write pipe 444 } 445 } else { 446 //Open file 447 int fd = open(fdo->filename.c_str(), fdo->flags, fdo->mode); 448 449 if (fd == -1) 450 panic("Unable to open file: %s", fdo->filename); 451 fdo->fd = fd; 452 453 //Seek to correct location before checkpoint 454 if (lseek(fd, fdo->fileOffset, SEEK_SET) < 0) 455 panic("Unable to seek to correct location in file: %s", 456 fdo->filename); 457 } | 381 FDEntry *fde_write = get_fd_entry(fde->readPipeSource); 382 assert(fde_write->filename == "PIPE-WRITE"); 383 fde_write->fd = fds[1]; 384 } else { 385 fde->fd = openFile(fde->filename.c_str(), fde->flags, fde->mode); 386 seek(fde); |
458 } 459 } 460} 461 462void 463Process::find_file_offsets() 464{ | 387 } 388 } 389} 390 391void 392Process::find_file_offsets() 393{ |
465 for (int free_fd = 0; free_fd < NUM_FDS; ++free_fd) { 466 Process::FdMap *fdo = &fd_map[free_fd]; 467 if (fdo->fd != -1) { 468 fdo->fileOffset = lseek(fdo->fd, 0, SEEK_CUR); 469 } else { 470 fdo->filename = "NULL"; 471 fdo->fileOffset = 0; 472 } | 394 for (auto& fde : *fd_array) { 395 if (fde.fd != -1) 396 fde.fileOffset = lseek(fde.fd, 0, SEEK_CUR); |
473 } 474} 475 476void 477Process::setReadPipeSource(int read_pipe_fd, int source_fd) 478{ | 397 } 398} 399 400void 401Process::setReadPipeSource(int read_pipe_fd, int source_fd) 402{ |
479 Process::FdMap *fdo = &fd_map[read_pipe_fd]; 480 fdo->readPipeSource = source_fd; | 403 FDEntry *fde = get_fd_entry(read_pipe_fd); 404 assert(source_fd >= -1); 405 fde->readPipeSource = source_fd; |
481} 482 483void | 406} 407 408void |
484Process::FdMap::serialize(CheckpointOut &cp) const 485{ 486 SERIALIZE_SCALAR(fd); 487 SERIALIZE_SCALAR(isPipe); 488 SERIALIZE_SCALAR(filename); 489 SERIALIZE_SCALAR(flags); 490 SERIALIZE_SCALAR(readPipeSource); 491 SERIALIZE_SCALAR(fileOffset); 492} 493 494void 495Process::FdMap::unserialize(CheckpointIn &cp) 496{ 497 UNSERIALIZE_SCALAR(fd); 498 UNSERIALIZE_SCALAR(isPipe); 499 UNSERIALIZE_SCALAR(filename); 500 UNSERIALIZE_SCALAR(flags); 501 UNSERIALIZE_SCALAR(readPipeSource); 502 UNSERIALIZE_SCALAR(fileOffset); 503} 504 505void | |
506Process::serialize(CheckpointOut &cp) const 507{ 508 SERIALIZE_SCALAR(brk_point); 509 SERIALIZE_SCALAR(stack_base); 510 SERIALIZE_SCALAR(stack_size); 511 SERIALIZE_SCALAR(stack_min); 512 SERIALIZE_SCALAR(next_thread_stack_base); 513 SERIALIZE_SCALAR(mmap_start); 514 SERIALIZE_SCALAR(mmap_end); 515 SERIALIZE_SCALAR(nxm_start); 516 SERIALIZE_SCALAR(nxm_end); 517 pTable->serialize(cp); | 409Process::serialize(CheckpointOut &cp) const 410{ 411 SERIALIZE_SCALAR(brk_point); 412 SERIALIZE_SCALAR(stack_base); 413 SERIALIZE_SCALAR(stack_size); 414 SERIALIZE_SCALAR(stack_min); 415 SERIALIZE_SCALAR(next_thread_stack_base); 416 SERIALIZE_SCALAR(mmap_start); 417 SERIALIZE_SCALAR(mmap_end); 418 SERIALIZE_SCALAR(nxm_start); 419 SERIALIZE_SCALAR(nxm_end); 420 pTable->serialize(cp); |
518 for (int x = 0; x < NUM_FDS; x++) { 519 fd_map[x].serializeSection(cp, csprintf("FdMap%d", x)); | 421 for (int x = 0; x < fd_array->size(); x++) { 422 (*fd_array)[x].serializeSection(cp, csprintf("FDEntry%d", x)); |
520 } 521 SERIALIZE_SCALAR(M5_pid); 522 523} 524 525void 526Process::unserialize(CheckpointIn &cp) 527{ 528 UNSERIALIZE_SCALAR(brk_point); 529 UNSERIALIZE_SCALAR(stack_base); 530 UNSERIALIZE_SCALAR(stack_size); 531 UNSERIALIZE_SCALAR(stack_min); 532 UNSERIALIZE_SCALAR(next_thread_stack_base); 533 UNSERIALIZE_SCALAR(mmap_start); 534 UNSERIALIZE_SCALAR(mmap_end); 535 UNSERIALIZE_SCALAR(nxm_start); 536 UNSERIALIZE_SCALAR(nxm_end); 537 pTable->unserialize(cp); | 423 } 424 SERIALIZE_SCALAR(M5_pid); 425 426} 427 428void 429Process::unserialize(CheckpointIn &cp) 430{ 431 UNSERIALIZE_SCALAR(brk_point); 432 UNSERIALIZE_SCALAR(stack_base); 433 UNSERIALIZE_SCALAR(stack_size); 434 UNSERIALIZE_SCALAR(stack_min); 435 UNSERIALIZE_SCALAR(next_thread_stack_base); 436 UNSERIALIZE_SCALAR(mmap_start); 437 UNSERIALIZE_SCALAR(mmap_end); 438 UNSERIALIZE_SCALAR(nxm_start); 439 UNSERIALIZE_SCALAR(nxm_end); 440 pTable->unserialize(cp); |
538 for (int x = 0; x < NUM_FDS; x++) { 539 fd_map[x].unserializeSection(cp, csprintf("FdMap%d", x)); | 441 for (int x = 0; x < fd_array->size(); x++) { 442 FDEntry *fde = get_fd_entry(x); 443 fde->unserializeSection(cp, csprintf("FDEntry%d", x)); |
540 } 541 fix_file_offsets(); 542 UNSERIALIZE_OPT_SCALAR(M5_pid); 543 // The above returns a bool so that you could do something if you don't 544 // find the param in the checkpoint if you wanted to, like set a default | 444 } 445 fix_file_offsets(); 446 UNSERIALIZE_OPT_SCALAR(M5_pid); 447 // The above returns a bool so that you could do something if you don't 448 // find the param in the checkpoint if you wanted to, like set a default |
545 // but in this case we'll just stick with the instantianted value if not | 449 // but in this case we'll just stick with the instantiated value if not |
546 // found. 547} 548 549 550bool 551Process::map(Addr vaddr, Addr paddr, int size, bool cacheable) 552{ 553 pTable->map(vaddr, paddr, size, --- 220 unchanged lines hidden --- | 450 // found. 451} 452 453 454bool 455Process::map(Addr vaddr, Addr paddr, int size, bool cacheable) 456{ 457 pTable->map(vaddr, paddr, size, --- 220 unchanged lines hidden --- |