Files
EMARS/docs/mars/mips/instructions/syscalls/Syscall.html
T
adolphenom 0da1c5dcca Source code of MARS Assembler
First commit of the 4.5 version (latest version available)
2014-12-21 12:49:28 +01:00

295 lines
17 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_33) on Tue Aug 20 12:20:45 EDT 2013 -->
<TITLE>
Syscall
</TITLE>
<META NAME="date" CONTENT="2013-08-20">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Syscall";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../mars/mips/instructions/syscalls/RandomStreams.html" title="class in mars.mips.instructions.syscalls"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../mars/mips/instructions/syscalls/SyscallClose.html" title="class in mars.mips.instructions.syscalls"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?mars/mips/instructions/syscalls/Syscall.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Syscall.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
mars.mips.instructions.syscalls</FONT>
<BR>
Interface Syscall</H2>
<DL>
<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../mars/mips/instructions/syscalls/AbstractSyscall.html" title="class in mars.mips.instructions.syscalls">AbstractSyscall</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallClose.html" title="class in mars.mips.instructions.syscalls">SyscallClose</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallConfirmDialog.html" title="class in mars.mips.instructions.syscalls">SyscallConfirmDialog</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallExit.html" title="class in mars.mips.instructions.syscalls">SyscallExit</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallExit2.html" title="class in mars.mips.instructions.syscalls">SyscallExit2</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallInputDialogDouble.html" title="class in mars.mips.instructions.syscalls">SyscallInputDialogDouble</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallInputDialogFloat.html" title="class in mars.mips.instructions.syscalls">SyscallInputDialogFloat</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallInputDialogInt.html" title="class in mars.mips.instructions.syscalls">SyscallInputDialogInt</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallInputDialogString.html" title="class in mars.mips.instructions.syscalls">SyscallInputDialogString</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallMessageDialog.html" title="class in mars.mips.instructions.syscalls">SyscallMessageDialog</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallMessageDialogDouble.html" title="class in mars.mips.instructions.syscalls">SyscallMessageDialogDouble</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallMessageDialogFloat.html" title="class in mars.mips.instructions.syscalls">SyscallMessageDialogFloat</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallMessageDialogInt.html" title="class in mars.mips.instructions.syscalls">SyscallMessageDialogInt</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallMessageDialogString.html" title="class in mars.mips.instructions.syscalls">SyscallMessageDialogString</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallMidiOut.html" title="class in mars.mips.instructions.syscalls">SyscallMidiOut</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallMidiOutSync.html" title="class in mars.mips.instructions.syscalls">SyscallMidiOutSync</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallOpen.html" title="class in mars.mips.instructions.syscalls">SyscallOpen</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallPrintChar.html" title="class in mars.mips.instructions.syscalls">SyscallPrintChar</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallPrintDouble.html" title="class in mars.mips.instructions.syscalls">SyscallPrintDouble</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallPrintFloat.html" title="class in mars.mips.instructions.syscalls">SyscallPrintFloat</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallPrintInt.html" title="class in mars.mips.instructions.syscalls">SyscallPrintInt</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallPrintIntBinary.html" title="class in mars.mips.instructions.syscalls">SyscallPrintIntBinary</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallPrintIntHex.html" title="class in mars.mips.instructions.syscalls">SyscallPrintIntHex</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallPrintIntUnsigned.html" title="class in mars.mips.instructions.syscalls">SyscallPrintIntUnsigned</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallPrintString.html" title="class in mars.mips.instructions.syscalls">SyscallPrintString</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallRandDouble.html" title="class in mars.mips.instructions.syscalls">SyscallRandDouble</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallRandFloat.html" title="class in mars.mips.instructions.syscalls">SyscallRandFloat</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallRandInt.html" title="class in mars.mips.instructions.syscalls">SyscallRandInt</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallRandIntRange.html" title="class in mars.mips.instructions.syscalls">SyscallRandIntRange</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallRandSeed.html" title="class in mars.mips.instructions.syscalls">SyscallRandSeed</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallRead.html" title="class in mars.mips.instructions.syscalls">SyscallRead</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallReadChar.html" title="class in mars.mips.instructions.syscalls">SyscallReadChar</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallReadDouble.html" title="class in mars.mips.instructions.syscalls">SyscallReadDouble</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallReadFloat.html" title="class in mars.mips.instructions.syscalls">SyscallReadFloat</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallReadInt.html" title="class in mars.mips.instructions.syscalls">SyscallReadInt</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallReadString.html" title="class in mars.mips.instructions.syscalls">SyscallReadString</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallSbrk.html" title="class in mars.mips.instructions.syscalls">SyscallSbrk</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallSleep.html" title="class in mars.mips.instructions.syscalls">SyscallSleep</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallTime.html" title="class in mars.mips.instructions.syscalls">SyscallTime</A>, <A HREF="../../../../mars/mips/instructions/syscalls/SyscallWrite.html" title="class in mars.mips.instructions.syscalls">SyscallWrite</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public interface <B>Syscall</B></DL>
</PRE>
<P>
Interface for any MIPS syscall system service. A qualifying service
must be a class in the mars.mips.instructions.syscalls package that
implements the Syscall interface, must be compiled into a .class file,
and its .class file must be in the same folder as Syscall.class.
Mars will detect a qualifying syscall upon startup, create an instance
using its no-argument constructor and add it to its syscall list.
When its service is invoked at runtime ("syscall" instruction
with its service number stored in register $v0), its simulate()
method will be invoked.
<P>
<P>
<HR>
<P>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../mars/mips/instructions/syscalls/Syscall.html#getName()">getName</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return a name you have chosen for this syscall.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../mars/mips/instructions/syscalls/Syscall.html#getNumber()">getNumber</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return the assigned service number.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../mars/mips/instructions/syscalls/Syscall.html#setNumber(int)">setNumber</A></B>(int&nbsp;num)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the service number.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../mars/mips/instructions/syscalls/Syscall.html#simulate(mars.ProgramStatement)">simulate</A></B>(<A HREF="../../../../mars/ProgramStatement.html" title="class in mars">ProgramStatement</A>&nbsp;statement)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Performs syscall function.</TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="getName()"><!-- --></A><H3>
getName</H3>
<PRE>
<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>getName</B>()</PRE>
<DL>
<DD>Return a name you have chosen for this syscall. This can be used by a MARS
user to refer to the service when choosing to override its default service
number in the configuration file.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>service name as a string</DL>
</DD>
</DL>
<HR>
<A NAME="setNumber(int)"><!-- --></A><H3>
setNumber</H3>
<PRE>
void <B>setNumber</B>(int&nbsp;num)</PRE>
<DL>
<DD>Set the service number. This is provided to allow MARS implementer or user
to override the default service number.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>num</CODE> - specified service number to override the default.</DL>
</DD>
</DL>
<HR>
<A NAME="getNumber()"><!-- --></A><H3>
getNumber</H3>
<PRE>
int <B>getNumber</B>()</PRE>
<DL>
<DD>Return the assigned service number. This is the number the MIPS programmer
must store into $v0 before issuing the SYSCALL instruction.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>assigned service number</DL>
</DD>
</DL>
<HR>
<A NAME="simulate(mars.ProgramStatement)"><!-- --></A><H3>
simulate</H3>
<PRE>
void <B>simulate</B>(<A HREF="../../../../mars/ProgramStatement.html" title="class in mars">ProgramStatement</A>&nbsp;statement)
throws <A HREF="../../../../mars/ProcessingException.html" title="class in mars">ProcessingException</A></PRE>
<DL>
<DD>Performs syscall function. It will be invoked when the service is invoked
at simulation time. Service is identified by value stored in $v0.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>statement</CODE> - ProgramStatement for this syscall statement.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../mars/ProcessingException.html" title="class in mars">ProcessingException</A></CODE></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../mars/mips/instructions/syscalls/RandomStreams.html" title="class in mars.mips.instructions.syscalls"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../mars/mips/instructions/syscalls/SyscallClose.html" title="class in mars.mips.instructions.syscalls"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?mars/mips/instructions/syscalls/Syscall.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Syscall.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>