org.xwt.mips
Class VM

java.lang.Object
  extended byorg.xwt.mips.VM
All Implemented Interfaces:
org.xwt.mips.Errno, org.xwt.mips.Syscalls
Direct Known Subclasses:
Interpreter

public abstract class VM
extends java.lang.Object
implements org.xwt.mips.Syscalls, org.xwt.mips.Errno


Nested Class Summary
static class VM.EmulationException
           
static class VM.FaultException
           
static class VM.FileDescriptor
           
static class VM.FileFileInfo
           
 class VM.InputStreamFD
           
 class VM.OutputStreamFD
           
static class VM.ReadFaultException
           
static class VM.RegularFileDescriptor
           
static class VM.WriteFaultException
           
 
Field Summary
static int __ELASTERROR
           
protected static int A0
           
protected static int A1
           
protected static int A2
           
protected static int A3
           
protected static int ARGS_ADDR
           
protected static int AT
           
protected  int brk
           
protected static int BRK_LIMIT
           
static int DONE
           
static int EACCES
           
static int EADDRINUSE
           
static int EADDRNOTAVAIL
           
static int EADV
           
static int EAFNOSUPPORT
           
static int EAGAIN
           
static int EALREADY
           
static int EBADE
           
static int EBADF
           
static int EBADFD
           
static int EBADMSG
           
static int EBADR
           
static int EBADRQC
           
static int EBADSLT
           
static int EBFONT
           
static int EBUSY
           
static int ECASECLASH
           
static int ECHILD
           
static int ECHRNG
           
static int ECOMM
           
static int ECONNABORTED
           
static int ECONNREFUSED
           
static int ECONNRESET
           
static int EDEADLK
           
static int EDEADLOCK
           
static int EDESTADDRREQ
           
static int EDOM
           
static int EDOTDOT
           
static int EDQUOT
           
static int EEXIST
           
static int EFAULT
           
static int EFBIG
           
static int EFTYPE
           
static int EHOSTDOWN
           
static int EHOSTUNREACH
           
static int EIDRM
           
static int EILSEQ
           
static int EINPROGRESS
           
static int EINTR
           
static int EINVAL
           
static int EIO
           
static int EISCONN
           
static int EISDIR
           
static int ELBIN
           
static int ELIBACC
           
static int ELIBBAD
           
static int ELIBEXEC
           
static int ELIBMAX
           
static int ELIBSCN
           
static int ELNRNG
           
static int ELOOP
           
static int EMFILE
           
static int EMLINK
           
static int EMSGSIZE
           
static int EMULTIHOP
           
static int ENAMETOOLONG
           
static int ENETDOWN
           
static int ENETRESET
           
static int ENETUNREACH
           
static int ENFILE
           
static int ENMFILE
           
static int ENOANO
           
static int ENOBUFS
           
static int ENOCSI
           
static int ENODATA
           
static int ENODEV
           
static int ENOENT
           
static int ENOEXEC
           
static int ENOLCK
           
static int ENOLINK
           
static int ENOMEDIUM
           
static int ENOMEM
           
static int ENOMSG
           
static int ENONET
           
static int ENOPKG
           
static int ENOPROTOOPT
           
static int ENOSHARE
           
static int ENOSPC
           
static int ENOSR
           
static int ENOSTR
           
static int ENOSYS
           
static int ENOTBLK
           
static int ENOTCONN
           
static int ENOTDIR
           
static int ENOTEMPTY
           
static int ENOTSOCK
           
static int ENOTSUP
           
static int ENOTTY
           
static int ENOTUNIQ
           
protected  int entryPoint
           
static int ENXIO
           
static int EOPNOTSUPP
           
static int EOVERFLOW
           
static int EPERM
           
static int EPFNOSUPPORT
           
static int EPIPE
           
static int EPROCLIM
           
static int EPROTO
           
static int EPROTONOSUPPORT
           
static int EPROTOTYPE
           
static int ERANGE
           
static int EREMCHG
           
static int EREMOTE
           
static int EROFS
           
static int ESHUTDOWN
           
static int ESOCKTNOSUPPORT
           
static int ESPIPE
           
static int ESRCH
           
static int ESRMNT
           
static int ESTALE
           
static int ETIME
           
static int ETIMEDOUT
           
static int ETOOMANYREFS
           
static int ETXTBSY
           
static int EUNATCH
           
static int EUSERS
           
static int EXDEV
           
static int EXFULL
           
protected  int exitStatus
           
protected static int FP
           
protected static int GP
           
protected static int INITIAL_SP
           
static int INITIALIZED
           
protected static int K0
           
protected static int K1
           
protected static int PAGE_SHIFT
           
protected static int PAGE_SIZE
           
protected static int PAGE_WORDS
           
static int PAUSED
           
static int PID
           
protected static int RA
           
protected  int[][] readPages
           
static int RUNNING
           
protected static int S0
           
protected static int S1
           
protected static int S2
           
protected static int S3
           
protected static int S4
           
protected static int S5
           
protected static int S6
           
protected static int S7
           
protected static int SP
           
protected static int STACK_PAGES
           
protected  int state
           
static int SYS_close
           
static int SYS_exit
           
static int SYS_fstat
           
static int SYS_getpid
           
static int SYS_isatty
           
static int SYS_kill
           
static int SYS_null
           
static int SYS_open
           
static int SYS_pause
           
static int SYS_read
           
static int SYS_sbrk
           
static int SYS_seek
           
static int SYS_write
           
protected static int T0
           
protected static int T1
           
protected static int T2
           
protected static int T3
           
protected static int T4
           
protected static int T5
           
protected static int T6
           
protected static int T7
           
protected static int T8
           
protected static int T9
           
protected static int TOTAL_PAGES
           
static int UNINITIALIZED
           
protected static int USER_INFO_ADDR
           
protected static int V0
           
protected static int V1
           
protected  int[][] writePages
           
protected static int ZERO
           
 
Constructor Summary
VM()
           
 
Method Summary
protected abstract  void _start(int pc)
           
 void copyin(int addr, byte[] a, int length)
           
 void copyout(byte[] a, int addr, int length)
           
 java.lang.String cstring(int addr)
           
abstract  void execute()
           
 int exitStatus()
           
 int getState()
           
 int getUserInfo(int index)
           
protected  void initPage(int page)
           
protected static int max(int a, int b)
           
 int memRead(int addr)
           
protected  void memWrite(int addr, int value)
           
protected static int min(int a, int b)
           
 int run(java.lang.String[] args)
           
 int sbrk(int incr)
           
 void setUserInfo(int index, int word)
           
 void start(java.lang.String[] args)
           
protected  int syscall(int syscall, int a, int b, int c, int d)
           
protected static java.lang.String toHex(int n)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZERO

protected static final int ZERO
See Also:
Constant Field Values

AT

protected static final int AT
See Also:
Constant Field Values

K0

protected static final int K0
See Also:
Constant Field Values

K1

protected static final int K1
See Also:
Constant Field Values

GP

protected static final int GP
See Also:
Constant Field Values

SP

protected static final int SP
See Also:
Constant Field Values

FP

protected static final int FP
See Also:
Constant Field Values

RA

protected static final int RA
See Also:
Constant Field Values

V0

protected static final int V0
See Also:
Constant Field Values

V1

protected static final int V1
See Also:
Constant Field Values

A0

protected static final int A0
See Also:
Constant Field Values

A1

protected static final int A1
See Also:
Constant Field Values

A2

protected static final int A2
See Also:
Constant Field Values

A3

protected static final int A3
See Also:
Constant Field Values

T0

protected static final int T0
See Also:
Constant Field Values

T1

protected static final int T1
See Also:
Constant Field Values

T2

protected static final int T2
See Also:
Constant Field Values

T3

protected static final int T3
See Also:
Constant Field Values

T4

protected static final int T4
See Also:
Constant Field Values

T5

protected static final int T5
See Also:
Constant Field Values

T6

protected static final int T6
See Also:
Constant Field Values

T7

protected static final int T7
See Also:
Constant Field Values

T8

protected static final int T8
See Also:
Constant Field Values

T9

protected static final int T9
See Also:
Constant Field Values

S0

protected static final int S0
See Also:
Constant Field Values

S1

protected static final int S1
See Also:
Constant Field Values

S2

protected static final int S2
See Also:
Constant Field Values

S3

protected static final int S3
See Also:
Constant Field Values

S4

protected static final int S4
See Also:
Constant Field Values

S5

protected static final int S5
See Also:
Constant Field Values

S6

protected static final int S6
See Also:
Constant Field Values

S7

protected static final int S7
See Also:
Constant Field Values

PAGE_SIZE

protected static final int PAGE_SIZE
See Also:
Constant Field Values

PAGE_WORDS

protected static final int PAGE_WORDS
See Also:
Constant Field Values

PAGE_SHIFT

protected static final int PAGE_SHIFT
See Also:
Constant Field Values

STACK_PAGES

protected static final int STACK_PAGES
See Also:
Constant Field Values

TOTAL_PAGES

protected static final int TOTAL_PAGES
See Also:
Constant Field Values

BRK_LIMIT

protected static final int BRK_LIMIT
See Also:
Constant Field Values

ARGS_ADDR

protected static final int ARGS_ADDR
See Also:
Constant Field Values

USER_INFO_ADDR

protected static final int USER_INFO_ADDR
See Also:
Constant Field Values

INITIAL_SP

protected static final int INITIAL_SP
See Also:
Constant Field Values

readPages

protected final int[][] readPages

writePages

protected final int[][] writePages

brk

protected int brk

entryPoint

protected int entryPoint

UNINITIALIZED

public static final int UNINITIALIZED
See Also:
Constant Field Values

INITIALIZED

public static final int INITIALIZED
See Also:
Constant Field Values

RUNNING

public static final int RUNNING
See Also:
Constant Field Values

PAUSED

public static final int PAUSED
See Also:
Constant Field Values

DONE

public static final int DONE
See Also:
Constant Field Values

state

protected int state

exitStatus

protected int exitStatus

PID

public static final int PID
See Also:
Constant Field Values

SYS_null

public static final int SYS_null
See Also:
Constant Field Values

SYS_exit

public static final int SYS_exit
See Also:
Constant Field Values

SYS_pause

public static final int SYS_pause
See Also:
Constant Field Values

SYS_open

public static final int SYS_open
See Also:
Constant Field Values

SYS_close

public static final int SYS_close
See Also:
Constant Field Values

SYS_read

public static final int SYS_read
See Also:
Constant Field Values

SYS_write

public static final int SYS_write
See Also:
Constant Field Values

SYS_sbrk

public static final int SYS_sbrk
See Also:
Constant Field Values

SYS_fstat

public static final int SYS_fstat
See Also:
Constant Field Values

SYS_isatty

public static final int SYS_isatty
See Also:
Constant Field Values

SYS_seek

public static final int SYS_seek
See Also:
Constant Field Values

SYS_kill

public static final int SYS_kill
See Also:
Constant Field Values

SYS_getpid

public static final int SYS_getpid
See Also:
Constant Field Values

EPERM

public static final int EPERM
See Also:
Constant Field Values

ENOENT

public static final int ENOENT
See Also:
Constant Field Values

ESRCH

public static final int ESRCH
See Also:
Constant Field Values

EINTR

public static final int EINTR
See Also:
Constant Field Values

EIO

public static final int EIO
See Also:
Constant Field Values

ENXIO

public static final int ENXIO
See Also:
Constant Field Values

ENOEXEC

public static final int ENOEXEC
See Also:
Constant Field Values

EBADF

public static final int EBADF
See Also:
Constant Field Values

ECHILD

public static final int ECHILD
See Also:
Constant Field Values

EAGAIN

public static final int EAGAIN
See Also:
Constant Field Values

ENOMEM

public static final int ENOMEM
See Also:
Constant Field Values

EACCES

public static final int EACCES
See Also:
Constant Field Values

EFAULT

public static final int EFAULT
See Also:
Constant Field Values

ENOTBLK

public static final int ENOTBLK
See Also:
Constant Field Values

EBUSY

public static final int EBUSY
See Also:
Constant Field Values

EEXIST

public static final int EEXIST
See Also:
Constant Field Values

EXDEV

public static final int EXDEV
See Also:
Constant Field Values

ENODEV

public static final int ENODEV
See Also:
Constant Field Values

ENOTDIR

public static final int ENOTDIR
See Also:
Constant Field Values

EISDIR

public static final int EISDIR
See Also:
Constant Field Values

EINVAL

public static final int EINVAL
See Also:
Constant Field Values

ENFILE

public static final int ENFILE
See Also:
Constant Field Values

EMFILE

public static final int EMFILE
See Also:
Constant Field Values

ENOTTY

public static final int ENOTTY
See Also:
Constant Field Values

ETXTBSY

public static final int ETXTBSY
See Also:
Constant Field Values

EFBIG

public static final int EFBIG
See Also:
Constant Field Values

ENOSPC

public static final int ENOSPC
See Also:
Constant Field Values

ESPIPE

public static final int ESPIPE
See Also:
Constant Field Values

EROFS

public static final int EROFS
See Also:
Constant Field Values

EMLINK

public static final int EMLINK
See Also:
Constant Field Values

EPIPE

public static final int EPIPE
See Also:
Constant Field Values

EDOM

public static final int EDOM
See Also:
Constant Field Values

ERANGE

public static final int ERANGE
See Also:
Constant Field Values

ENOMSG

public static final int ENOMSG
See Also:
Constant Field Values

EIDRM

public static final int EIDRM
See Also:
Constant Field Values

ECHRNG

public static final int ECHRNG
See Also:
Constant Field Values

ELNRNG

public static final int ELNRNG
See Also:
Constant Field Values

EUNATCH

public static final int EUNATCH
See Also:
Constant Field Values

ENOCSI

public static final int ENOCSI
See Also:
Constant Field Values

EDEADLK

public static final int EDEADLK
See Also:
Constant Field Values

ENOLCK

public static final int ENOLCK
See Also:
Constant Field Values

EBADE

public static final int EBADE
See Also:
Constant Field Values

EBADR

public static final int EBADR
See Also:
Constant Field Values

EXFULL

public static final int EXFULL
See Also:
Constant Field Values

ENOANO

public static final int ENOANO
See Also:
Constant Field Values

EBADRQC

public static final int EBADRQC
See Also:
Constant Field Values

EBADSLT

public static final int EBADSLT
See Also:
Constant Field Values

EDEADLOCK

public static final int EDEADLOCK
See Also:
Constant Field Values

EBFONT

public static final int EBFONT
See Also:
Constant Field Values

ENOSTR

public static final int ENOSTR
See Also:
Constant Field Values

ENODATA

public static final int ENODATA
See Also:
Constant Field Values

ETIME

public static final int ETIME
See Also:
Constant Field Values

ENOSR

public static final int ENOSR
See Also:
Constant Field Values

ENONET

public static final int ENONET
See Also:
Constant Field Values

ENOPKG

public static final int ENOPKG
See Also:
Constant Field Values

EREMOTE

public static final int EREMOTE
See Also:
Constant Field Values

ENOLINK

public static final int ENOLINK
See Also:
Constant Field Values

EADV

public static final int EADV
See Also:
Constant Field Values

ESRMNT

public static final int ESRMNT
See Also:
Constant Field Values

ECOMM

public static final int ECOMM
See Also:
Constant Field Values

EPROTO

public static final int EPROTO
See Also:
Constant Field Values

EMULTIHOP

public static final int EMULTIHOP
See Also:
Constant Field Values

ELBIN

public static final int ELBIN
See Also:
Constant Field Values

EDOTDOT

public static final int EDOTDOT
See Also:
Constant Field Values

EBADMSG

public static final int EBADMSG
See Also:
Constant Field Values

EFTYPE

public static final int EFTYPE
See Also:
Constant Field Values

ENOTUNIQ

public static final int ENOTUNIQ
See Also:
Constant Field Values

EBADFD

public static final int EBADFD
See Also:
Constant Field Values

EREMCHG

public static final int EREMCHG
See Also:
Constant Field Values

ELIBACC

public static final int ELIBACC
See Also:
Constant Field Values

ELIBBAD

public static final int ELIBBAD
See Also:
Constant Field Values

ELIBSCN

public static final int ELIBSCN
See Also:
Constant Field Values

ELIBMAX

public static final int ELIBMAX
See Also:
Constant Field Values

ELIBEXEC

public static final int ELIBEXEC
See Also:
Constant Field Values

ENOSYS

public static final int ENOSYS
See Also:
Constant Field Values

ENMFILE

public static final int ENMFILE
See Also:
Constant Field Values

ENOTEMPTY

public static final int ENOTEMPTY
See Also:
Constant Field Values

ENAMETOOLONG

public static final int ENAMETOOLONG
See Also:
Constant Field Values

ELOOP

public static final int ELOOP
See Also:
Constant Field Values

EOPNOTSUPP

public static final int EOPNOTSUPP
See Also:
Constant Field Values

EPFNOSUPPORT

public static final int EPFNOSUPPORT
See Also:
Constant Field Values

ECONNRESET

public static final int ECONNRESET
See Also:
Constant Field Values

ENOBUFS

public static final int ENOBUFS
See Also:
Constant Field Values

EAFNOSUPPORT

public static final int EAFNOSUPPORT
See Also:
Constant Field Values

EPROTOTYPE

public static final int EPROTOTYPE
See Also:
Constant Field Values

ENOTSOCK

public static final int ENOTSOCK
See Also:
Constant Field Values

ENOPROTOOPT

public static final int ENOPROTOOPT
See Also:
Constant Field Values

ESHUTDOWN

public static final int ESHUTDOWN
See Also:
Constant Field Values

ECONNREFUSED

public static final int ECONNREFUSED
See Also:
Constant Field Values

EADDRINUSE

public static final int EADDRINUSE
See Also:
Constant Field Values

ECONNABORTED

public static final int ECONNABORTED
See Also:
Constant Field Values

ENETUNREACH

public static final int ENETUNREACH
See Also:
Constant Field Values

ENETDOWN

public static final int ENETDOWN
See Also:
Constant Field Values

ETIMEDOUT

public static final int ETIMEDOUT
See Also:
Constant Field Values

EHOSTDOWN

public static final int EHOSTDOWN
See Also:
Constant Field Values

EHOSTUNREACH

public static final int EHOSTUNREACH
See Also:
Constant Field Values

EINPROGRESS

public static final int EINPROGRESS
See Also:
Constant Field Values

EALREADY

public static final int EALREADY
See Also:
Constant Field Values

EDESTADDRREQ

public static final int EDESTADDRREQ
See Also:
Constant Field Values

EMSGSIZE

public static final int EMSGSIZE
See Also:
Constant Field Values

EPROTONOSUPPORT

public static final int EPROTONOSUPPORT
See Also:
Constant Field Values

ESOCKTNOSUPPORT

public static final int ESOCKTNOSUPPORT
See Also:
Constant Field Values

EADDRNOTAVAIL

public static final int EADDRNOTAVAIL
See Also:
Constant Field Values

ENETRESET

public static final int ENETRESET
See Also:
Constant Field Values

EISCONN

public static final int EISCONN
See Also:
Constant Field Values

ENOTCONN

public static final int ENOTCONN
See Also:
Constant Field Values

ETOOMANYREFS

public static final int ETOOMANYREFS
See Also:
Constant Field Values

EPROCLIM

public static final int EPROCLIM
See Also:
Constant Field Values

EUSERS

public static final int EUSERS
See Also:
Constant Field Values

EDQUOT

public static final int EDQUOT
See Also:
Constant Field Values

ESTALE

public static final int ESTALE
See Also:
Constant Field Values

ENOTSUP

public static final int ENOTSUP
See Also:
Constant Field Values

ENOMEDIUM

public static final int ENOMEDIUM
See Also:
Constant Field Values

ENOSHARE

public static final int ENOSHARE
See Also:
Constant Field Values

ECASECLASH

public static final int ECASECLASH
See Also:
Constant Field Values

EILSEQ

public static final int EILSEQ
See Also:
Constant Field Values

EOVERFLOW

public static final int EOVERFLOW
See Also:
Constant Field Values

__ELASTERROR

public static final int __ELASTERROR
See Also:
Constant Field Values
Constructor Detail

VM

public VM()
Method Detail

getState

public final int getState()

execute

public abstract void execute()
                      throws VM.EmulationException
Throws:
VM.EmulationException

_start

protected abstract void _start(int pc)

copyin

public void copyin(int addr,
                   byte[] a,
                   int length)
            throws VM.ReadFaultException
Throws:
VM.ReadFaultException

copyout

public void copyout(byte[] a,
                    int addr,
                    int length)
             throws VM.FaultException
Throws:
VM.FaultException

memRead

public final int memRead(int addr)
                  throws VM.ReadFaultException
Throws:
VM.ReadFaultException

memWrite

protected final void memWrite(int addr,
                              int value)
                       throws VM.WriteFaultException
Throws:
VM.WriteFaultException

initPage

protected void initPage(int page)

exitStatus

public final int exitStatus()

run

public final int run(java.lang.String[] args)
              throws VM.EmulationException
Throws:
VM.EmulationException

setUserInfo

public void setUserInfo(int index,
                        int word)
                 throws VM.EmulationException
Throws:
VM.EmulationException

getUserInfo

public int getUserInfo(int index)
                throws VM.EmulationException
Throws:
VM.EmulationException

start

public final void start(java.lang.String[] args)
                 throws VM.EmulationException
Throws:
VM.EmulationException

sbrk

public int sbrk(int incr)

syscall

protected int syscall(int syscall,
                      int a,
                      int b,
                      int c,
                      int d)

cstring

public java.lang.String cstring(int addr)
                         throws VM.ReadFaultException
Throws:
VM.ReadFaultException

toHex

protected static final java.lang.String toHex(int n)

min

protected static final int min(int a,
                               int b)

max

protected static final int max(int a,
                               int b)