3.0.14

From Msim

(Difference between revisions)
Jump to: navigation, search
m
Line 5: Line 5:
== Syscalls ==
== Syscalls ==
 +
OSF_SYS_ioctl::TIOCISATTY returns TTY for redirected outputs. When not a TTY, the return values were reversed (return register should be ENOTTY and A3 should be 1).<br>
 +
OSF_SYS_execve now clears register UNIQ, clears allocated memory (except pages marked by MAP_INHERIT).<br>
 +
 +
== Loader ==
 +
envp and argv are zeroed out (if we write "a", the next 7 bytes (quadword aligned) are set to 0). This did not appear necessary but makes the trace more accurate compared to the native machine.<br>
 +
 +
== PID Handler ==
 +
A process id handler has been provided. This adds proper support for OSF_SYS_wait4. The PID handler retains return values for processes that terminate and allow them to be recovered - or test for their existence (to avoid having to have the thread continually enter the pipeline). Various places required updates for this:
 +
smt.h/smt.c:    contexts now retain their own pid
 +
sim-outorder.c: context initialization acquires a pid
 +
                pids are used to check if a context is still alive
 +
syscall.c:      OSF_SYS_exit now clears a pid on termination, stores return values
 +
                OSF_SYS_kill is able to kill a context, nothing is done about return values at this point
 +
                OSF_SYS_wait4 can check for a particular child process (or -1 for any child) as well as acquire the proper return value
 +
                OSF_SYS_fork acquires pids for the child as well as adds the child pid to the parent's pid list
 +
 +
== Memory Mapping ==
 +
Memory mapping has been moved out of syscall.c. Memory mapping is largely supported at this time (FIXED, PRIVATE, ANON, SHARED, location hints, etc). FIXED mappings are slightly hacked together. If a FIXED mapping overlaps an old mapping, it is suppose to deallocate the prior pages and replace them with itself. We do not handle the deallocate but itself place the mapping at the front of the mapping list (ensuring it is accessed first). If this mapping is unmapped, the old mapping would then be accessed - no segmentation fault would occur (should it?). Since there is no real mapping applied in the FIXED case, this probably is ok.
== EIO Handler ==
== EIO Handler ==

Revision as of 00:06, 22 January 2010

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

Release Date:

Contents

Syscalls

OSF_SYS_ioctl::TIOCISATTY returns TTY for redirected outputs. When not a TTY, the return values were reversed (return register should be ENOTTY and A3 should be 1).
OSF_SYS_execve now clears register UNIQ, clears allocated memory (except pages marked by MAP_INHERIT).

Loader

envp and argv are zeroed out (if we write "a", the next 7 bytes (quadword aligned) are set to 0). This did not appear necessary but makes the trace more accurate compared to the native machine.

PID Handler

A process id handler has been provided. This adds proper support for OSF_SYS_wait4. The PID handler retains return values for processes that terminate and allow them to be recovered - or test for their existence (to avoid having to have the thread continually enter the pipeline). Various places required updates for this:

smt.h/smt.c:    contexts now retain their own pid
sim-outorder.c: context initialization acquires a pid
                pids are used to check if a context is still alive
syscall.c:      OSF_SYS_exit now clears a pid on termination, stores return values
                OSF_SYS_kill is able to kill a context, nothing is done about return values at this point
                OSF_SYS_wait4 can check for a particular child process (or -1 for any child) as well as acquire the proper return value
                OSF_SYS_fork acquires pids for the child as well as adds the child pid to the parent's pid list

Memory Mapping

Memory mapping has been moved out of syscall.c. Memory mapping is largely supported at this time (FIXED, PRIVATE, ANON, SHARED, location hints, etc). FIXED mappings are slightly hacked together. If a FIXED mapping overlaps an old mapping, it is suppose to deallocate the prior pages and replace them with itself. We do not handle the deallocate but itself place the mapping at the front of the mapping list (ensuring it is accessed first). If this mapping is unmapped, the old mapping would then be accessed - no segmentation fault would occur (should it?). Since there is no real mapping applied in the FIXED case, this probably is ok.

EIO Handler

File Table

Pipes are now handled (somewhat) in the file tables (sockets are still not well supported). Pipes are identified using "FE_PIPE" in file_table.h.

#define FE_PIPE				0x00010

Additional functionality has been added: copy_from(...) allows a file table to be copied from one context to another - this is needed for forking.

		void copy_from(const file_table_t & rhs);

dup2(...) is used to implement the dup2 system call.

		md_gpr_t dup2(unsigned int handle_old, unsigned int handle_new);

insert(...) adds a file descriptor (using its real value) into the file table with an associated name. This is used with pipe to give the file descriptors to a context.

		void insert(md_gpr_t fd, std::string name);

closeall() is used when a process terminates to close all of its open files.

		void closeall();

Fixed a bug in file_table_t::opener(...). simulated_fd should not be set to temp, this could cause duplicate simulated file descriptors to occur (this should not be a problem in a single threaded, non-forking simulation).

Personal tools