|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dioscuri.module.AbstractModule dioscuri.module.ModuleCPU dioscuri.module.cpu32.Processor
public class Processor
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface dioscuri.interfaces.Module |
---|
Module.Type |
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 |
---|
public static final int STATE_VERSION
public static final int STATE_MINOR_VERSION
public static final int CLOCK_SPEED
public static final int IFLAGS_HARDWARE_INTERRUPT
public static final int IFLAGS_PROCESSOR_EXCEPTION
public static final int IFLAGS_RESET_REQUEST
public static final int PROC_EXCEPTION_DE
public static final int PROC_EXCEPTION_DB
public static final int PROC_EXCEPTION_BP
public static final int PROC_EXCEPTION_OF
public static final int PROC_EXCEPTION_BR
public static final int PROC_EXCEPTION_UD
public static final int PROC_EXCEPTION_NM
public static final int PROC_EXCEPTION_DF
public static final int PROC_EXCEPTION_MF_09
public static final int PROC_EXCEPTION_TS
public static final int PROC_EXCEPTION_NP
public static final int PROC_EXCEPTION_SS
public static final int PROC_EXCEPTION_GP
public static final int PROC_EXCEPTION_PF
public static final int PROC_EXCEPTION_MF_10
public static final int PROC_EXCEPTION_AC
public static final int PROC_EXCEPTION_MC
public static final int PROC_EXCEPTION_XF
public static final int PROC_EXCEPTION_MAX
public static final int CR0_PROTECTION_ENABLE
public static final int CR0_MONITOR_COPROCESSOR
public static final int CR0_FPU_EMULATION
public static final int CR0_TASK_SWITCHED
public static final int CR0_NUMERIC_ERROR
public static final int CR0_WRITE_PROTECT
public static final int CR0_ALIGNMENT_MASK
public static final int CR0_NOT_WRITETHROUGH
public static final int CR0_CACHE_DISABLE
public static final int CR0_PAGING
public static final int CR3_PAGE_CACHE_DISABLE
public static final int CR3_PAGE_WRITES_TRANSPARENT
public static final int CR4_VIRTUAL8086_MODE_EXTENSIONS
public static final int CR4_PROTECTED_MODE_VIRTUAL_INTERRUPTS
public static final int CR4_TIME_STAMP_DISABLE
public static final int CR4_DEBUGGING_EXTENSIONS
public static final int CR4_PAGE_SIZE_EXTENSIONS
public static final int CR4_PHYSICAL_ADDRESS_EXTENSION
public static final int CR4_MACHINE_CHECK_ENABLE
public static final int CR4_PAGE_GLOBAL_ENABLE
public static final int CR4_PERFORMANCE_MONITORING_COUNTER_ENABLE
public static final int CR4_OS_SUPPORT_FXSAVE_FXSTORE
public static final int CR4_OS_SUPPORT_UNMASKED_SIMD_EXCEPTIONS
public static final int SYSENTER_CS_MSR
public static final int SYSENTER_ESP_MSR
public static final int SYSENTER_EIP_MSR
public int eax
public int ebx
public int edx
public int ecx
public int esi
public int edi
public int esp
public int ebp
public int eip
public int dr0
public int dr1
public int dr2
public int dr3
public int dr4
public int dr5
public int dr6
public int dr7
public Segment cs
public Segment ds
public Segment ss
public Segment es
public Segment fs
public Segment gs
public Segment idtr
public Segment gdtr
public Segment ldtr
public Segment tss
public boolean eflagsCarry
public boolean eflagsParity
public boolean eflagsAuxiliaryCarry
public boolean eflagsZero
public boolean eflagsSign
public boolean eflagsTrap
public boolean eflagsInterruptEnable
public boolean eflagsDirection
public boolean eflagsOverflow
public int eflagsIOPrivilegeLevel
public boolean eflagsNestedTask
public boolean eflagsResume
public boolean eflagsVirtual8086Mode
public boolean eflagsAlignmentCheck
public boolean eflagsVirtualInterrupt
public boolean eflagsVirtualInterruptPending
public boolean eflagsID
public boolean eflagsInterruptEnableSoon
public LinearAddressSpace linearMemory
public PhysicalAddressSpace physicalMemory
public AlignmentCheckedAddressSpace alignmentCheckedMemory
public IOPortHandler ioports
public FpuState fpu
public static final int AC_XOR
public static final int AC_BIT4_NEQ
public static final int AC_LNIBBLE_MAX
public static final int AC_LNIBBLE_ZERO
public static final int AC_LNIBBLE_NZERO
public static final int OF_NZ
public static final int OF_NOT_BYTE
public static final int OF_NOT_SHORT
public static final int OF_NOT_INT
public static final int OF_LOW_WORD_NZ
public static final int OF_HIGH_BYTE_NZ
public static final int OF_BIT6_XOR_CARRY
public static final int OF_BIT7_XOR_CARRY
public static final int OF_BIT14_XOR_CARRY
public static final int OF_BIT15_XOR_CARRY
public static final int OF_BIT30_XOR_CARRY
public static final int OF_BIT31_XOR_CARRY
public static final int OF_BIT7_DIFFERENT
public static final int OF_BIT15_DIFFERENT
public static final int OF_BIT31_DIFFERENT
public static final int OF_MAX_BYTE
public static final int OF_MAX_SHORT
public static final int OF_MAX_INT
public static final int OF_MIN_BYTE
public static final int OF_MIN_SHORT
public static final int OF_MIN_INT
public static final int OF_ADD_BYTE
public static final int OF_ADD_SHORT
public static final int OF_ADD_INT
public static final int OF_SUB_BYTE
public static final int OF_SUB_SHORT
public static final int OF_SUB_INT
public static final int CY_NZ
public static final int CY_NOT_BYTE
public static final int CY_NOT_SHORT
public static final int CY_NOT_INT
public static final int CY_LOW_WORD_NZ
public static final int CY_HIGH_BYTE_NZ
public static final int CY_NTH_BIT_SET
public static final int CY_GREATER_FF
public static final int CY_TWIDDLE_FF
public static final int CY_TWIDDLE_FFFF
public static final int CY_TWIDDLE_FFFFFFFF
public static final int CY_SHL_OUTBIT_BYTE
public static final int CY_SHL_OUTBIT_SHORT
public static final int CY_SHL_OUTBIT_INT
public static final int CY_SHR_OUTBIT
public static final int CY_LOWBIT
public static final int CY_HIGHBIT_BYTE
public static final int CY_HIGHBIT_SHORT
public static final int CY_HIGHBIT_INT
public static final int CY_OFFENDBIT_BYTE
public static final int CY_OFFENDBIT_SHORT
public static final int CY_OFFENDBIT_INT
Constructor Detail |
---|
public Processor()
Method Detail |
---|
public void dumpState(java.io.DataOutput output) throws java.io.IOException
dumpState
in interface HardwareComponent
output
-
java.io.IOException
public void loadState(java.io.DataInput input) throws java.io.IOException
loadState
in interface HardwareComponent
input
-
java.io.IOException
public int getEFlags()
public void setEFlags(int eflags)
eflags
- public void processClock()
public void setCPL(int value)
value
- public int getCPL()
public void reportFPUException()
public void raiseInterrupt()
public void clearInterrupt()
public boolean waitForInterrupt(long time)
time
-
public void requestReset()
public int getInterruptFlags()
public boolean isProtectedMode()
public boolean isVirtual8086Mode()
public void setCR0(int value)
value
- public int getCR0()
public void setCR3(int value)
value
- public int getCR3()
public int getCR2()
public void setCR2(int value)
value
- public void setCR4(int value)
value
- public int getCR4()
public void setDR0(int value)
value
- public void setDR1(int value)
value
- public void setDR2(int value)
value
- public void setDR3(int value)
value
- public void setDR6(int value)
value
- public void setDR7(int value)
value
- public int getDR0()
public int getDR1()
public int getDR2()
public int getDR3()
public int getDR6()
public int getDR7()
public long getMSR(int index)
index
-
public void setMSR(int index, long value)
index
- value
- public Segment createRealModeSegment(int selector)
selector
-
public Segment createDescriptorTableSegment(int base, int limit)
base
- limit
-
public void correctAlignmentChecking(Segment segment)
segment
- public Segment getSegment(int segmentSelector)
segmentSelector
-
public Segment getSegment(int segmentSelector, Segment local, Segment global)
segmentSelector
- local
- global
-
public boolean reset()
reset
in interface Module
reset
in interface HardwareComponent
reset
in class AbstractModule
AbstractModule
public long getClockCount()
public final int getInstructionPointer()
public final void processRealModeInterrupts()
public final void processProtectedModeInterrupts()
public final void processVirtual8086ModeInterrupts()
public final void handleRealModeException(int vector)
vector
- public final void handleProtectedModeException(int vector, boolean hasErrorCode, int errorCode)
vector
- hasErrorCode
- errorCode
- public final void handleSoftProtectedModeInterrupt(int vector)
vector
- public final void handleHardProtectedModeInterrupt(int vector)
vector
- public final void handleVirtual8086ModeException(int vector, boolean hasErrorCode, int errorCode)
vector
- hasErrorCode
- errorCode
- public final void handleSoftVirtual8086ModeInterrupt(int vector)
vector
- public final void handleHardVirtual8086ModeInterrupt(int vector)
vector
- public boolean initialised()
initialised
in interface HardwareComponent
public void acceptComponent(HardwareComponent component)
acceptComponent
in interface HardwareComponent
component
- public boolean getAuxiliaryCarryFlag()
public void setAuxiliaryCarryFlag(int dataOne, int dataTwo, int dataThree, int method)
dataOne
- dataTwo
- dataThree
- method
- public void setAuxiliaryCarryFlag(int dataOne, int dataTwo, int method)
dataOne
- dataTwo
- method
- public void setAuxiliaryCarryFlag(int dataOne, int method)
dataOne
- method
- public void setAuxiliaryCarryFlag(boolean value)
value
- public boolean getParityFlag()
public void setParityFlag(boolean value)
value
- public void setParityFlag(int data)
data
- public boolean getOverflowFlag()
public void setOverflowFlag(boolean value)
value
- public void setOverflowFlag(long dataOne, int method)
dataOne
- method
- public void setOverflowFlag(int dataOne, int method)
dataOne
- method
- public void setOverflowFlag(int dataOne, int dataTwo, int method)
dataOne
- dataTwo
- method
- public void setOverflowFlag(int dataOne, int dataTwo, int dataThree, int method)
dataOne
- dataTwo
- dataThree
- method
- public boolean getCarryFlag()
public void setCarryFlag(boolean value)
value
- public void setCarryFlag(long dataOne, int method)
dataOne
- method
- public void setCarryFlag(int dataOne, int method)
dataOne
- method
- public void setCarryFlag(int dataOne, int dataTwo, int method)
dataOne
- dataTwo
- method
- public void setCarryFlag(int dataOne, int dataTwo, int dataThree, int method)
dataOne
- dataTwo
- dataThree
- method
- public boolean getZeroFlag()
public void setZeroFlag(boolean value)
value
- public void setZeroFlag(int data)
data
- public boolean getSignFlag()
public void setSignFlag(boolean value)
value
- public void setSignFlag(int data)
data
- public boolean updated()
updated
in interface HardwareComponent
public void updateComponent(HardwareComponent component)
updateComponent
in interface HardwareComponent
component
- public void timerCallback()
timerCallback
in interface HardwareComponent
public java.lang.String dumpRegisters()
dumpRegisters
in class ModuleCPU
ModuleCPU
public boolean getCpuInstructionDebug()
getCpuInstructionDebug
in class ModuleCPU
ModuleCPU
public long getCurrentInstructionNumber()
getCurrentInstructionNumber
in class ModuleCPU
ModuleCPU
public byte getIOPortByte(int portAddress) throws ModuleException, WriteOnlyPortException
getIOPortByte
in interface Addressable
ModuleException
WriteOnlyPortException
Addressable
public byte[] getIOPortDoubleWord(int portAddress) throws ModuleException, WriteOnlyPortException
getIOPortDoubleWord
in interface Addressable
ModuleException
WriteOnlyPortException
Addressable
public byte[] getIOPortWord(int portAddress) throws ModuleException, WriteOnlyPortException
getIOPortWord
in interface Addressable
ModuleException
WriteOnlyPortException
Addressable
public int getIPS()
getIPS
in class ModuleCPU
ModuleCPU
public java.lang.String getNextInstructionInfo()
getNextInstructionInfo
in class ModuleCPU
ModuleCPU
public java.lang.String getRegisterHex(int register)
getRegisterHex
in class ModuleCPU
ModuleCPU
protected byte[] getRegisterValue(java.lang.String registerName)
getRegisterValue
in class ModuleCPU
ModuleCPU
protected void incrementInstructionCounter()
incrementInstructionCounter
in class ModuleCPU
ModuleCPU
protected boolean initInstructionTables()
initInstructionTables
in class ModuleCPU
ModuleCPU
protected boolean initRegisters()
initRegisters
in class ModuleCPU
ModuleCPU
public void interruptRequest(boolean value)
interruptRequest
in class ModuleCPU
ModuleCPU
public boolean isAbnormalTermination()
isAbnormalTermination
in class ModuleCPU
ModuleCPU
public void setCpuInstructionDebug(boolean isDebugMode)
setCpuInstructionDebug
in class ModuleCPU
isDebugMode
- status of instructionDebug (on/off)ModuleCPU
public void setHoldRequest(boolean value, Module origin)
setHoldRequest
in class ModuleCPU
value
- state of the Hold Requestorigin
- -ModuleCPU
public void setIOPortByte(int portAddress, byte value) throws ModuleException
setIOPortByte
in interface Addressable
ModuleException
Addressable
public void setIOPortDoubleWord(int portAddress, byte[] value) throws ModuleException
setIOPortDoubleWord
in interface Addressable
ModuleException
Addressable
public void setIOPortWord(int portAddress, byte[] value) throws ModuleException
setIOPortWord
in interface Addressable
ModuleException
Addressable
public void setIPS(int ips)
setIPS
in class ModuleCPU
ips
- the Instructions Per Second (ips) for this CPU.ModuleCPU
public void setIPS(int ips, int lowestUpdatePeriod)
setIPS
in class ModuleCPU
lowestUpdatePeriod
- the lowest update period in microsecondsModuleCPU
protected boolean setRegisterValue(java.lang.String registerName, byte[] value)
setRegisterValue
in class ModuleCPU
value
- containing the value
ModuleCPU
protected void setRunning(boolean status)
setRunning
in class ModuleCPU
status
- sets the isRunning booleanModuleCPU
public boolean isShutdown()
isShutdown
in class ModuleCPU
ModuleCPU
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |