dioscuri.module.cpu32
Class Processor

java.lang.Object
  extended by dioscuri.module.AbstractModule
      extended by dioscuri.module.ModuleCPU
          extended by dioscuri.module.cpu32.Processor
All Implemented Interfaces:
Addressable, Module, HardwareComponent, Hibernatable

public class Processor
extends ModuleCPU
implements HardwareComponent

Author:
Bram Lohman, Bart Kiers

Nested Class Summary
 
Nested classes/interfaces inherited from interface dioscuri.interfaces.Module
Module.Type
 
Field Summary
static int AC_BIT4_NEQ
           
static int AC_LNIBBLE_MAX
           
static int AC_LNIBBLE_NZERO
           
static int AC_LNIBBLE_ZERO
           
static int AC_XOR
           
 AlignmentCheckedAddressSpace alignmentCheckedMemory
           
static int CLOCK_SPEED
           
static int CR0_ALIGNMENT_MASK
           
static int CR0_CACHE_DISABLE
           
static int CR0_FPU_EMULATION
           
static int CR0_MONITOR_COPROCESSOR
           
static int CR0_NOT_WRITETHROUGH
           
static int CR0_NUMERIC_ERROR
           
static int CR0_PAGING
           
static int CR0_PROTECTION_ENABLE
           
static int CR0_TASK_SWITCHED
           
static int CR0_WRITE_PROTECT
           
static int CR3_PAGE_CACHE_DISABLE
           
static int CR3_PAGE_WRITES_TRANSPARENT
           
static int CR4_DEBUGGING_EXTENSIONS
           
static int CR4_MACHINE_CHECK_ENABLE
           
static int CR4_OS_SUPPORT_FXSAVE_FXSTORE
           
static int CR4_OS_SUPPORT_UNMASKED_SIMD_EXCEPTIONS
           
static int CR4_PAGE_GLOBAL_ENABLE
           
static int CR4_PAGE_SIZE_EXTENSIONS
           
static int CR4_PERFORMANCE_MONITORING_COUNTER_ENABLE
           
static int CR4_PHYSICAL_ADDRESS_EXTENSION
           
static int CR4_PROTECTED_MODE_VIRTUAL_INTERRUPTS
           
static int CR4_TIME_STAMP_DISABLE
           
static int CR4_VIRTUAL8086_MODE_EXTENSIONS
           
 Segment cs
           
static int CY_GREATER_FF
           
static int CY_HIGH_BYTE_NZ
           
static int CY_HIGHBIT_BYTE
           
static int CY_HIGHBIT_INT
           
static int CY_HIGHBIT_SHORT
           
static int CY_LOW_WORD_NZ
           
static int CY_LOWBIT
           
static int CY_NOT_BYTE
           
static int CY_NOT_INT
           
static int CY_NOT_SHORT
           
static int CY_NTH_BIT_SET
           
static int CY_NZ
           
static int CY_OFFENDBIT_BYTE
           
static int CY_OFFENDBIT_INT
           
static int CY_OFFENDBIT_SHORT
           
static int CY_SHL_OUTBIT_BYTE
           
static int CY_SHL_OUTBIT_INT
           
static int CY_SHL_OUTBIT_SHORT
           
static int CY_SHR_OUTBIT
           
static int CY_TWIDDLE_FF
           
static int CY_TWIDDLE_FFFF
           
static int CY_TWIDDLE_FFFFFFFF
           
 int dr0
           
 int dr1
           
 int dr2
           
 int dr3
           
 int dr4
           
 int dr5
           
 int dr6
           
 int dr7
           
 Segment ds
           
 int eax
           
 int ebp
           
 int ebx
           
 int ecx
           
 int edi
           
 int edx
           
 boolean eflagsAlignmentCheck
           
 boolean eflagsAuxiliaryCarry
           
 boolean eflagsCarry
           
 boolean eflagsDirection
           
 boolean eflagsID
           
 boolean eflagsInterruptEnable
           
 boolean eflagsInterruptEnableSoon
           
 int eflagsIOPrivilegeLevel
           
 boolean eflagsNestedTask
           
 boolean eflagsOverflow
           
 boolean eflagsParity
           
 boolean eflagsResume
           
 boolean eflagsSign
           
 boolean eflagsTrap
           
 boolean eflagsVirtual8086Mode
           
 boolean eflagsVirtualInterrupt
           
 boolean eflagsVirtualInterruptPending
           
 boolean eflagsZero
           
 int eip
           
 Segment es
           
 int esi
           
 int esp
           
 FpuState fpu
           
 Segment fs
           
 Segment gdtr
           
 Segment gs
           
 Segment idtr
           
static int IFLAGS_HARDWARE_INTERRUPT
           
static int IFLAGS_PROCESSOR_EXCEPTION
           
static int IFLAGS_RESET_REQUEST
           
 IOPortHandler ioports
           
 Segment ldtr
           
 LinearAddressSpace linearMemory
           
static int OF_ADD_BYTE
           
static int OF_ADD_INT
           
static int OF_ADD_SHORT
           
static int OF_BIT14_XOR_CARRY
           
static int OF_BIT15_DIFFERENT
           
static int OF_BIT15_XOR_CARRY
           
static int OF_BIT30_XOR_CARRY
           
static int OF_BIT31_DIFFERENT
           
static int OF_BIT31_XOR_CARRY
           
static int OF_BIT6_XOR_CARRY
           
static int OF_BIT7_DIFFERENT
           
static int OF_BIT7_XOR_CARRY
           
static int OF_HIGH_BYTE_NZ
           
static int OF_LOW_WORD_NZ
           
static int OF_MAX_BYTE
           
static int OF_MAX_INT
           
static int OF_MAX_SHORT
           
static int OF_MIN_BYTE
           
static int OF_MIN_INT
           
static int OF_MIN_SHORT
           
static int OF_NOT_BYTE
           
static int OF_NOT_INT
           
static int OF_NOT_SHORT
           
static int OF_NZ
           
static int OF_SUB_BYTE
           
static int OF_SUB_INT
           
static int OF_SUB_SHORT
           
 PhysicalAddressSpace physicalMemory
           
static int PROC_EXCEPTION_AC
           
static int PROC_EXCEPTION_BP
           
static int PROC_EXCEPTION_BR
           
static int PROC_EXCEPTION_DB
           
static int PROC_EXCEPTION_DE
           
static int PROC_EXCEPTION_DF
           
static int PROC_EXCEPTION_GP
           
static int PROC_EXCEPTION_MAX
           
static int PROC_EXCEPTION_MC
           
static int PROC_EXCEPTION_MF_09
           
static int PROC_EXCEPTION_MF_10
           
static int PROC_EXCEPTION_NM
           
static int PROC_EXCEPTION_NP
           
static int PROC_EXCEPTION_OF
           
static int PROC_EXCEPTION_PF
           
static int PROC_EXCEPTION_SS
           
static int PROC_EXCEPTION_TS
           
static int PROC_EXCEPTION_UD
           
static int PROC_EXCEPTION_XF
           
 Segment ss
           
static int STATE_MINOR_VERSION
           
static int STATE_VERSION
           
static int SYSENTER_CS_MSR
           
static int SYSENTER_EIP_MSR
           
static int SYSENTER_ESP_MSR
           
 Segment tss
           
 
Fields inherited from class dioscuri.module.AbstractModule
type
 
Constructor Summary
Processor()
           
 
Method Summary
 void acceptComponent(HardwareComponent component)
           
 void clearInterrupt()
           
 void correctAlignmentChecking(Segment segment)
           
 Segment createDescriptorTableSegment(int base, int limit)
           
 Segment createRealModeSegment(int selector)
           
 java.lang.String dumpRegisters()
          Returns a dump of the current registers with their value
 void dumpState(java.io.DataOutput output)
           
 boolean getAuxiliaryCarryFlag()
           
 boolean getCarryFlag()
           
 long getClockCount()
           
 int getCPL()
           
 boolean getCpuInstructionDebug()
          Get CPU instruction debug.
 int getCR0()
           
 int getCR2()
           
 int getCR3()
           
 int getCR4()
           
 long getCurrentInstructionNumber()
          Retrieve current number of instruction (instructions executed so far)
 int getDR0()
           
 int getDR1()
           
 int getDR2()
           
 int getDR3()
           
 int getDR6()
           
 int getDR7()
           
 int getEFlags()
           
 int getInstructionPointer()
           
 int getInterruptFlags()
           
 byte getIOPortByte(int portAddress)
          
 byte[] getIOPortDoubleWord(int portAddress)
          
 byte[] getIOPortWord(int portAddress)
          
 int getIPS()
          Get the Instructions Per Second (ips) for this CPU.
 long getMSR(int index)
           
 java.lang.String getNextInstructionInfo()
          Retrieve string with information about next instruction to be executed
 boolean getOverflowFlag()
           
 boolean getParityFlag()
           
 java.lang.String getRegisterHex(int register)
          
protected  byte[] getRegisterValue(java.lang.String registerName)
          Returns the value of a named register.
 Segment getSegment(int segmentSelector)
           
 Segment getSegment(int segmentSelector, Segment local, Segment global)
           
 boolean getSignFlag()
           
 boolean getZeroFlag()
           
 void handleHardProtectedModeInterrupt(int vector)
           
 void handleHardVirtual8086ModeInterrupt(int vector)
           
 void handleProtectedModeException(int vector, boolean hasErrorCode, int errorCode)
           
 void handleRealModeException(int vector)
           
 void handleSoftProtectedModeInterrupt(int vector)
           
 void handleSoftVirtual8086ModeInterrupt(int vector)
           
 void handleVirtual8086ModeException(int vector, boolean hasErrorCode, int errorCode)
           
protected  void incrementInstructionCounter()
          Increment current number of instruction by one
 boolean initialised()
           
protected  boolean initInstructionTables()
          Initialise the single and double byte opcode lookup arrays with instructions corresponding to the Intel hexadecimal machinecode values.
protected  boolean initRegisters()
          Initialise registers
 void interruptRequest(boolean value)
          Set the interrupt request (IRQ).
 boolean isAbnormalTermination()
          Returns if CPU halted abnormally or not
 boolean isProtectedMode()
           
 boolean isShutdown()
          Returns if CPU halted due to full system shutdown or not
 boolean isVirtual8086Mode()
           
 void loadState(java.io.DataInput input)
           
 void processClock()
           
 void processProtectedModeInterrupts()
           
 void processRealModeInterrupts()
           
 void processVirtual8086ModeInterrupts()
           
 void raiseInterrupt()
           
 void reportFPUException()
           
 void requestReset()
           
 boolean reset()
          Reset all parameters of module.
 void setAuxiliaryCarryFlag(boolean value)
           
 void setAuxiliaryCarryFlag(int dataOne, int method)
           
 void setAuxiliaryCarryFlag(int dataOne, int dataTwo, int method)
           
 void setAuxiliaryCarryFlag(int dataOne, int dataTwo, int dataThree, int method)
           
 void setCarryFlag(boolean value)
           
 void setCarryFlag(int dataOne, int method)
           
 void setCarryFlag(int dataOne, int dataTwo, int method)
           
 void setCarryFlag(int dataOne, int dataTwo, int dataThree, int method)
           
 void setCarryFlag(long dataOne, int method)
           
 void setCPL(int value)
           
 void setCpuInstructionDebug(boolean isDebugMode)
          Set the CPU instruction debug.
 void setCR0(int value)
           
 void setCR2(int value)
           
 void setCR3(int value)
           
 void setCR4(int value)
           
 void setDR0(int value)
           
 void setDR1(int value)
           
 void setDR2(int value)
           
 void setDR3(int value)
           
 void setDR6(int value)
           
 void setDR7(int value)
           
 void setEFlags(int eflags)
           
 void setHoldRequest(boolean value, Module origin)
          Sets the CPU hold mode by asserting a Hold Request.
This informs the CPU to avoid using the (non-existent) bus as another device (usually via DMA) is using it; it should be scheduled as a asynchronous event in CPU.
 void setIOPortByte(int portAddress, byte value)
          
 void setIOPortDoubleWord(int portAddress, byte[] value)
          
 void setIOPortWord(int portAddress, byte[] value)
          
 void setIPS(int ips)
          Set the Instructions Per Second (ips) for this CPU.
 void setIPS(int ips, int lowestUpdatePeriod)
          Set the Instructions Per Second (ips) for this CPU.
 void setMSR(int index, long value)
           
 void setOverflowFlag(boolean value)
           
 void setOverflowFlag(int dataOne, int method)
           
 void setOverflowFlag(int dataOne, int dataTwo, int method)
           
 void setOverflowFlag(int dataOne, int dataTwo, int dataThree, int method)
           
 void setOverflowFlag(long dataOne, int method)
           
 void setParityFlag(boolean value)
           
 void setParityFlag(int data)
           
protected  boolean setRegisterValue(java.lang.String registerName, byte[] value)
          Sets the value of a named register to given value.
protected  void setRunning(boolean status)
          Set the boolean that starts and stops the CPU loop
 void setSignFlag(boolean value)
           
 void setSignFlag(int data)
           
 void setZeroFlag(boolean value)
           
 void setZeroFlag(int data)
           
 void timerCallback()
           
 void updateComponent(HardwareComponent component)
           
 boolean updated()
           
 boolean waitForInterrupt(long time)
           
 
Methods inherited from class dioscuri.module.AbstractModule
getConnection, getConnections, getDebugMode, getDump, getExpectedConnections, getType, isConnected, setConnection, setDebugMode, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface dioscuri.interfaces.Module
getConnection, getConnections, getDebugMode, getDump, getExpectedConnections, getType, isConnected, setConnection, setDebugMode, start, stop
 

Field Detail

STATE_VERSION

public static final int STATE_VERSION
See Also:
Constant Field Values

STATE_MINOR_VERSION

public static final int STATE_MINOR_VERSION
See Also:
Constant Field Values

CLOCK_SPEED

public static final int CLOCK_SPEED
See Also:
Constant Field Values

IFLAGS_HARDWARE_INTERRUPT

public static final int IFLAGS_HARDWARE_INTERRUPT
See Also:
Constant Field Values

IFLAGS_PROCESSOR_EXCEPTION

public static final int IFLAGS_PROCESSOR_EXCEPTION
See Also:
Constant Field Values

IFLAGS_RESET_REQUEST

public static final int IFLAGS_RESET_REQUEST
See Also:
Constant Field Values

PROC_EXCEPTION_DE

public static final int PROC_EXCEPTION_DE
See Also:
Constant Field Values

PROC_EXCEPTION_DB

public static final int PROC_EXCEPTION_DB
See Also:
Constant Field Values

PROC_EXCEPTION_BP

public static final int PROC_EXCEPTION_BP
See Also:
Constant Field Values

PROC_EXCEPTION_OF

public static final int PROC_EXCEPTION_OF
See Also:
Constant Field Values

PROC_EXCEPTION_BR

public static final int PROC_EXCEPTION_BR
See Also:
Constant Field Values

PROC_EXCEPTION_UD

public static final int PROC_EXCEPTION_UD
See Also:
Constant Field Values

PROC_EXCEPTION_NM

public static final int PROC_EXCEPTION_NM
See Also:
Constant Field Values

PROC_EXCEPTION_DF

public static final int PROC_EXCEPTION_DF
See Also:
Constant Field Values

PROC_EXCEPTION_MF_09

public static final int PROC_EXCEPTION_MF_09
See Also:
Constant Field Values

PROC_EXCEPTION_TS

public static final int PROC_EXCEPTION_TS
See Also:
Constant Field Values

PROC_EXCEPTION_NP

public static final int PROC_EXCEPTION_NP
See Also:
Constant Field Values

PROC_EXCEPTION_SS

public static final int PROC_EXCEPTION_SS
See Also:
Constant Field Values

PROC_EXCEPTION_GP

public static final int PROC_EXCEPTION_GP
See Also:
Constant Field Values

PROC_EXCEPTION_PF

public static final int PROC_EXCEPTION_PF
See Also:
Constant Field Values

PROC_EXCEPTION_MF_10

public static final int PROC_EXCEPTION_MF_10
See Also:
Constant Field Values

PROC_EXCEPTION_AC

public static final int PROC_EXCEPTION_AC
See Also:
Constant Field Values

PROC_EXCEPTION_MC

public static final int PROC_EXCEPTION_MC
See Also:
Constant Field Values

PROC_EXCEPTION_XF

public static final int PROC_EXCEPTION_XF
See Also:
Constant Field Values

PROC_EXCEPTION_MAX

public static final int PROC_EXCEPTION_MAX
See Also:
Constant Field Values

CR0_PROTECTION_ENABLE

public static final int CR0_PROTECTION_ENABLE
See Also:
Constant Field Values

CR0_MONITOR_COPROCESSOR

public static final int CR0_MONITOR_COPROCESSOR
See Also:
Constant Field Values

CR0_FPU_EMULATION

public static final int CR0_FPU_EMULATION
See Also:
Constant Field Values

CR0_TASK_SWITCHED

public static final int CR0_TASK_SWITCHED
See Also:
Constant Field Values

CR0_NUMERIC_ERROR

public static final int CR0_NUMERIC_ERROR
See Also:
Constant Field Values

CR0_WRITE_PROTECT

public static final int CR0_WRITE_PROTECT
See Also:
Constant Field Values

CR0_ALIGNMENT_MASK

public static final int CR0_ALIGNMENT_MASK
See Also:
Constant Field Values

CR0_NOT_WRITETHROUGH

public static final int CR0_NOT_WRITETHROUGH
See Also:
Constant Field Values

CR0_CACHE_DISABLE

public static final int CR0_CACHE_DISABLE
See Also:
Constant Field Values

CR0_PAGING

public static final int CR0_PAGING
See Also:
Constant Field Values

CR3_PAGE_CACHE_DISABLE

public static final int CR3_PAGE_CACHE_DISABLE
See Also:
Constant Field Values

CR3_PAGE_WRITES_TRANSPARENT

public static final int CR3_PAGE_WRITES_TRANSPARENT
See Also:
Constant Field Values

CR4_VIRTUAL8086_MODE_EXTENSIONS

public static final int CR4_VIRTUAL8086_MODE_EXTENSIONS
See Also:
Constant Field Values

CR4_PROTECTED_MODE_VIRTUAL_INTERRUPTS

public static final int CR4_PROTECTED_MODE_VIRTUAL_INTERRUPTS
See Also:
Constant Field Values

CR4_TIME_STAMP_DISABLE

public static final int CR4_TIME_STAMP_DISABLE
See Also:
Constant Field Values

CR4_DEBUGGING_EXTENSIONS

public static final int CR4_DEBUGGING_EXTENSIONS
See Also:
Constant Field Values

CR4_PAGE_SIZE_EXTENSIONS

public static final int CR4_PAGE_SIZE_EXTENSIONS
See Also:
Constant Field Values

CR4_PHYSICAL_ADDRESS_EXTENSION

public static final int CR4_PHYSICAL_ADDRESS_EXTENSION
See Also:
Constant Field Values

CR4_MACHINE_CHECK_ENABLE

public static final int CR4_MACHINE_CHECK_ENABLE
See Also:
Constant Field Values

CR4_PAGE_GLOBAL_ENABLE

public static final int CR4_PAGE_GLOBAL_ENABLE
See Also:
Constant Field Values

CR4_PERFORMANCE_MONITORING_COUNTER_ENABLE

public static final int CR4_PERFORMANCE_MONITORING_COUNTER_ENABLE
See Also:
Constant Field Values

CR4_OS_SUPPORT_FXSAVE_FXSTORE

public static final int CR4_OS_SUPPORT_FXSAVE_FXSTORE
See Also:
Constant Field Values

CR4_OS_SUPPORT_UNMASKED_SIMD_EXCEPTIONS

public static final int CR4_OS_SUPPORT_UNMASKED_SIMD_EXCEPTIONS
See Also:
Constant Field Values

SYSENTER_CS_MSR

public static final int SYSENTER_CS_MSR
See Also:
Constant Field Values

SYSENTER_ESP_MSR

public static final int SYSENTER_ESP_MSR
See Also:
Constant Field Values

SYSENTER_EIP_MSR

public static final int SYSENTER_EIP_MSR
See Also:
Constant Field Values

eax

public int eax

ebx

public int ebx

edx

public int edx

ecx

public int ecx

esi

public int esi

edi

public int edi

esp

public int esp

ebp

public int ebp

eip

public int eip

dr0

public int dr0

dr1

public int dr1

dr2

public int dr2

dr3

public int dr3

dr4

public int dr4

dr5

public int dr5

dr6

public int dr6

dr7

public int dr7

cs

public Segment cs

ds

public Segment ds

ss

public Segment ss

es

public Segment es

fs

public Segment fs

gs

public Segment gs

idtr

public Segment idtr

gdtr

public Segment gdtr

ldtr

public Segment ldtr

tss

public Segment tss

eflagsCarry

public boolean eflagsCarry

eflagsParity

public boolean eflagsParity

eflagsAuxiliaryCarry

public boolean eflagsAuxiliaryCarry

eflagsZero

public boolean eflagsZero

eflagsSign

public boolean eflagsSign

eflagsTrap

public boolean eflagsTrap

eflagsInterruptEnable

public boolean eflagsInterruptEnable

eflagsDirection

public boolean eflagsDirection

eflagsOverflow

public boolean eflagsOverflow

eflagsIOPrivilegeLevel

public int eflagsIOPrivilegeLevel

eflagsNestedTask

public boolean eflagsNestedTask

eflagsResume

public boolean eflagsResume

eflagsVirtual8086Mode

public boolean eflagsVirtual8086Mode

eflagsAlignmentCheck

public boolean eflagsAlignmentCheck

eflagsVirtualInterrupt

public boolean eflagsVirtualInterrupt

eflagsVirtualInterruptPending

public boolean eflagsVirtualInterruptPending

eflagsID

public boolean eflagsID

eflagsInterruptEnableSoon

public boolean eflagsInterruptEnableSoon

linearMemory

public LinearAddressSpace linearMemory

physicalMemory

public PhysicalAddressSpace physicalMemory

alignmentCheckedMemory

public AlignmentCheckedAddressSpace alignmentCheckedMemory

ioports

public IOPortHandler ioports

fpu

public FpuState fpu

AC_XOR

public static final int AC_XOR
See Also:
Constant Field Values

AC_BIT4_NEQ

public static final int AC_BIT4_NEQ
See Also:
Constant Field Values

AC_LNIBBLE_MAX

public static final int AC_LNIBBLE_MAX
See Also:
Constant Field Values

AC_LNIBBLE_ZERO

public static final int AC_LNIBBLE_ZERO
See Also:
Constant Field Values

AC_LNIBBLE_NZERO

public static final int AC_LNIBBLE_NZERO
See Also:
Constant Field Values

OF_NZ

public static final int OF_NZ
See Also:
Constant Field Values

OF_NOT_BYTE

public static final int OF_NOT_BYTE
See Also:
Constant Field Values

OF_NOT_SHORT

public static final int OF_NOT_SHORT
See Also:
Constant Field Values

OF_NOT_INT

public static final int OF_NOT_INT
See Also:
Constant Field Values

OF_LOW_WORD_NZ

public static final int OF_LOW_WORD_NZ
See Also:
Constant Field Values

OF_HIGH_BYTE_NZ

public static final int OF_HIGH_BYTE_NZ
See Also:
Constant Field Values

OF_BIT6_XOR_CARRY

public static final int OF_BIT6_XOR_CARRY
See Also:
Constant Field Values

OF_BIT7_XOR_CARRY

public static final int OF_BIT7_XOR_CARRY
See Also:
Constant Field Values

OF_BIT14_XOR_CARRY

public static final int OF_BIT14_XOR_CARRY
See Also:
Constant Field Values

OF_BIT15_XOR_CARRY

public static final int OF_BIT15_XOR_CARRY
See Also:
Constant Field Values

OF_BIT30_XOR_CARRY

public static final int OF_BIT30_XOR_CARRY
See Also:
Constant Field Values

OF_BIT31_XOR_CARRY

public static final int OF_BIT31_XOR_CARRY
See Also:
Constant Field Values

OF_BIT7_DIFFERENT

public static final int OF_BIT7_DIFFERENT
See Also:
Constant Field Values

OF_BIT15_DIFFERENT

public static final int OF_BIT15_DIFFERENT
See Also:
Constant Field Values

OF_BIT31_DIFFERENT

public static final int OF_BIT31_DIFFERENT
See Also:
Constant Field Values

OF_MAX_BYTE

public static final int OF_MAX_BYTE
See Also:
Constant Field Values

OF_MAX_SHORT

public static final int OF_MAX_SHORT
See Also:
Constant Field Values

OF_MAX_INT

public static final int OF_MAX_INT
See Also:
Constant Field Values

OF_MIN_BYTE

public static final int OF_MIN_BYTE
See Also:
Constant Field Values

OF_MIN_SHORT

public static final int OF_MIN_SHORT
See Also:
Constant Field Values

OF_MIN_INT

public static final int OF_MIN_INT
See Also:
Constant Field Values

OF_ADD_BYTE

public static final int OF_ADD_BYTE
See Also:
Constant Field Values

OF_ADD_SHORT

public static final int OF_ADD_SHORT
See Also:
Constant Field Values

OF_ADD_INT

public static final int OF_ADD_INT
See Also:
Constant Field Values

OF_SUB_BYTE

public static final int OF_SUB_BYTE
See Also:
Constant Field Values

OF_SUB_SHORT

public static final int OF_SUB_SHORT
See Also:
Constant Field Values

OF_SUB_INT

public static final int OF_SUB_INT
See Also:
Constant Field Values

CY_NZ

public static final int CY_NZ
See Also:
Constant Field Values

CY_NOT_BYTE

public static final int CY_NOT_BYTE
See Also:
Constant Field Values

CY_NOT_SHORT

public static final int CY_NOT_SHORT
See Also:
Constant Field Values

CY_NOT_INT

public static final int CY_NOT_INT
See Also:
Constant Field Values

CY_LOW_WORD_NZ

public static final int CY_LOW_WORD_NZ
See Also:
Constant Field Values

CY_HIGH_BYTE_NZ

public static final int CY_HIGH_BYTE_NZ
See Also:
Constant Field Values

CY_NTH_BIT_SET

public static final int CY_NTH_BIT_SET
See Also:
Constant Field Values

CY_GREATER_FF

public static final int CY_GREATER_FF
See Also:
Constant Field Values

CY_TWIDDLE_FF

public static final int CY_TWIDDLE_FF
See Also:
Constant Field Values

CY_TWIDDLE_FFFF

public static final int CY_TWIDDLE_FFFF
See Also:
Constant Field Values

CY_TWIDDLE_FFFFFFFF

public static final int CY_TWIDDLE_FFFFFFFF
See Also:
Constant Field Values

CY_SHL_OUTBIT_BYTE

public static final int CY_SHL_OUTBIT_BYTE
See Also:
Constant Field Values

CY_SHL_OUTBIT_SHORT

public static final int CY_SHL_OUTBIT_SHORT
See Also:
Constant Field Values

CY_SHL_OUTBIT_INT

public static final int CY_SHL_OUTBIT_INT
See Also:
Constant Field Values

CY_SHR_OUTBIT

public static final int CY_SHR_OUTBIT
See Also:
Constant Field Values

CY_LOWBIT

public static final int CY_LOWBIT
See Also:
Constant Field Values

CY_HIGHBIT_BYTE

public static final int CY_HIGHBIT_BYTE
See Also:
Constant Field Values

CY_HIGHBIT_SHORT

public static final int CY_HIGHBIT_SHORT
See Also:
Constant Field Values

CY_HIGHBIT_INT

public static final int CY_HIGHBIT_INT
See Also:
Constant Field Values

CY_OFFENDBIT_BYTE

public static final int CY_OFFENDBIT_BYTE
See Also:
Constant Field Values

CY_OFFENDBIT_SHORT

public static final int CY_OFFENDBIT_SHORT
See Also:
Constant Field Values

CY_OFFENDBIT_INT

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

Processor

public Processor()
Method Detail

dumpState

public void dumpState(java.io.DataOutput output)
               throws java.io.IOException
Specified by:
dumpState in interface HardwareComponent
Parameters:
output -
Throws:
java.io.IOException

loadState

public void loadState(java.io.DataInput input)
               throws java.io.IOException
Specified by:
loadState in interface HardwareComponent
Parameters:
input -
Throws:
java.io.IOException

getEFlags

public int getEFlags()
Returns:
-

setEFlags

public void setEFlags(int eflags)
Parameters:
eflags -

processClock

public void processClock()

setCPL

public void setCPL(int value)
Parameters:
value -

getCPL

public int getCPL()
Returns:
-

reportFPUException

public void reportFPUException()

raiseInterrupt

public void raiseInterrupt()

clearInterrupt

public void clearInterrupt()

waitForInterrupt

public boolean waitForInterrupt(long time)
Parameters:
time -
Returns:
-

requestReset

public void requestReset()

getInterruptFlags

public int getInterruptFlags()
Returns:
-

isProtectedMode

public boolean isProtectedMode()
Returns:
-

isVirtual8086Mode

public boolean isVirtual8086Mode()
Returns:
-

setCR0

public void setCR0(int value)
Parameters:
value -

getCR0

public int getCR0()
Returns:
-

setCR3

public void setCR3(int value)
Parameters:
value -

getCR3

public int getCR3()
Returns:
-

getCR2

public int getCR2()
Returns:
-

setCR2

public void setCR2(int value)
Parameters:
value -

setCR4

public void setCR4(int value)
Parameters:
value -

getCR4

public int getCR4()
Returns:
-

setDR0

public void setDR0(int value)
Parameters:
value -

setDR1

public void setDR1(int value)
Parameters:
value -

setDR2

public void setDR2(int value)
Parameters:
value -

setDR3

public void setDR3(int value)
Parameters:
value -

setDR6

public void setDR6(int value)
Parameters:
value -

setDR7

public void setDR7(int value)
Parameters:
value -

getDR0

public int getDR0()
Returns:
-

getDR1

public int getDR1()
Returns:
-

getDR2

public int getDR2()
Returns:
-

getDR3

public int getDR3()
Returns:
-

getDR6

public int getDR6()
Returns:
-

getDR7

public int getDR7()
Returns:
-

getMSR

public long getMSR(int index)
Parameters:
index -
Returns:
-

setMSR

public void setMSR(int index,
                   long value)
Parameters:
index -
value -

createRealModeSegment

public Segment createRealModeSegment(int selector)
Parameters:
selector -
Returns:
-

createDescriptorTableSegment

public Segment createDescriptorTableSegment(int base,
                                            int limit)
Parameters:
base -
limit -
Returns:
-

correctAlignmentChecking

public void correctAlignmentChecking(Segment segment)
Parameters:
segment -

getSegment

public Segment getSegment(int segmentSelector)
Parameters:
segmentSelector -
Returns:
-

getSegment

public Segment getSegment(int segmentSelector,
                          Segment local,
                          Segment global)
Parameters:
segmentSelector -
local -
global -
Returns:
-

reset

public boolean reset()
Reset all parameters of module.

Specified by:
reset in interface Module
Specified by:
reset in interface HardwareComponent
Specified by:
reset in class AbstractModule
Returns:
true iff the AbstractModule was reset properly.
See Also:
AbstractModule

getClockCount

public long getClockCount()
Returns:
-

getInstructionPointer

public final int getInstructionPointer()
Returns:
-

processRealModeInterrupts

public final void processRealModeInterrupts()

processProtectedModeInterrupts

public final void processProtectedModeInterrupts()

processVirtual8086ModeInterrupts

public final void processVirtual8086ModeInterrupts()

handleRealModeException

public final void handleRealModeException(int vector)
Parameters:
vector -

handleProtectedModeException

public final void handleProtectedModeException(int vector,
                                               boolean hasErrorCode,
                                               int errorCode)
Parameters:
vector -
hasErrorCode -
errorCode -

handleSoftProtectedModeInterrupt

public final void handleSoftProtectedModeInterrupt(int vector)
Parameters:
vector -

handleHardProtectedModeInterrupt

public final void handleHardProtectedModeInterrupt(int vector)
Parameters:
vector -

handleVirtual8086ModeException

public final void handleVirtual8086ModeException(int vector,
                                                 boolean hasErrorCode,
                                                 int errorCode)
Parameters:
vector -
hasErrorCode -
errorCode -

handleSoftVirtual8086ModeInterrupt

public final void handleSoftVirtual8086ModeInterrupt(int vector)
Parameters:
vector -

handleHardVirtual8086ModeInterrupt

public final void handleHardVirtual8086ModeInterrupt(int vector)
Parameters:
vector -

initialised

public boolean initialised()
Specified by:
initialised in interface HardwareComponent
Returns:
-

acceptComponent

public void acceptComponent(HardwareComponent component)
Specified by:
acceptComponent in interface HardwareComponent
Parameters:
component -

getAuxiliaryCarryFlag

public boolean getAuxiliaryCarryFlag()
Returns:
-

setAuxiliaryCarryFlag

public void setAuxiliaryCarryFlag(int dataOne,
                                  int dataTwo,
                                  int dataThree,
                                  int method)
Parameters:
dataOne -
dataTwo -
dataThree -
method -

setAuxiliaryCarryFlag

public void setAuxiliaryCarryFlag(int dataOne,
                                  int dataTwo,
                                  int method)
Parameters:
dataOne -
dataTwo -
method -

setAuxiliaryCarryFlag

public void setAuxiliaryCarryFlag(int dataOne,
                                  int method)
Parameters:
dataOne -
method -

setAuxiliaryCarryFlag

public void setAuxiliaryCarryFlag(boolean value)
Parameters:
value -

getParityFlag

public boolean getParityFlag()
Returns:
-

setParityFlag

public void setParityFlag(boolean value)
Parameters:
value -

setParityFlag

public void setParityFlag(int data)
Parameters:
data -

getOverflowFlag

public boolean getOverflowFlag()
Returns:
-

setOverflowFlag

public void setOverflowFlag(boolean value)
Parameters:
value -

setOverflowFlag

public void setOverflowFlag(long dataOne,
                            int method)
Parameters:
dataOne -
method -

setOverflowFlag

public void setOverflowFlag(int dataOne,
                            int method)
Parameters:
dataOne -
method -

setOverflowFlag

public void setOverflowFlag(int dataOne,
                            int dataTwo,
                            int method)
Parameters:
dataOne -
dataTwo -
method -

setOverflowFlag

public void setOverflowFlag(int dataOne,
                            int dataTwo,
                            int dataThree,
                            int method)
Parameters:
dataOne -
dataTwo -
dataThree -
method -

getCarryFlag

public boolean getCarryFlag()
Returns:
-

setCarryFlag

public void setCarryFlag(boolean value)
Parameters:
value -

setCarryFlag

public void setCarryFlag(long dataOne,
                         int method)
Parameters:
dataOne -
method -

setCarryFlag

public void setCarryFlag(int dataOne,
                         int method)
Parameters:
dataOne -
method -

setCarryFlag

public void setCarryFlag(int dataOne,
                         int dataTwo,
                         int method)
Parameters:
dataOne -
dataTwo -
method -

setCarryFlag

public void setCarryFlag(int dataOne,
                         int dataTwo,
                         int dataThree,
                         int method)
Parameters:
dataOne -
dataTwo -
dataThree -
method -

getZeroFlag

public boolean getZeroFlag()
Returns:
-

setZeroFlag

public void setZeroFlag(boolean value)
Parameters:
value -

setZeroFlag

public void setZeroFlag(int data)
Parameters:
data -

getSignFlag

public boolean getSignFlag()
Returns:
-

setSignFlag

public void setSignFlag(boolean value)
Parameters:
value -

setSignFlag

public void setSignFlag(int data)
Parameters:
data -

updated

public boolean updated()
Specified by:
updated in interface HardwareComponent
Returns:
-

updateComponent

public void updateComponent(HardwareComponent component)
Specified by:
updateComponent in interface HardwareComponent
Parameters:
component -

timerCallback

public void timerCallback()
Specified by:
timerCallback in interface HardwareComponent

dumpRegisters

public java.lang.String dumpRegisters()
Returns a dump of the current registers with their value

Specified by:
dumpRegisters in class ModuleCPU
Returns:
String containing a register dump
See Also:
ModuleCPU

getCpuInstructionDebug

public boolean getCpuInstructionDebug()
Get CPU instruction debug.

Specified by:
getCpuInstructionDebug in class ModuleCPU
Returns:
cpuInstructionDebug.
See Also:
ModuleCPU

getCurrentInstructionNumber

public long getCurrentInstructionNumber()
Retrieve current number of instruction (instructions executed so far)

Specified by:
getCurrentInstructionNumber in class ModuleCPU
Returns:
long containing number of instructions
See Also:
ModuleCPU

getIOPortByte

public byte getIOPortByte(int portAddress)
                   throws ModuleException,
                          WriteOnlyPortException

Specified by:
getIOPortByte in interface Addressable
Returns:
Throws:
ModuleException
WriteOnlyPortException
See Also:
Addressable

getIOPortDoubleWord

public byte[] getIOPortDoubleWord(int portAddress)
                           throws ModuleException,
                                  WriteOnlyPortException

Specified by:
getIOPortDoubleWord in interface Addressable
Returns:
Throws:
ModuleException
WriteOnlyPortException
See Also:
Addressable

getIOPortWord

public byte[] getIOPortWord(int portAddress)
                     throws ModuleException,
                            WriteOnlyPortException

Specified by:
getIOPortWord in interface Addressable
Returns:
Throws:
ModuleException
WriteOnlyPortException
See Also:
Addressable

getIPS

public int getIPS()
Get the Instructions Per Second (ips) for this CPU.

Specified by:
getIPS in class ModuleCPU
Returns:
the Instructions Per Second (ips) for this CPU.
See Also:
ModuleCPU

getNextInstructionInfo

public java.lang.String getNextInstructionInfo()
Retrieve string with information about next instruction to be executed

Specified by:
getNextInstructionInfo in class ModuleCPU
Returns:
string containing next instruction information
See Also:
ModuleCPU

getRegisterHex

public java.lang.String getRegisterHex(int register)

Specified by:
getRegisterHex in class ModuleCPU
Returns:
See Also:
ModuleCPU

getRegisterValue

protected byte[] getRegisterValue(java.lang.String registerName)
Returns the value of a named register.

Specified by:
getRegisterValue in class ModuleCPU
Returns:
int[] with value of register, null otherwise
See Also:
ModuleCPU

incrementInstructionCounter

protected void incrementInstructionCounter()
Increment current number of instruction by one

Specified by:
incrementInstructionCounter in class ModuleCPU
See Also:
ModuleCPU

initInstructionTables

protected boolean initInstructionTables()
Initialise the single and double byte opcode lookup arrays with instructions corresponding to the Intel hexadecimal machinecode values.

Specified by:
initInstructionTables in class ModuleCPU
Returns:
See Also:
ModuleCPU

initRegisters

protected boolean initRegisters()
Initialise registers

Specified by:
initRegisters in class ModuleCPU
Returns:
true if initialisation is successful, false otherwise
See Also:
ModuleCPU

interruptRequest

public void interruptRequest(boolean value)
Set the interrupt request (IRQ).

Specified by:
interruptRequest in class ModuleCPU
See Also:
ModuleCPU

isAbnormalTermination

public boolean isAbnormalTermination()
Returns if CPU halted abnormally or not

Specified by:
isAbnormalTermination in class ModuleCPU
Returns:
boolean abnormalTermination true if abnormal, false otherwise
See Also:
ModuleCPU

setCpuInstructionDebug

public void setCpuInstructionDebug(boolean isDebugMode)
Set the CPU instruction debug.

Specified by:
setCpuInstructionDebug in class ModuleCPU
Parameters:
isDebugMode - status of instructionDebug (on/off)
See Also:
ModuleCPU

setHoldRequest

public void setHoldRequest(boolean value,
                           Module origin)
Sets the CPU hold mode by asserting a Hold Request.
This informs the CPU to avoid using the (non-existent) bus as another device (usually via DMA) is using it; it should be scheduled as a asynchronous event in CPU.

Specified by:
setHoldRequest in class ModuleCPU
Parameters:
value - state of the Hold Request
origin - -
See Also:
ModuleCPU

setIOPortByte

public void setIOPortByte(int portAddress,
                          byte value)
                   throws ModuleException

Specified by:
setIOPortByte in interface Addressable
Throws:
ModuleException
See Also:
Addressable

setIOPortDoubleWord

public void setIOPortDoubleWord(int portAddress,
                                byte[] value)
                         throws ModuleException

Specified by:
setIOPortDoubleWord in interface Addressable
Throws:
ModuleException
See Also:
Addressable

setIOPortWord

public void setIOPortWord(int portAddress,
                          byte[] value)
                   throws ModuleException

Specified by:
setIOPortWord in interface Addressable
Throws:
ModuleException
See Also:
Addressable

setIPS

public void setIPS(int ips)
Set the Instructions Per Second (ips) for this CPU.

Specified by:
setIPS in class ModuleCPU
Parameters:
ips - the Instructions Per Second (ips) for this CPU.
See Also:
ModuleCPU

setIPS

public void setIPS(int ips,
                   int lowestUpdatePeriod)
Set the Instructions Per Second (ips) for this CPU. Also, define what the smallest period is for sending a clockpulse (in microseconds)

Specified by:
setIPS in class ModuleCPU
lowestUpdatePeriod - the lowest update period in microseconds
See Also:
ModuleCPU

setRegisterValue

protected boolean setRegisterValue(java.lang.String registerName,
                                   byte[] value)
Sets the value of a named register to given value.

Specified by:
setRegisterValue in class ModuleCPU
value - containing the value
Returns:
true if set was successful, false otherwise
See Also:
ModuleCPU

setRunning

protected void setRunning(boolean status)
Set the boolean that starts and stops the CPU loop

Specified by:
setRunning in class ModuleCPU
Parameters:
status - sets the isRunning boolean
See Also:
ModuleCPU

isShutdown

public boolean isShutdown()
Returns if CPU halted due to full system shutdown or not

Specified by:
isShutdown in class ModuleCPU
Returns:
boolean shutDown true if emulator should shutdown, false otherwise
See Also:
ModuleCPU