org.jikesrvm.runtime
Class SysCall

java.lang.Object
  extended by org.jikesrvm.runtime.SysCall

public abstract class SysCall
extends Object

Support for lowlevel (i.e. non-JNI) invocation of C functions with static addresses.

All methods of this class have the following signature:

 public abstract  NAME()
 
which will call the corresponding method in system call trampoline with the added function address from the boot image.

NOTE: From the standpoint of the rest of the VM, an invocation to a method of SysCall is uninterruptible.

NOTE: There must be a matching field NAMEIP in BootRecord.java for each method declared here.


Field Summary
static SysCall sysCall
          Actual implementation of the SysCall class.
 
Constructor Summary
SysCall()
           
 
Method Summary
abstract  Address gcspyDriverAddStream(Address driver, int id)
           
abstract  void gcspyDriverEndOutput(Address driver)
           
abstract  void gcspyDriverInit(Address driver, int id, Address serverName, Address driverName, Address title, Address blockInfo, int tileNum, Address unused, int mainSpace)
           
abstract  void gcspyDriverInitOutput(Address driver)
           
abstract  void gcspyDriverResize(Address driver, int size)
           
abstract  void gcspyDriverSetTileName(Address driver, int i, Address start, long value)
           
abstract  void gcspyDriverSetTileNameRange(Address driver, int i, Address start, Address end)
           
abstract  void gcspyDriverSpaceInfo(Address driver, Address info)
           
abstract  void gcspyDriverStartComm(Address driver)
           
abstract  void gcspyDriverStream(Address driver, int id, int len)
           
abstract  void gcspyDriverStreamByteValue(Address driver, byte value)
           
abstract  void gcspyDriverStreamIntValue(Address driver, int value)
           
abstract  void gcspyDriverStreamShortValue(Address driver, short value)
           
abstract  void gcspyDriverSummary(Address driver, int id, int len)
           
abstract  void gcspyDriverSummaryValue(Address driver, int value)
           
abstract  void gcspyFormatSize(Address buffer, int size)
           
abstract  void gcspyIntWriteControl(Address driver, int id, int tileNum)
           
abstract  Address gcspyMainServerAddDriver(Address addr)
           
abstract  void gcspyMainServerAddEvent(Address server, int event, Address name)
           
abstract  Address gcspyMainServerInit(int port, int len, Address name, int verbose)
           
abstract  int gcspyMainServerIsConnected(Address server, int event)
           
abstract  Address gcspyMainServerOuterLoop()
           
abstract  void gcspyMainServerSafepoint(Address server, int event)
           
abstract  void gcspyMainServerSetGeneralInfo(Address server, Address info)
           
abstract  void gcspyMainServerStartCompensationTimer(Address server)
           
abstract  void gcspyMainServerStopCompensationTimer(Address server)
           
abstract  int gcspySprintf(Address str, Address format, Address value)
           
abstract  void gcspyStartserver(Address server, int wait, Address serverOuterLoop)
           
abstract  void gcspyStreamInit(Address stream, int id, int dataType, Address name, int minValue, int maxValue, int zeroValue, int defaultValue, Address pre, Address post, int presentation, int paintStyle, int maxStreamIndex, int red, int green, int blue)
           
abstract  int sysAccess(byte[] name, int kind)
           
abstract  int sysArg(int argno, byte[] buf, int buflen)
           
abstract  int sysBytesAvailable(int fd)
           
abstract  Address sysCalloc(int length)
           
abstract  void sysConsoleWriteChar(char v)
           
abstract  void sysConsoleWriteDouble(double value, int postDecimalDigits)
           
abstract  void sysConsoleWriteInteger(int value, int hexToo)
           
abstract  void sysConsoleWriteLong(long value, int hexToo)
           
abstract  void sysCopy(Address dst, Address src, Extent cnt)
           
abstract  void sysCreateThreadSpecificDataKeys()
           
abstract  long sysCurrentTimeMillis()
           
abstract  void sysDisableAlignmentChecking()
           
abstract  Address sysDlopen(byte[] libname)
           
abstract  Address sysDlsym(Address libHandler, byte[] symbolName)
           
abstract  double sysDoubleRemainder(double x, double y)
           
abstract  int sysDoubleToInt(double x)
           
abstract  long sysDoubleToLong(double x)
           
abstract  void sysEnableAlignmentChecking()
           
abstract  void sysExit(int value)
           
abstract  int sysFloatToInt(float x)
           
abstract  long sysFloatToLong(float x)
           
abstract  void sysFree(Address location)
           
abstract  int sysGetenv(byte[] varName, byte[] buf, int limit)
           
abstract  int sysGetPageSize()
           
abstract  Word sysGetThreadId()
           
abstract  long sysLongDivide(long x, long y)
           
abstract  long sysLongRemainder(long x, long y)
           
abstract  double sysLongToDouble(long x)
           
abstract  float sysLongToFloat(long x)
           
abstract  Address sysMalloc(int length)
           
abstract  Address sysMMap(Address start, Extent length, int protection, int flags, int fd, Offset offset)
           
abstract  Address sysMMapErrno(Address start, Extent length, int protection, int flags, int fd, Offset offset)
           
abstract  void sysMonitorBroadcast(Word monitor)
           
abstract  Word sysMonitorCreate()
          Allocate the space for a pthread_mutex (using malloc) and initialize it using pthread_mutex_init with the recursive mutex options.
abstract  void sysMonitorDestroy(Word monitor)
          Destroy the monitor pointed to by the argument and free its memory by calling free.
abstract  void sysMonitorEnter(Word monitor)
           
abstract  void sysMonitorExit(Word monitor)
           
abstract  void sysMonitorTimedWaitAbsolute(Word monitor, long whenWakeupNanos)
           
abstract  void sysMonitorWait(Word monitor)
           
abstract  int sysMProtect(Address start, Extent length, int prot)
           
abstract  void sysNanoSleep(long howLongNanos)
           
abstract  long sysNanoTime()
           
abstract  int sysNumProcessors()
           
abstract  long sysParseMemorySize(byte[] sizeName, byte[] sizeFlag, byte[] defaultFactor, int roundTo, byte[] argToken, byte[] subArg)
          Parse memory sizes passed as command-line arguments.
abstract  int sysPerfEventCreate(int id, byte[] name)
           
abstract  void sysPerfEventDisable()
           
abstract  void sysPerfEventEnable()
           
abstract  int sysPerfEventInit(int events)
           
abstract  int sysPerfEventRead(int id, long[] values)
           
abstract  float sysPrimitiveParseFloat(byte[] buf)
          Used to parse command line arguments that are doubles and floats early in booting before it is safe to call Float.valueOf or Double.valueOf.
abstract  int sysPrimitiveParseInt(byte[] buf)
          Used to parse command line arguments that are bytes and ints early in booting before it is safe to call Byte.parseByte or Integer.parseInt.
abstract  int sysReadByte(int fd)
           
abstract  int sysReadBytes(int fd, Address buf, int cnt)
           
abstract  void sysReportAlignmentChecking()
           
abstract  int sysSetFdCloseOnExec(int fd)
           
abstract  void sysSetupHardwareTrapHandler()
           
abstract  int sysStashVMThread(RVMThread vmThread)
           
abstract  int sysStat(byte[] name, int kind)
           
abstract  void sysSyncCache(Address address, int size)
           
abstract  int sysSyncFile(int fd)
           
abstract  void sysThreadBind(int cpuId)
           
abstract  int sysThreadBindSupported()
          Tells you if the current system supportes sysNativeThreadBind().
abstract  Word sysThreadCreate(Address tr, Address ip, Address fp)
          Create a native thread (aka "unix kernel thread", "pthread").
abstract  void sysThreadTerminate()
           
abstract  void sysThreadYield()
           
abstract  int sysWriteByte(int fd, int data)
           
abstract  int sysWriteBytes(int fd, Address buf, int cnt)
           
abstract  void sysZero(Address dst, Extent cnt)
           
abstract  void sysZeroNT(Address dst, Extent cnt)
           
abstract  void sysZeroPages(Address dst, int cnt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sysCall

public static final SysCall sysCall
Actual implementation of the SysCall class. The implementation is generated from the code in this class during the build process.

Constructor Detail

SysCall

public SysCall()
Method Detail

sysConsoleWriteChar

public abstract void sysConsoleWriteChar(char v)

sysConsoleWriteInteger

public abstract void sysConsoleWriteInteger(int value,
                                            int hexToo)

sysConsoleWriteLong

public abstract void sysConsoleWriteLong(long value,
                                         int hexToo)

sysConsoleWriteDouble

public abstract void sysConsoleWriteDouble(double value,
                                           int postDecimalDigits)

sysExit

public abstract void sysExit(int value)

sysArg

public abstract int sysArg(int argno,
                           byte[] buf,
                           int buflen)

sysGetenv

public abstract int sysGetenv(byte[] varName,
                              byte[] buf,
                              int limit)

sysCopy

public abstract void sysCopy(Address dst,
                             Address src,
                             Extent cnt)

sysMalloc

public abstract Address sysMalloc(int length)

sysCalloc

public abstract Address sysCalloc(int length)

sysFree

public abstract void sysFree(Address location)

sysZeroNT

public abstract void sysZeroNT(Address dst,
                               Extent cnt)

sysZero

public abstract void sysZero(Address dst,
                             Extent cnt)

sysZeroPages

public abstract void sysZeroPages(Address dst,
                                  int cnt)

sysSyncCache

public abstract void sysSyncCache(Address address,
                                  int size)

sysPerfEventInit

public abstract int sysPerfEventInit(int events)

sysPerfEventCreate

public abstract int sysPerfEventCreate(int id,
                                       byte[] name)

sysPerfEventEnable

public abstract void sysPerfEventEnable()

sysPerfEventDisable

public abstract void sysPerfEventDisable()

sysPerfEventRead

public abstract int sysPerfEventRead(int id,
                                     long[] values)

sysStat

public abstract int sysStat(byte[] name,
                            int kind)

sysReadByte

public abstract int sysReadByte(int fd)

sysWriteByte

public abstract int sysWriteByte(int fd,
                                 int data)

sysReadBytes

public abstract int sysReadBytes(int fd,
                                 Address buf,
                                 int cnt)

sysWriteBytes

public abstract int sysWriteBytes(int fd,
                                  Address buf,
                                  int cnt)

sysBytesAvailable

public abstract int sysBytesAvailable(int fd)

sysSyncFile

public abstract int sysSyncFile(int fd)

sysSetFdCloseOnExec

public abstract int sysSetFdCloseOnExec(int fd)

sysAccess

public abstract int sysAccess(byte[] name,
                              int kind)

sysMMap

public abstract Address sysMMap(Address start,
                                Extent length,
                                int protection,
                                int flags,
                                int fd,
                                Offset offset)

sysMMapErrno

public abstract Address sysMMapErrno(Address start,
                                     Extent length,
                                     int protection,
                                     int flags,
                                     int fd,
                                     Offset offset)

sysMProtect

public abstract int sysMProtect(Address start,
                                Extent length,
                                int prot)

sysGetPageSize

public abstract int sysGetPageSize()

sysNumProcessors

public abstract int sysNumProcessors()

sysThreadCreate

public abstract Word sysThreadCreate(Address tr,
                                     Address ip,
                                     Address fp)
Create a native thread (aka "unix kernel thread", "pthread").

Parameters:
tr -
ip -
fp -
Returns:
native thread's o/s handle

sysThreadBindSupported

public abstract int sysThreadBindSupported()
Tells you if the current system supportes sysNativeThreadBind().

Returns:
1 if it's supported, 0 if it isn't

sysThreadBind

public abstract void sysThreadBind(int cpuId)

sysThreadYield

public abstract void sysThreadYield()

sysGetThreadId

public abstract Word sysGetThreadId()

sysSetupHardwareTrapHandler

public abstract void sysSetupHardwareTrapHandler()

sysStashVMThread

public abstract int sysStashVMThread(RVMThread vmThread)

sysThreadTerminate

public abstract void sysThreadTerminate()

sysMonitorCreate

public abstract Word sysMonitorCreate()
Allocate the space for a pthread_mutex (using malloc) and initialize it using pthread_mutex_init with the recursive mutex options. Note: it is perfectly OK for the C/C++ code that implements this syscall to use some other locking mechanism (for example, on systems that don't have recursive mutexes you could imagine the recursive feature to be emulated).


sysMonitorDestroy

public abstract void sysMonitorDestroy(Word monitor)
Destroy the monitor pointed to by the argument and free its memory by calling free.


sysMonitorEnter

public abstract void sysMonitorEnter(Word monitor)

sysMonitorExit

public abstract void sysMonitorExit(Word monitor)

sysMonitorTimedWaitAbsolute

public abstract void sysMonitorTimedWaitAbsolute(Word monitor,
                                                 long whenWakeupNanos)

sysMonitorWait

public abstract void sysMonitorWait(Word monitor)

sysMonitorBroadcast

public abstract void sysMonitorBroadcast(Word monitor)

sysLongDivide

public abstract long sysLongDivide(long x,
                                   long y)

sysLongRemainder

public abstract long sysLongRemainder(long x,
                                      long y)

sysLongToFloat

public abstract float sysLongToFloat(long x)

sysLongToDouble

public abstract double sysLongToDouble(long x)

sysFloatToInt

public abstract int sysFloatToInt(float x)

sysDoubleToInt

public abstract int sysDoubleToInt(double x)

sysFloatToLong

public abstract long sysFloatToLong(float x)

sysDoubleToLong

public abstract long sysDoubleToLong(double x)

sysDoubleRemainder

public abstract double sysDoubleRemainder(double x,
                                          double y)

sysPrimitiveParseFloat

public abstract float sysPrimitiveParseFloat(byte[] buf)
Used to parse command line arguments that are doubles and floats early in booting before it is safe to call Float.valueOf or Double.valueOf. This aborts in case of errors, with an appropriate error message. NOTE: this does not support the full Java spec of parsing a string into a float.

Parameters:
buf - a null terminated byte[] that can be parsed by strtof()
Returns:
the floating-point value produced by the call to strtof() on buf.

sysPrimitiveParseInt

public abstract int sysPrimitiveParseInt(byte[] buf)
Used to parse command line arguments that are bytes and ints early in booting before it is safe to call Byte.parseByte or Integer.parseInt. This aborts in case of errors, with an appropriate error message.

Parameters:
buf - a null terminated byte[] that can be parsed by strtol()
Returns:
the int value produced by the call to strtol() on buf.

sysParseMemorySize

public abstract long sysParseMemorySize(byte[] sizeName,
                                        byte[] sizeFlag,
                                        byte[] defaultFactor,
                                        int roundTo,
                                        byte[] argToken,
                                        byte[] subArg)
Parse memory sizes passed as command-line arguments.


sysCurrentTimeMillis

public abstract long sysCurrentTimeMillis()

sysNanoTime

public abstract long sysNanoTime()

sysNanoSleep

public abstract void sysNanoSleep(long howLongNanos)

sysDlopen

public abstract Address sysDlopen(byte[] libname)

sysDlsym

public abstract Address sysDlsym(Address libHandler,
                                 byte[] symbolName)

sysCreateThreadSpecificDataKeys

public abstract void sysCreateThreadSpecificDataKeys()

sysEnableAlignmentChecking

public abstract void sysEnableAlignmentChecking()

sysDisableAlignmentChecking

public abstract void sysDisableAlignmentChecking()

sysReportAlignmentChecking

public abstract void sysReportAlignmentChecking()

gcspyDriverAddStream

public abstract Address gcspyDriverAddStream(Address driver,
                                             int id)

gcspyDriverEndOutput

public abstract void gcspyDriverEndOutput(Address driver)

gcspyDriverInit

public abstract void gcspyDriverInit(Address driver,
                                     int id,
                                     Address serverName,
                                     Address driverName,
                                     Address title,
                                     Address blockInfo,
                                     int tileNum,
                                     Address unused,
                                     int mainSpace)

gcspyDriverInitOutput

public abstract void gcspyDriverInitOutput(Address driver)

gcspyDriverResize

public abstract void gcspyDriverResize(Address driver,
                                       int size)

gcspyDriverSetTileNameRange

public abstract void gcspyDriverSetTileNameRange(Address driver,
                                                 int i,
                                                 Address start,
                                                 Address end)

gcspyDriverSetTileName

public abstract void gcspyDriverSetTileName(Address driver,
                                            int i,
                                            Address start,
                                            long value)

gcspyDriverSpaceInfo

public abstract void gcspyDriverSpaceInfo(Address driver,
                                          Address info)

gcspyDriverStartComm

public abstract void gcspyDriverStartComm(Address driver)

gcspyDriverStream

public abstract void gcspyDriverStream(Address driver,
                                       int id,
                                       int len)

gcspyDriverStreamByteValue

public abstract void gcspyDriverStreamByteValue(Address driver,
                                                byte value)

gcspyDriverStreamShortValue

public abstract void gcspyDriverStreamShortValue(Address driver,
                                                 short value)

gcspyDriverStreamIntValue

public abstract void gcspyDriverStreamIntValue(Address driver,
                                               int value)

gcspyDriverSummary

public abstract void gcspyDriverSummary(Address driver,
                                        int id,
                                        int len)

gcspyDriverSummaryValue

public abstract void gcspyDriverSummaryValue(Address driver,
                                             int value)

gcspyIntWriteControl

public abstract void gcspyIntWriteControl(Address driver,
                                          int id,
                                          int tileNum)

gcspyMainServerAddDriver

public abstract Address gcspyMainServerAddDriver(Address addr)

gcspyMainServerAddEvent

public abstract void gcspyMainServerAddEvent(Address server,
                                             int event,
                                             Address name)

gcspyMainServerInit

public abstract Address gcspyMainServerInit(int port,
                                            int len,
                                            Address name,
                                            int verbose)

gcspyMainServerIsConnected

public abstract int gcspyMainServerIsConnected(Address server,
                                               int event)

gcspyMainServerOuterLoop

public abstract Address gcspyMainServerOuterLoop()

gcspyMainServerSafepoint

public abstract void gcspyMainServerSafepoint(Address server,
                                              int event)

gcspyMainServerSetGeneralInfo

public abstract void gcspyMainServerSetGeneralInfo(Address server,
                                                   Address info)

gcspyMainServerStartCompensationTimer

public abstract void gcspyMainServerStartCompensationTimer(Address server)

gcspyMainServerStopCompensationTimer

public abstract void gcspyMainServerStopCompensationTimer(Address server)

gcspyStartserver

public abstract void gcspyStartserver(Address server,
                                      int wait,
                                      Address serverOuterLoop)

gcspyStreamInit

public abstract void gcspyStreamInit(Address stream,
                                     int id,
                                     int dataType,
                                     Address name,
                                     int minValue,
                                     int maxValue,
                                     int zeroValue,
                                     int defaultValue,
                                     Address pre,
                                     Address post,
                                     int presentation,
                                     int paintStyle,
                                     int maxStreamIndex,
                                     int red,
                                     int green,
                                     int blue)

gcspyFormatSize

public abstract void gcspyFormatSize(Address buffer,
                                     int size)

gcspySprintf

public abstract int gcspySprintf(Address str,
                                 Address format,
                                 Address value)