MARS Tool Syscalls#22
Open
xarkenz wants to merge 4 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added three new syscalls:
LaunchTool(62), which launches a given tool in the GUI if it is not already open;NotifyTool(63), which effectively sends a signal to a given tool which is handled in a manner defined by the tool; andQueryTool(64), which is very similar toNotifyToolbut is intended to request values from the tool rather than provide values to it. The goal of this feature is to provide a mechanism for MIPS programs to interface directly with the set of MARS tools. For example, the parameters of the Bitmap Display can be set by the program at runtime, rather than requiring manual setup by the user beforehand.Each existing tool has been assigned an "identifier" string (such as
bitmapfor Bitmap Display andvisualstackfor Visual Stack) which is used to determine which tool is being referred to when one of the aforementioned syscalls occurs. Each syscall reads a null-terminated string from the address in$a0and interprets it as the tool identifier.Below is a simple example fragment to demonstrate the utility these syscalls provide. The result of executing this code is that the Bitmap Display is launched automatically and the base address for the bitmap is set to the address of label
screen.Internally, the
NotifyToolandQueryToolsyscalls themselves are virtually identical-- they look up the tool using$a0and call a method (handleNotify/handleQuery) on the tool, passing in the value of$a1as the "key." The purpose of the key is defined by the tool, but the default implementation given byAbstractMarsTooluses the key to select a query / notify handler to run. Tools extendingAbstractMarsToolcan then use theaddNotifyHandlerandaddQueryHandlermethods to define these handlers.At the moment, the Bitmap Display is the only tool supporting
NotifyToolandQueryTool. The goal is to support this feature in all applicable tools-- this pull request is intended to lay the groundwork for future refinement.