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; --- 130 unchanged lines hidden (view full) --- 139 140 public: 141 PageTable *pTable; 142 143 //This id is assigned by m5 and is used to keep process' tlb entries 144 //separated. 145 uint64_t M5_pid; 146 |
147 class FdMap 148 { 149 public: 150 int fd; 151 std::string filename; 152 int mode; 153 int flags; 154 bool isPipe; 155 int readPipeSource; 156 uint64_t fileOffset; 157 158 159 FdMap() 160 { 161 fd = -1; 162 filename = "NULL"; 163 mode = 0; 164 flags = 0; 165 isPipe = false; 166 readPipeSource = 0; 167 fileOffset = 0; 168 169 } 170 171 void serialize(std::ostream &os); 172 void unserialize(Checkpoint *cp, const std::string §ion); 173 174 }; 175 |
176 private: 177 // file descriptor remapping support |
178 static const int MAX_FD = 256; // max legal fd value 179 FdMap fd_map[MAX_FD+1]; |
180 |
181 |
182 public: 183 // static helper functions to generate file descriptors for constructor 184 static int openInputFile(const std::string &filename); 185 static int openOutputFile(const std::string &filename); 186 187 // override of virtual SimObject method: register statistics 188 virtual void regStats(); 189 190 // register a thread context for this process. 191 // returns tc's cpu number (index into threadContexts[]) 192 int registerThreadContext(ThreadContext *tc); 193 194 195 void replaceThreadContext(ThreadContext *tc, int tcIndex); 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 |
201 int alloc_fd(int sim_fd, std::string filename, int flags, int mode, 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 210 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 219 void setReadPipeSource(int read_pipe_fd, int source_fd); 220 |
221 virtual void syscall(int64_t callnum, ThreadContext *tc) = 0; 222 223 // check if the this addr is on the next available page and allocate it 224 // if it's not we'll panic 225 bool checkAndAllocNextPage(Addr vaddr); 226 227 void serialize(std::ostream &os); 228 void unserialize(Checkpoint *cp, const std::string §ion); --- 91 unchanged lines hidden --- |