From Msim

Revision as of 22:12, 7 December 2009 by Jloew (Talk | contribs)
Jump to: navigation, search

This page refers to the changes made in the 3.0.13 release of M-sim.

Release Date:



EIO Handler

The EIO code has been modified to support the retention of file descriptors.


All EIO files that support this are marked as file version 4. This is internally referred to as "EIO_FILE_VERSION_NEW" (this name will change after testing).

Version 3 EIO files are still supported if they do not require the file descriptors to be repaired. Note that syscall traces were never really well supported in M-sim and were usually ignored (or not ignored by crashing).


The file descriptors are stored in the EIO file as follows (refer to file_table.c):

(<Number of entries>, <entry0>, <entry1>, <entry2>, ..., <entryN>)


<Number of entries> is the number of file descriptors that a context has access to (file_table_t::entries.size())


<entryX> refers to the Xth entry in file_table_t::entries (which is a vector of type file_entry_t)

All contexts have a minimum of 3 entries (stdin, stdout, stderr):

(3, <entry0>, <entry1>, <entry2>)


file_entry_t represents an open file descriptor with the following members:

md_gpr_t simulated_fd;                 //The file descriptor as seen by the simulated program
md_gpr_t real_fd;                      //The file descriptor as seen by the simulator (the "real" file descriptor)
std::string filename;                  //A string containing the name of the file that file descriptor represents
int flags;                             //The flags used to open the file (if applicable, used by open)
int mode;                              //The mode used to open the file (if applicable, used by open)
std::string open_string;               //The string used to open the file (if applicable, used by fopen)
unsigned long long reserved;           //This is a bit field that provides additional information about the file descriptor
 #define FE_FILE              0x00000  //This is a normal file
 #define FE_STANDARD_IO       0x00001  //This is stdin/stdout/stderr
 #define FE_FILE_ATTACHED     0x10000  //Not used during simulation. Indicates that the file should be extracted from the eio file rather than expected to be found.

Obsolete Code

file_table.c and file_table.h replace "translation_table" and "name_table" objects that were part of a context. file_table_t is the object that replaces this.
Redirection replacement now comes from file_table_t rather than the context.
EIO file descriptor handling in syscall.c is no longer needed.

File Table

Personal tools