[Vm-dev] VM Maker: Cog-eem.292.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Nov 3 21:34:58 UTC 2015
Eliot Miranda uploaded a new version of Cog to project VM Maker:
http://source.squeak.org/VMMaker/Cog-eem.292.mcz
==================== Summary ====================
Name: Cog-eem.292
Author: eem
Time: 3 November 2015, 1:34:42.692 pm
UUID: 9ba69574-d95d-471c-a6c1-6ff3e63c5153
Ancestors: Cog-eem.291
Add failure mode handling for the IA32 and X64 processor aliens to support oveAbR and MoveRAb. Fix a slip with the IA32 Alien which used the wrong method to fix ALOb/ObAL failures and the wrong opcodes for moveALOb/ObAL.
=============== Diff against Cog-eem.291 ===============
Item was changed:
----- Method: BochsIA32Alien class>>initialize (in category 'class initialization') -----
initialize
"BochsIA32Alien initialize"
| it |
it := self basicNew.
PostBuildStackDelta := 0.
OpcodeExceptionMap := Array new: 256 withAll: #handleExecutionPrimitiveFailureAt:in:.
OpcodeExceptionMap
at: 1 + it callOpcode put: #handleCallFailureAt:in:;
at: 1 + it jmpOpcode put: #handleJmpFailureAt:in:;
at: 1 + it retOpcode put: #handleRetFailureAt:in:;
at: 1 + it movALObOpcode put: #handleMovALObFailureAt:in:;
+ at: 1 + it movAXOvOpcode put: #handleMovAXOvFailureAt:in:;
at: 1 + it movObALOpcode put: #handleMovObALFailureAt:in:;
+ at: 1 + it movOvAXOpcode put: #handleMovOvAXFailureAt:in:;
at: 1 + it movGvEvOpcode put: #handleMovGvEvFailureAt:in:;
at: 1 + it movEvGvOpcode put: #handleMovEvGvFailureAt:in:;
at: 1 + it movGbEbOpcode put: #handleMovGbEbFailureAt:in:;
at: 1 + it movEbGbOpcode put: #handleMovEbGbFailureAt:in:.
ExtendedOpcodeExceptionMap := Array new: 256 withAll: #handleExecutionPrimitiveFailureAt:in:.
ExtendedOpcodeExceptionMap
at: 1 + it movGvEbOpcode put: #handleMovGvEbFailureAt:in:!
Item was changed:
----- Method: BochsIA32Alien>>handleMovALObFailureAt:in: (in category 'error handling') -----
handleMovALObFailureAt: pc "<Integer>" in: memoryArray "<Bitmap|ByteArray>"
+ "Convert an execution primitive failure for a read into al into a ProcessorSimulationTrap signal."
- "Convert an execution primitive failure for a read into eax into a ProcessorSimulationTrap signal."
^(ProcessorSimulationTrap
pc: pc
nextpc: pc + 5
address: (memoryArray unsignedLongAt: pc + 2 bigEndian: false)
type: #read
+ accessor: #al:)
- accessor: #eax:)
signal!
Item was added:
+ ----- Method: BochsIA32Alien>>handleMovAXOvFailureAt:in: (in category 'error handling') -----
+ handleMovAXOvFailureAt: pc "<Integer>" in: memoryArray "<Bitmap|ByteArray>"
+ "Convert an execution primitive failure for a read into eax into a ProcessorSimulationTrap signal."
+ ^(ProcessorSimulationTrap
+ pc: pc
+ nextpc: pc + 5
+ address: (memoryArray unsignedLongAt: pc + 2 bigEndian: false)
+ type: #read
+ accessor: #eax:)
+ signal!
Item was changed:
----- Method: BochsIA32Alien>>handleMovEbGbFailureAt:in: (in category 'error handling') -----
handleMovEbGbFailureAt: pc "<Integer>" in: memoryArray "<Bitmap|ByteArray>"
"Convert an execution primitive failure for a byte register write into a ProcessorSimulationTrap signal."
+ | modrmByte address |
+ modrmByte := memoryArray byteAt: pc + 2.
+ (modrmByte bitAnd: 7) ~= 4 ifTrue: "MoveRMbr with r = ESP requires an SIB byte"
+ [address := (modrmByte bitAnd: 16rC0)
+ caseOf: {
+ [0 "ModRegInd"]
+ -> [memoryArray unsignedLongAt: pc + 3 bigEndian: false].
+ [16r80 "ModRegRegDisp32"]
+ -> [(self perform: (#(eax ecx edx ebx esp ebp esi edi) at: (modrmByte bitAnd: 7) + 1))
+ + (memoryArray unsignedLongAt: pc + 3 bigEndian: false)
+ bitAnd: 16rFFFFFFFF] }
+ otherwise: [^self reportPrimitiveFailure].
+ ^(ProcessorSimulationTrap
+ pc: pc
+ nextpc: pc + 6
+ address: address
+ type: #write
+ accessor: (#(al cl dl bl ah ch dh bh) at: ((modrmByte >> 3 bitAnd: 7) + 1)))
+ signal].
+ ^self reportPrimitiveFailure!
- | modrmByte |
- ^(((modrmByte := memoryArray byteAt: pc + 2) bitAnd: 16rC0) = 16r80) "ModRegRegDisp32"
- ifTrue:
- [(ProcessorSimulationTrap
- pc: pc
- nextpc: pc + 6
- address: ((self perform: (#(eax ecx edx ebx esp ebp esi edi) at: (modrmByte bitAnd: 7) + 1))
- + (memoryArray unsignedLongAt: pc + 3 bigEndian: false)
- bitAnd: 16rFFFFFFFF)
- type: #write
- accessor: (#(al cl dl bl ah ch dh bh) at: ((modrmByte >> 3 bitAnd: 7) + 1)))
- signal]
- ifFalse:
- [self reportPrimitiveFailure]!
Item was changed:
----- Method: BochsIA32Alien>>handleMovGbEbFailureAt:in: (in category 'error handling') -----
handleMovGbEbFailureAt: pc "<Integer>" in: memoryArray "<Bitmap|ByteArray>"
"Convert an execution primitive failure for a byte register load into a ProcessorSimulationTrap signal."
+ | modrmByte address |
+ modrmByte := memoryArray byteAt: pc + 2.
+ address := (modrmByte bitAnd: 16rC0)
+ caseOf: {
+ [0 "ModRegInd"]
+ -> [memoryArray unsignedLongAt: pc + 3 bigEndian: false].
+ [16r80 "ModRegRegDisp32"]
+ -> [(self perform: (#(eax ecx edx ebx esp ebp esi edi) at: (modrmByte bitAnd: 7) + 1))
+ + (memoryArray unsignedLongAt: pc + 3 bigEndian: false)
+ bitAnd: 16rFFFFFFFF] }
+ otherwise: [^self reportPrimitiveFailure].
+ ^(ProcessorSimulationTrap
+ pc: pc
+ nextpc: pc + 6
+ address: address
+ type: #read
+ accessor: (#(al: cl: dl: bl: ah: ch: dh: bh:) at: ((modrmByte >> 3 bitAnd: 7) + 1)))
+ signal!
- | modrmByte |
- ^(((modrmByte := memoryArray byteAt: pc + 2) bitAnd: 16rC0) = 16r80) "ModRegRegDisp32"
- ifTrue:
- [(ProcessorSimulationTrap
- pc: pc
- nextpc: pc + 6
- address: ((self perform: (#(eax ecx edx ebx esp ebp esi edi) at: (modrmByte bitAnd: 7) + 1))
- + (memoryArray unsignedLongAt: pc + 3 bigEndian: false)
- bitAnd: 16rFFFFFFFF)
- type: #read
- accessor: (#(al: cl: dl: bl: ah: ch: dh: bh:) at: ((modrmByte >> 3 bitAnd: 7) + 1)))
- signal]
- ifFalse:
- [self reportPrimitiveFailure]!
Item was changed:
----- Method: BochsIA32Alien>>handleMovGvEbFailureAt:in: (in category 'error handling') -----
handleMovGvEbFailureAt: pc "<Integer>" in: memoryArray "<Bitmap|ByteArray>"
"Convert an execution primitive failure for a register load into a ProcessorSimulationTrap signal."
| modrmByte mode srcIsSP srcVal dst offset |
modrmByte := memoryArray byteAt: pc + 3.
mode := modrmByte >> 6 bitAnd: 3.
+ dst := #(eax: ecx: edx: ebx: esp: ebp: esi: edi:) at: ((modrmByte >> 3 bitAnd: 7) + 1).
+ mode = 0 ifTrue: "ModRegInd"
+ [offset := memoryArray unsignedLongAt: pc + 4. "1-relative"
+ ^(ProcessorSimulationTrap
+ pc: pc
+ nextpc: pc + 7
+ address: offset
+ type: #read
+ accessor: dst)
+ signal].
srcIsSP := (modrmByte bitAnd: 7) = 4.
srcVal := self perform: (#(eax ecx edx ebx esp ebp esi edi) at: (modrmByte bitAnd: 7) + 1).
- dst := #(eax: ecx: edx: ebx: esp: ebp: esi: edi:) at: ((modrmByte >> 3 bitAnd: 7) + 1).
mode = 1 ifTrue: "ModRegRegDisp8"
[offset := memoryArray byteAt: pc + (srcIsSP ifTrue: [5] ifFalse: [4]). "1-relative"
offset > 127 ifTrue: [offset := offset - 256].
^(ProcessorSimulationTrap
pc: pc
nextpc: pc + (srcIsSP ifTrue: [5] ifFalse: [4])
+ address: (srcVal + offset bitAnd: 16rFFFFFFFF)
- address: ((srcVal + offset) bitAnd: 16rFFFFFFFF)
type: #read
accessor: dst)
signal].
mode = 2 ifTrue: "ModRegRegDisp32"
[offset := memoryArray unsignedLongAt: pc + (srcIsSP ifTrue: [5] ifFalse: [4]). "1-relative"
^(ProcessorSimulationTrap
pc: pc
nextpc: pc + (srcIsSP ifTrue: [8] ifFalse: [7])
+ address: (srcVal + offset bitAnd: 16rFFFFFFFF)
- address: ((srcVal + offset) bitAnd: 16rFFFFFFFF)
type: #read
accessor: dst)
signal].
^self reportPrimitiveFailure!
Item was changed:
----- Method: BochsIA32Alien>>handleMovObALFailureAt:in: (in category 'error handling') -----
handleMovObALFailureAt: pc "<Integer>" in: memoryArray "<Bitmap|ByteArray>"
+ "Convert an execution primitive failure for a byte write of al into a ProcessorSimulationTrap signal."
- "Convert an execution primitive failure for a write of eax into a ProcessorSimulationTrap signal."
^(ProcessorSimulationTrap
pc: pc
nextpc: pc + 5
address: (memoryArray unsignedLongAt: pc + 2 bigEndian: false)
type: #write
+ accessor: #al)
- accessor: #eax)
signal!
Item was added:
+ ----- Method: BochsIA32Alien>>handleMovOvAXFailureAt:in: (in category 'error handling') -----
+ handleMovOvAXFailureAt: pc "<Integer>" in: memoryArray "<Bitmap|ByteArray>"
+ "Convert an execution primitive failure for a write of eax into a ProcessorSimulationTrap signal."
+ ^(ProcessorSimulationTrap
+ pc: pc
+ nextpc: pc + 5
+ address: (memoryArray unsignedLongAt: pc + 2 bigEndian: false)
+ type: #write
+ accessor: #eax)
+ signal!
Item was changed:
----- Method: BochsIA32Alien>>movALObOpcode (in category 'opcodes') -----
movALObOpcode
"[1] IA-32 Intel® Architecture Software Developer's Manual Volume 2B: Instruction Set Reference, N-Z.
table A2, pA7"
+ ^16rA0!
- ^16rA1!
Item was added:
+ ----- Method: BochsIA32Alien>>movAXOvOpcode (in category 'opcodes') -----
+ movAXOvOpcode
+ "[1] IA-32 Intel® Architecture Software Developer's Manual Volume 2B: Instruction Set Reference, N-Z.
+ table A2, pA7"
+ ^16rA1!
Item was changed:
----- Method: BochsIA32Alien>>movObALOpcode (in category 'opcodes') -----
movObALOpcode
"[1] IA-32 Intel® Architecture Software Developer's Manual Volume 2B: Instruction Set Reference, N-Z.
table A2, pA7"
+ ^16rA2!
- ^16rA3!
Item was added:
+ ----- Method: BochsIA32Alien>>movOvAXOpcode (in category 'opcodes') -----
+ movOvAXOpcode
+ "[1] IA-32 Intel® Architecture Software Developer's Manual Volume 2B: Instruction Set Reference, N-Z.
+ table A2, pA7"
+ ^16rA3!
More information about the Vm-dev
mailing list