3.0.13

From Msim

(Difference between revisions)
Jump to: navigation, search
m
m (Syscalls)
Line 5: Line 5:
== Syscalls ==
== Syscalls ==
 +
 +
=== OSF_SYS_UTSNAME, OSF_SYS_UNAME ===
 +
These syscalls no longer use the host's uname call. Instead, we copy the answer (as given on Tru64 V5.1 machine) to memory as class osf_utsname.
=== OSF_SYS_FORK, OSF_SYS_WAIT, OSF_SYS_KILL ===
=== OSF_SYS_FORK, OSF_SYS_WAIT, OSF_SYS_KILL ===
Line 41: Line 44:
**core_t::ejectcontext(...) is now public. It is needed by syscall kill
**core_t::ejectcontext(...) is now public. It is needed by syscall kill
**core_t now has a copy constructor. It is not necessarily complete at this time.
**core_t now has a copy constructor. It is not necessarily complete at this time.
-
 
== EIO Handler ==
== EIO Handler ==

Revision as of 22:10, 8 December 2009

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

Release Date:

Contents

Syscalls

OSF_SYS_UTSNAME, OSF_SYS_UNAME

These syscalls no longer use the host's uname call. Instead, we copy the answer (as given on Tru64 V5.1 machine) to memory as class osf_utsname.

OSF_SYS_FORK, OSF_SYS_WAIT, OSF_SYS_KILL

Some support for fork(), wait() and kill() has been added:

  • smt.h
    • context now has a copy constructor
    • context now contains "unsigned long long pid;" to reflect the process' simulated process_id
    • FILE* argfile is removed from context
    • context now contains "std::vector<unsigned long long> child_pids;" to retain process_ids for child processes. This is needed for wait().
    • init_context no longer takes a register file as an argument
  • smt.c
    • files are no longer closed by the context during destruction
    • dlite_evaluator is not destroyed by context destruction - this needs to be fixed
    • replace_with_redirect is removed
    • init_context no longer takes a register file as an argument
  • sim-outorder.c
    • init_context no longer takes a register file as an argument
  • main.c
    • The environmental variables accessible by envp are now placed into a vector (std::vector<std::string> * v_envp)
    • void init_thread(...) takes "std::vector<std::string> env" as the first parameter instead of "char *env[]". This is intentionally passed by value but may be passed by reference in the future.
    • FILE* argfile (which is removed from class context) no longer stores itself to a context. It is isolated in usage to main.c
    • Locations where context::translation_table was used have been replaced to use context::file_table instead
    • main() gets envp as "char ** envptemp", this is just to avoid changes later in the code. envp is created early in main() as a vector with the appropriate data.
  • loader.h
    • void ld_load_prog() now takes "std::vector<std::string> envp" as the third parameter instead of "char ** envp". This is intentionally passed by value but may be passed by reference in the future.
  • loader.c
    • target-alpha/ecoff.h now resides at ./ecoff.h. The directory target-alpha is now phased out.
    • void ld_load_prog() now takes "std::vector<std::string> envp" as the third parameter instead of "char ** envp". This is intentionally passed by value but may be passed by reference in the future.
  • cmp.h
    • core_t::ejectcontext(...) is now public. It is needed by syscall kill
    • core_t now has a copy constructor. It is not necessarily complete at this time.

EIO Handler

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

Versioning

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).

Format

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

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

Where

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

And

<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

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

Changes

  • eio.c
    • eio_open
      • now returns an int (the version number of the eio file) instead of void.
      • now checks for version 3 or version 4
    • eio_write_chkpt
      • now generates files using version 4 - uses version number 4 and writes the translation table to the checkpoint file
    • eio_read_chkpt
      • now takes version number as a parameter - this will likely be changed in the future (merged into eio_open)
      • reads translation table if the version is 4
  • eio.h
    • eio_open changed to return an int
    • eio_read_chkpt changed to take a version (as an int) as a parameter.
  • loader.c
    • call to eio_open now retains return value, this is used to pass into eio_read_chkpt (ld_load_prog)
  • smt.h
    • Instead of std::map<md_gpr_t, md_gpr_t> translation_table, std::vector<std::pair<md_gpr_t,std::string> > name_table and bool replace_with_redirect(md_gpr_t & source), class context now contains "file_table_t file_table;"
  • main.c
    • Entire simulation redirection (via sim_progfd and sim_progerrfd) now use open instead of fopen. They are now type md_gpr_t instead of FILE*.
  • sim-outorder.c
    • Option "-makeeio <string>" has been added. It creates an eio file after fast forwarding of the first context.


Rollback Support

Rollback does not work properly when rolling back unaligned accesses (this does not affect prior versions as they don't let unaligned accesses execute anyway). This does not refer to ldq_u or stq_u but rather the usage of ldq (and other loads/stores) on an unaligned address. Rollback was unable to acquire the data needed to restore precise state.
memory.h and memory.c are provided "mem_access_direct()" that allows unaligned accesses to memory.

Other Changes

  • sim.h
    • Now includes cmp.h, this is to declare "std::vector<core_t> cores;" as an extern.
    • "loader_t loader;" is declared here as an extern
    • void sim_load_prog(...) now takes "std::vector<std::string>envp" as the third parameter instead of "char **envp". This is passed by value - it may be changed in the future.


  • sim-outorder.c
    • void sim_load_prog(...) now takes "std::vector<std::string>envp" as the third parameter instead of "char **envp". This is passed by value - it may be changed in the future.
  • memory.h
    • mem_t now has a copy constructor
    • mem_t::ld_prog_fname is no longer "char *" it is now "std::string"
    • The following are no longer "unsigned int" but are now "unsigned long long": ld_text_size, ld_data_size, ld_stack_size.
  • loader.c
    • Changes to variables in memory.h (from unsigned int to unsigned long long) must use "stat_reg_qword" instead of "stat_reg_unit"
  • dlite.c
    • Various changes where std::string needed to be converted to a "char *".
  • symbol.h
    • sym_loadsyms() now takes its first parameter as a const
  • symbol.c
    • sym_loadsyms() now takes its first parameter as a const
    • target-alpha/ecoff.h now resides at ./ecoff.h. The directory target-alpha is now phased out.
  • range.c
    • Various changes where std::string needed to be converted to a "char *".
  • cmp.h
    • "std::vector<context *> contexts;" is no longer retained.
  • sim-outorder.c
    • Since core_t no longer has "std::vector<context *> contexts;", we must use core_t::context_ids when checking in sim_main() for "Assert that contexts on each core is valid"
  • bpred.h
    • bpred_recover() is no longer a member of bpred_t, it is now a member of retstack. It is now named recover. This was used in rollback (cmp.c)
    • btb is now an independent object defined in btb.h and btb.c. The appropriate changes have been made.
    • retstack is now an independent object defined in retstack.h and retstack.c. The appropriate changes have been made.
  • memory.c
    • In operator<<, output of the memory pages now outputs 32 bytes per line instead of 38.
Personal tools