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

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

254 ThreadContext *tc = system->getThreadContext(contextIds[0]);
255
256 // mark this context as active so it will start ticking.
257 tc->activate();
258
259 pTable->initState(tc);
260}
261
262unsigned int
263Process::drain(DrainManager *dm)
264{
265 find_file_offsets();
266 return 0;
267}
268
269// map simulator fd sim_fd to target fd tgt_fd
270void
271Process::dup_fd(int sim_fd, int tgt_fd)
272{
273 if (tgt_fd < 0 || tgt_fd > MAX_FD)
274 panic("Process::dup_fd tried to dup past MAX_FD (%d)", tgt_fd);
275
276 Process::FdMap *fdo = &fd_map[tgt_fd];

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

490void
491Process::setReadPipeSource(int read_pipe_fd, int source_fd)
492{
493 Process::FdMap *fdo = &fd_map[read_pipe_fd];
494 fdo->readPipeSource = source_fd;
495}
496
497void
491Process::FdMap::serialize(std::ostream &os)
498Process::FdMap::serialize(CheckpointOut &cp) const
499{
500 SERIALIZE_SCALAR(fd);
501 SERIALIZE_SCALAR(isPipe);
502 SERIALIZE_SCALAR(filename);
503 SERIALIZE_SCALAR(flags);
504 SERIALIZE_SCALAR(readPipeSource);
505 SERIALIZE_SCALAR(fileOffset);
506}
507
508void
502Process::FdMap::unserialize(Checkpoint *cp, const std::string &section)
509Process::FdMap::unserialize(CheckpointIn &cp)
510{
511 UNSERIALIZE_SCALAR(fd);
512 UNSERIALIZE_SCALAR(isPipe);
513 UNSERIALIZE_SCALAR(filename);
514 UNSERIALIZE_SCALAR(flags);
515 UNSERIALIZE_SCALAR(readPipeSource);
516 UNSERIALIZE_SCALAR(fileOffset);
517}
518
519void
513Process::serialize(std::ostream &os)
520Process::serialize(CheckpointOut &cp) const
521{
522 SERIALIZE_SCALAR(brk_point);
523 SERIALIZE_SCALAR(stack_base);
524 SERIALIZE_SCALAR(stack_size);
525 SERIALIZE_SCALAR(stack_min);
526 SERIALIZE_SCALAR(next_thread_stack_base);
527 SERIALIZE_SCALAR(mmap_start);
528 SERIALIZE_SCALAR(mmap_end);
529 SERIALIZE_SCALAR(nxm_start);
530 SERIALIZE_SCALAR(nxm_end);
524 find_file_offsets();
525 pTable->serialize(os);
531 pTable->serialize(cp);
532 for (int x = 0; x <= MAX_FD; x++) {
527 nameOut(os, csprintf("%s.FdMap%d", name(), x));
528 fd_map[x].serialize(os);
533 fd_map[x].serializeSection(cp, csprintf("FdMap%d", x));
534 }
535 SERIALIZE_SCALAR(M5_pid);
536
537}
538
539void
535Process::unserialize(Checkpoint *cp, const std::string &section)
540Process::unserialize(CheckpointIn &cp)
541{
542 UNSERIALIZE_SCALAR(brk_point);
543 UNSERIALIZE_SCALAR(stack_base);
544 UNSERIALIZE_SCALAR(stack_size);
545 UNSERIALIZE_SCALAR(stack_min);
546 UNSERIALIZE_SCALAR(next_thread_stack_base);
547 UNSERIALIZE_SCALAR(mmap_start);
548 UNSERIALIZE_SCALAR(mmap_end);
549 UNSERIALIZE_SCALAR(nxm_start);
550 UNSERIALIZE_SCALAR(nxm_end);
546 pTable->unserialize(cp, section);
551 pTable->unserialize(cp);
552 for (int x = 0; x <= MAX_FD; x++) {
548 fd_map[x].unserialize(cp, csprintf("%s.FdMap%d", section, x));
553 fd_map[x].unserializeSection(cp, csprintf("FdMap%d", x));
554 }
555 fix_file_offsets();
556 UNSERIALIZE_OPT_SCALAR(M5_pid);
557 // The above returns a bool so that you could do something if you don't
558 // find the param in the checkpoint if you wanted to, like set a default
559 // but in this case we'll just stick with the instantianted value if not
560 // found.
561}

--- 226 unchanged lines hidden ---