sim: check redirect path when unserialize for cpt
Change-Id: I55b8ce1770b0580d52b8dfa782572d492c1bf727
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "base/output.hh"
|
||||
#include "params/Process.hh"
|
||||
#include "sim/fd_entry.hh"
|
||||
#include "sim/process.hh"
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
@@ -367,7 +368,7 @@ FDArray::serialize(CheckpointOut &cp) const {
|
||||
}
|
||||
|
||||
void
|
||||
FDArray::unserialize(CheckpointIn &cp) {
|
||||
FDArray::unserialize(CheckpointIn &cp, SimObject* process_ptr) {
|
||||
ScopedCheckpointSection sec(cp, "fdarray");
|
||||
uint64_t size;
|
||||
paramIn(cp, "size", size);
|
||||
@@ -418,11 +419,25 @@ FDArray::unserialize(CheckpointIn &cp) {
|
||||
setFDEntry(tgt_fd, fdep);
|
||||
|
||||
mode_t mode = this_ffd->getFileMode();
|
||||
|
||||
std::string const& path = this_ffd->getFileName();
|
||||
|
||||
int flags = this_ffd->getFlags();
|
||||
|
||||
// Re-open the file and assign a new sim_fd
|
||||
int sim_fd = openFile(path, flags, mode);
|
||||
int sim_fd;
|
||||
if (process_ptr)
|
||||
{
|
||||
Process* ptr = static_cast<Process*>(process_ptr);
|
||||
std::string const& host_path =
|
||||
ptr->checkPathRedirect(this_ffd->getFileName());
|
||||
sim_fd = openFile(host_path, flags, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
sim_fd = openFile(path, flags, mode);
|
||||
}
|
||||
|
||||
this_ffd->setSimFD(sim_fd);
|
||||
|
||||
// Restore the file offset to the proper value
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "sim/fd_entry.hh"
|
||||
#include "sim/serialize.hh"
|
||||
#include "sim/sim_object.hh"
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
@@ -117,7 +117,11 @@ class FDArray : public Serializable
|
||||
* Serialization methods for file descriptors
|
||||
*/
|
||||
void serialize(CheckpointOut &cp) const override;
|
||||
void unserialize(CheckpointIn &cp) override;
|
||||
void unserialize(CheckpointIn &cp, SimObject* process_ptr );
|
||||
void unserialize(CheckpointIn &cp) override {
|
||||
unserialize(cp, nullptr);
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -387,7 +387,7 @@ Process::unserialize(CheckpointIn &cp)
|
||||
{
|
||||
memState->unserialize(cp);
|
||||
pTable->unserialize(cp);
|
||||
fds->unserialize(cp);
|
||||
fds->unserialize(cp, this);
|
||||
|
||||
/**
|
||||
* Checkpoints for pipes, device drivers or sockets currently
|
||||
|
||||
Reference in New Issue
Block a user