[Vm-dev] VM Maker: Cog-eem.372.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Nov 26 00:04:01 UTC 2019


Eliot Miranda uploaded a new version of Cog to project VM Maker:
http://source.squeak.org/VMMaker/Cog-eem.372.mcz

==================== Summary ====================

Name: Cog-eem.372
Author: eem
Time: 25 November 2019, 4:03:59.413435 pm
UUID: 648ac787-06aa-4536-8bce-1fff8acb5593
Ancestors: Cog-eem.371

Nuke the obsolete invocation primitives (the ones that took three bounds arguments).
Use the error code on the ARM & ARMv8 aliens.

Avoid several uses of << and >> in performance-critical tests in the GdbARMAlien.  bitShift: saves an invocation.

=============== Diff against Cog-eem.371 ===============

Item was removed:
- ----- Method: BochsIA32Alien>>primitiveRunInMemory:minimumAddress:maximumAddress:readOnlyBelow: (in category 'primitives') -----
- primitiveRunInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" maximumAddress: maximimAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
- 	"Run the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
- 	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
- 	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals."
- 	<primitive: 'primitiveRunInMemoryMinAddressMaxAddressReadWrite' module: 'BochsIA32Plugin' error: ec>
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
- 		ifFalse: [self reportPrimitiveFailure]
- 
- 	"self printRegistersOn: Transcript"!

Item was changed:
  ----- Method: BochsIA32Alien>>primitiveRunInMemory:minimumAddress:readOnlyBelow: (in category 'primitives') -----
  primitiveRunInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
  	"Run the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
  	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
  	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals."
  	<primitive: 'primitiveRunInMemoryMinimumAddressReadWrite' module: 'BochsIA32Plugin' error: ec>
+ 	^(ec isPrimitiveError
+ 	   or: [ec == #'inappropriate operation'])
+ 		ifTrue:
+ 			[self
+ 				handleExecutionPrimitiveFailureIn: memoryArray
+ 				minimumAddress: minimumAddress]
+ 		ifFalse: [self reportPrimitiveFailure]!
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
- 		ifFalse: [self reportPrimitiveFailure]
- 
- 	"self printRegistersOn: Transcript"!

Item was removed:
- ----- Method: BochsIA32Alien>>primitiveSingleStepInMemory:minimumAddress:maximumAddress:readOnlyBelow: (in category 'primitives') -----
- primitiveSingleStepInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" maximumAddress: maximimAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
- 	"Single-step the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
- 	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
- 	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals."
- 	<primitive: 'primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite' module: 'BochsIA32Plugin' error: ec>
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
- 		ifFalse: [self reportPrimitiveFailure]!

Item was changed:
  ----- Method: BochsIA32Alien>>primitiveSingleStepInMemory:minimumAddress:readOnlyBelow: (in category 'primitives') -----
  primitiveSingleStepInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
  	"Single-step the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
  	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
  	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals."
  	<primitive: 'primitiveSingleStepInMemoryMinimumAddressReadWrite' module: 'BochsIA32Plugin' error: ec>
+ 	^(ec isPrimitiveError
+ 	   or: [ec == #'inappropriate operation'])
+ 		ifTrue:
+ 			[self
+ 				handleExecutionPrimitiveFailureIn: memoryArray
+ 				minimumAddress: minimumAddress]
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
  		ifFalse: [self reportPrimitiveFailure]!

Item was changed:
  ----- Method: BochsX64Alien>>primitiveRunInMemory:minimumAddress:readOnlyBelow: (in category 'primitives') -----
  primitiveRunInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
  	"Run the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
  	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
  	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals."
  	<primitive: 'primitiveRunInMemoryMinimumAddressReadWrite' module: 'BochsX64Plugin' error: ec>
+ 	^(ec isPrimitiveError
+ 	   or: [ec == #'inappropriate operation'])
+ 		ifTrue:
+ 			[self
+ 				handleExecutionPrimitiveFailureIn: memoryArray
+ 				minimumAddress: minimumAddress]
+ 		ifFalse: [self reportPrimitiveFailure]!
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
- 		ifFalse: [self reportPrimitiveFailure]
- 
- 	"self printRegistersOn: Transcript"!

Item was changed:
  ----- Method: BochsX64Alien>>primitiveSingleStepInMemory:minimumAddress:readOnlyBelow: (in category 'primitives') -----
  primitiveSingleStepInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
  	"Single-step the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
  	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
  	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals."
  	<primitive: 'primitiveSingleStepInMemoryMinimumAddressReadWrite' module: 'BochsX64Plugin' error: ec>
+ 	^(ec isPrimitiveError
+ 	   or: [ec == #'inappropriate operation'])
+ 		ifTrue:
+ 			[self
+ 				handleExecutionPrimitiveFailureIn: memoryArray
+ 				minimumAddress: minimumAddress]
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
  		ifFalse: [self reportPrimitiveFailure]!

Item was changed:
  ----- Method: GdbARMAlien>>extractOffsetFromBL: (in category 'testing') -----
  extractOffsetFromBL: instr
  "we are told this is a BL <offset> instruction, so work out the offset it encodes"
  	| relativeJump |
  	relativeJump := instr bitAnd: 16r00FFFFFF.
+ 	(relativeJump bitShift: -23) = 0 ifTrue:
+ 		[^relativeJump bitShift: 2].
+ 	^((relativeJump bitOr: 16r3F000000) bitShift: 2) signedIntFromLong!
- 	relativeJump := (relativeJump bitAt: 24) = 1 
- 						ifTrue: [((relativeJump bitOr: 16r3F000000) << 2) signedIntFromLong]
- 						ifFalse: [relativeJump << 2].
- 	^relativeJump!

Item was added:
+ ----- Method: GdbARMAlien>>handleExecutionPrimitiveFailureIn:minimumAddress:code: (in category 'error handling') -----
+ handleExecutionPrimitiveFailureIn: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>"code: errorCode "<Integer>"
+ 	"Handle an execution primitive failure.  Convert out-of-range call and absolute
+ 	 memory read into register instructions into ProcessorSimulationTrap signals."
+ 	"self printRegistersOn: Transcript"
+ 	| pcOnEntry pc instr |
+ 	pc := pcOnEntry := self pc.
+ 	errorCode = InstructionPrefetchError ifTrue:
+ 		[pc := self pc: self priorPc].
+ 
+ 	(pc between: minimumAddress and: memoryArray byteSize - 1) ifTrue:
+ 		[instr := memoryArray unsignedLongAt:  pc + 1 bigEndian: false.
+ 
+ 		 errorCode = InstructionPrefetchError ifTrue:
+ 			[^self handleFailingBranch: instr to: pcOnEntry at: pc].
+ 
+ 		 (self instructionIsAnyLoadStore: instr) ifTrue:
+ 			[^self handleFailingLoadStore: instr at: pc].
+ 
+ 		 (self instructionIsAnyFPArithmetic: instr) ifTrue:
+ 			[^self handleFailingFPArithmetic: instr at: pc].
+ 
+ 		 ^self handleExecutionPrimitiveFailureAt: pc in: memoryArray].
+ 
+ 	^self reportPrimitiveFailure!

Item was changed:
  ----- Method: GdbARMAlien>>handleFailingBranch:to:at: (in category 'error handling') -----
  handleFailingBranch: instr to: address at: pc
  	(self instructionIsBL: instr) ifTrue:
  		[self assert: address = (pc + 8 + (self extractOffsetFromBL: instr)) signedIntToLong.
  		 ^(ProcessorSimulationTrap
  				pc: pc
  				nextpc: pc + 4
  				address: (pc + 8 + (self extractOffsetFromBL: instr)) signedIntToLong
  				type: #call)
  			signal].
  	(self instructionIsBLX: instr) ifTrue:
  		[self assert: address = (self perform: (self registerStateGetters at: (instr bitAnd: 15) + 1)).
  		 ^(ProcessorSimulationTrap
  				pc: pc
  				nextpc: pc + 4
+ 				address: address
- 				address: (self perform: (self registerStateGetters at: (instr bitAnd: 15) + 1))
  				type: #call)
  			signal].
  	(self instructionIsBX: instr) ifTrue:
  		[self assert: address = (self perform: (self registerStateGetters at: (instr bitAnd: 15) + 1)).
  		 ^(ProcessorSimulationTrap
  				pc: pc
  				nextpc: pc + 4
+ 				address: address
- 				address: (self perform: (self registerStateGetters at: (instr bitAnd: 15) + 1))
  				type: #jump)
  			signal].
  	(self instructionIsB: instr) ifTrue:
  		[self assert: address = (pc + 8 + (self extractOffsetFromBL: instr)) signedIntToLong.
  		 ^(ProcessorSimulationTrap
  				pc: pc
  				nextpc: pc + 4
+ 				address: address
- 				address: (pc + 8 + (self extractOffsetFromBL: instr)) signedIntToLong
  				type: #jump)
  			signal].
  	(self instructionIsReturnViaLR: instr) ifTrue:
+ 		[self assert: address = self lr.
+ 		 ^(ProcessorSimulationTrap
- 		[^(ProcessorSimulationTrap
  				pc: pc
  				nextpc: pc + 4
  				address: self lr
  				type: #return)
  			signal].
  	^self reportPrimitiveFailure!

Item was changed:
  ----- Method: GdbARMAlien>>handleFailingLoadStore:at: (in category 'error handling') -----
  handleFailingLoadStore: instr at: pc
  	"See e.g. ARM DDI0406A pp. A8-120, 124, 128, 132, 152, 156, etc. etc"
+ 	| baseReg regIdx destReg srcReg offset |
- 	| baseReg destReg srcReg offset |
  
  	"find the register used as the base of the address and the register to load into or store from"
+ 	baseReg := self registerStateGetters at: ((instr bitShift: -16) bitAnd: 15) + 1.
+ 	srcReg :=  self registerStateGetters at: (regIdx := ((instr bitShift: -12) bitAnd: 15) + 1).
+ 	destReg := self registerStateSetters at: regIdx.
- 	baseReg := self registerStateGetters at: (instr >> 16 bitAnd: 15)+ 1.
- 	srcReg :=  self registerStateGetters at: (instr >> 12 bitAnd: 15)+ 1.
- 	destReg := self registerStateSetters at: (instr >> 12 bitAnd: 15) + 1.
  
  	"work out the relevant offset, whether an immediate or register value"
  	offset := self extractOffsetFromLoadStore: instr.
  	
  	(self instructionIsLDR: instr) ifTrue:
  		[^(ProcessorSimulationTrap
  				pc: pc
  				nextpc: pc + 4 
  				address: (self perform: baseReg) + offset
  				type: #read
  				accessor: destReg)
  			signal].
+ 	(self instructionIsSTR: instr) ifTrue:
- 	(self instructionIsLDRB: instr) ifTrue:
  		[^(ProcessorSimulationTrap
  				pc: pc
  				nextpc: pc + 4 
  				address: (self perform: baseReg) + offset
+ 				type: #write
+ 				accessor: srcReg)
- 				type: #read
- 				accessor: destReg)
  			signal].
+ 	(self instructionIsLDRB: instr) ifTrue:
- 	(self instructionIsLDRH: instr) ifTrue:
  		[^(ProcessorSimulationTrap
  				pc: pc
  				nextpc: pc + 4 
  				address: (self perform: baseReg) + offset
  				type: #read
  				accessor: destReg)
  			signal].
+ 	(self instructionIsSTRB: instr) ifTrue:
- 	(self instructionIsSTR: instr) ifTrue:
  		[^(ProcessorSimulationTrap
  				pc: pc
  				nextpc: pc + 4 
  				address: (self perform: baseReg) + offset
  				type: #write
  				accessor: srcReg)
  			signal].
+ 	(self instructionIsLDRH: instr) ifTrue:
- 	(self instructionIsSTRB: instr) ifTrue:
  		[^(ProcessorSimulationTrap
  				pc: pc
  				nextpc: pc + 4 
  				address: (self perform: baseReg) + offset
+ 				type: #read
+ 				accessor: destReg)
- 				type: #write
- 				accessor: srcReg)
  			signal].
  	(self instructionIsSTRH: instr) ifTrue:
  		[^(ProcessorSimulationTrap
  				pc: pc
  				nextpc: pc + 4 
  				address: (self perform: baseReg) + offset
  				type: #write
  				accessor: srcReg)
  			signal].
  
  	self error: 'handleFailingLoadStore:at: invoked for non-load/store?'!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsAddSP: (in category 'testing') -----
  instructionIsAddSP: instr
+ 	"is this an add sp, sp, #? -  instruction?"
+ 	^(instr bitShift: -28) < 16rF "test for allowed condcode - 0xF is extension"
+ 	  and: [(instr bitAnd: 16rFFFFF00) = 16r28DD000]!
- "is this an add sp, sp, #? -  instruction?"
- 	^instr >> 28 < 16rF "test for allowed condcode - 0xF is extension" and: [(instr bitAnd: (16rFFFFF00)) = (16r28DD000)]!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsAlignSP: (in category 'testing') -----
  instructionIsAlignSP: instr
  "is this a subs sp, sp, #4 -  instruction?"
+ 	^(instr bitShift: -28) < 16rF "test for allowed condcode - 0xF is extension"
+ 	  and: [(instr bitAnd: 16rFFFFFFF) = 16r2DDD004]!
- 	^instr >> 28 < 16rF "test for allowed condcode - 0xF is extension" and: [(instr bitAnd: (16rFFFFFFF)) = (16r2DDD004)]!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsAnyFPArithmetic: (in category 'testing') -----
  instructionIsAnyFPArithmetic: instr
  	"Identify VFP instructions.
  	 See C3.1 - C3.4 in the ARM ARM v5 DDI01001."
  	| cp isFP |
  	
  	"All FP instructions are coprocessor instructions on coproc 10 or 11"
+ 	cp := (instr bitShift: -8) bitAnd: 16rF.
- 	cp := instr>>8 bitAnd: 16rF.
  	isFP := cp = 10 or:[cp = 11].
+ 	(isFP and: [((instr bitShift: -25) bitAnd: 7) = 6]) ifTrue: [^true].
+ 	(isFP and: [((instr bitShift: -24) bitAnd: 16rF) = 16rE]) ifTrue: [^true].
- 	(isFP and: [(instr>>25 bitAnd: 7) = 6]) ifTrue: [^true].
- 	(isFP and: [(instr>>24 bitAnd: 16rF) = 16rE]) ifTrue: [^true].
  	
  	"nope"
  	^false!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsB: (in category 'testing') -----
  instructionIsB: instr
  "is this a B <offset> instruction?"
  	"first test for non-NV condition code; some important instructions use it"
+ 	^(instr bitShift: -28) < 16rF
- 	instr >> 28 = 16rF ifTrue:[^false].
  	"See ARM DDI0406A p. A8-44"
+ 	 and: [(instr bitShift: -24) bitAnd: 16rF = 16rA]!
- 	^ (instr bitAnd: (16rF<<24)) = (16rA<<24)!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsBL: (in category 'testing') -----
  instructionIsBL: instr
  "is this a BL <offset> instruction?"
  	"first test for non-NV condition code; some important instructions use it"
+ 	^(instr bitShift: -28) < 16rF
- 	instr >> 28 = 16rF ifTrue:[^false].
  	"see ARM DDI0406A p. A8-58"
+ 	  and: [((instr bitShift: -24) bitAnd: 16rF) = 16rB]!
- 	^(instr bitAnd: (16rF<<24)) = (16rB<<24)!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsBLX: (in category 'testing') -----
  instructionIsBLX: instr
  "is this a BLX <targetReg> instruction? We DO NOT support the BLX immed version"
  	"first test for non-NV condition code; some important instructions use it"
+ 	(instr bitShift: -28) = 16rF ifTrue:[^false].
- 	instr >> 28 = 16rF ifTrue:[^false].
  	"See ARM DDI0406A p A8-60"
   	^(instr bitAnd: 16r0FFFFFF0) = 16r12FFF30!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsBX: (in category 'testing') -----
  instructionIsBX: instr
  "is this a BX <targetReg> instruction?"
  	"first test for non-NV condition code; some important instructions use it"
+ 	(instr bitShift: -28) = 16rF ifTrue:[^false].
- 	instr >> 28 = 16rF ifTrue:[^false].
  	"See ARM DDI0406A p. A8-62"
   	^(instr bitAnd: 16r0FFFFFF0) = 16r12FFF10!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsImmediateOffsetLoadStore: (in category 'testing') -----
  instructionIsImmediateOffsetLoadStore: instr
  	"is this any of the immediate offset LDR,STR instructions?"
  	| op1 |
  	"first test for non-NV condition code; some important instructions use it"
+ 	(instr bitShift: -28) = 16rF ifTrue:[^false].
- 	instr >> 28 = 16rF ifTrue:[^false].
  	"test for 010 group of load/stores"
+ 	op1 := (instr bitShift: -25) bitAnd: 7.
- 	op1 := instr >>25 bitAnd: 7.
  	op1 = 2 ifTrue:[^true].
  
  	"test for the ridiculously muddled 000 group"
  	op1 > 0 ifTrue:[^false].
  	"bit 21 must not be 1 and bit 22 must be 1"
+ 	((instr bitShift: -21) bitAnd: 3) = 2 ifFalse:[^false].
- 	(instr bitAnd: 3 <<21) = (2<<21) ifFalse:[^false].
  	"bits 4:7need to be 16rB for our purpose"
+ 	^(instr bitAnd: 16rF0) = 16rB0!
- 	^(instr bitAnd: 16rF0) = 16rB0
- 	
- 	!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsLDR: (in category 'testing') -----
  instructionIsLDR: instr
  "is this a LDR instruction?"
  	| foo |
  	"first test for non-NV condition code; some important instructions use it"
+ 	(instr bitShift: -28) = 16rF ifTrue:[^false].
- 	instr >> 28 = 16rF ifTrue:[^false].
  	"See ARM DDI0406A p. A8-120"
+ 	foo := (instr bitShift: -20) bitAnd: 16rE5.
- 	foo := (instr >> 20 bitAnd: 16rE5).
  	^foo = 16r41 "ldr r1, [r2, #+/-imm]"
  		or:[foo = 16r61 "ldr r1, [r2, r3]"]!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsLDRB: (in category 'testing') -----
  instructionIsLDRB: instr
  "is this a LDRB instruction?"
  	| foo |
  	"first test for non-NV condition code; some important instructions use it"
+ 	(instr bitShift: -28) = 16rF ifTrue:[^false].
- 	instr >> 28 = 16rF ifTrue:[^false].
  	"See ARM DDI0406A p. A8-128"
+ 	foo := (instr bitShift: -20) bitAnd: 16rE5.
- 	foo := (instr >> 20 bitAnd: 16rE5).
  	^foo = 16r45 "ldrb r1, [r2, #+/-imm]"
  		or:[foo = 16r65 "ldrb r1, [r2, r3]"]!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsLDRH: (in category 'testing') -----
  instructionIsLDRH: instr
  "is this a LDRH instruction?"
  	| foo |
  	"first test for non-NV condition code; some important instructions use it"
+ 	(instr bitShift: -28) = 16rF ifTrue:[^false].
- 	instr >> 28 = 16rF ifTrue:[^false].
  	"See ARM DDI0406A p. A8-154"
  	(instr bitAnd: 16rF0) = 16rB0 ifFalse:[^false].
+ 	foo := (instr bitShift: -20) bitAnd: 16rE3.
- 	foo := (instr >> 20 bitAnd: 16rE3).
  	^foo = 16r3 "ldrh r1, [r2, #+/-imm]"
  		or:[foo = 16r1 "ldrh r1, [r2, r3]"]!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsLDRSP: (in category 'testing') -----
  instructionIsLDRSP: instr
  "is this a LDR sp, [??] instruction? Special case to detect LDR sp, [] affecting stack pointer"
+ 	^(self instructionIsLDR: instr)  and:[((instr bitShift: -12) bitAnd: 16rF) = 13]!
- 	^(self instructionIsLDR: instr)  and:[(instr >>12 bitAnd: 16rF) = 13]!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsPop: (in category 'testing') -----
  instructionIsPop: instr
  "is this a pop - ldr r??, [sp], #4 -  instruction?"
+ 	^(instr bitShift: -28) < 16rF "test for allowed condcode - 0xF is extension" and: [(instr bitAnd: (16rFFF0FFF)) = (16r49D0004)]!
- 	^instr >> 28 < 16rF "test for allowed condcode - 0xF is extension" and: [(instr bitAnd: (16rFFF0FFF)) = (16r49D0004)]!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsPush: (in category 'testing') -----
  instructionIsPush: instr
  "is this a push -str r??, [sp, #-4] -  instruction?"
+ 	^(instr bitShift: -28) < 16rF "test for allowed condcode - 0xF is extension" and: [(instr bitAnd: (16rFFF0FFF)) = (16r52D0004)]!
- 	^instr >> 28 < 16rF "test for allowed condcode - 0xF is extension" and: [(instr bitAnd: (16rFFF0FFF)) = (16r52D0004)]!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsRegisterOffsetLoadStore: (in category 'testing') -----
  instructionIsRegisterOffsetLoadStore: instr
  	"is this any of the register offset LDR,STR instructions?"
  	| op1 |
  	"first test for non-NV condition code; some important instructions use it"
+ 	(instr bitShift: -28) = 16rF ifTrue:[^false].
- 	instr >> 28 = 16rF ifTrue:[^false].
  	
+ 	op1 := (instr bitShift: -25) bitAnd: 7.
- 	op1 := instr >>25 bitAnd: 7.
  	"test for the 011 group - check bit 4 as well"
  	(op1 = 3 and:[(instr bitAnd: 16r10) = 0]) ifTrue:[^true].
  	"test for the ridiculously muddled 000 group"
  	op1 > 0 ifTrue:[^false].
  	"bit 21 & 22 must not be 1"
+ 	((instr bitShift: -21) bitAnd: 3) = 0 ifFalse:[^false].
- 	(instr bitAnd: 3 <<21) = 0 ifFalse:[^false].
  	"bits 4:7need to be 16rB for our purpose"
+ 	^(instr bitAnd: 16rF0) = 16rB0!
- 	^(instr bitAnd: 16rF0) = 16rB0
- 	
- 	!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsSTR: (in category 'testing') -----
  instructionIsSTR: instr
  "is this a STR instruction?"
  	| foo |
  	"first test for non-NV condition code; some important instructions use it"
+ 	(instr bitShift: -28) = 16rF ifTrue:[^false].
- 	instr >> 28 = 16rF ifTrue:[^false].
  	"See ARM DDI0406A p. A8-382"
+  	foo := (instr bitShift: -20) bitAnd: 16rE5. 
-  	foo := (instr >> 20 bitAnd: 16rE5). 
  	^foo = 16r40 "str r1, [r2, #+/-imm]" 
  		or:[foo = 16r60] "str r1, [r2, #-imm]"!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsSTRB: (in category 'testing') -----
  instructionIsSTRB: instr
  "is this a STRB instruction?"
  	| foo |
  	"first test for non-NV condition code; some important instructions use it"
+ 	(instr bitShift: -28) = 16rF ifTrue:[^false].
- 	instr >> 28 = 16rF ifTrue:[^false].
  	"See ARM DDI0406A p. A8-388"
+  	foo := (instr bitShift: -20) bitAnd: 16rE5. 
-  	foo := (instr >> 20 bitAnd: 16rE5). 
  	^foo = 16r44 "strb r1, [r2, #+/-imm]" 
  		or:[foo = 16r64] "strb r1, [r2, #-imm]"!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsSTRH: (in category 'testing') -----
  instructionIsSTRH: instr
  "is this a STRH instruction?"
  	| foo |
  	"first test for non-NV condition code; some important instructions use it"
+ 	(instr bitShift: -28) = 16rF ifTrue:[^false].
- 	instr >> 28 = 16rF ifTrue:[^false].
  	"See ARM DDI0406A p. A8-154"
  	(instr bitAnd: 16rF0) = 16rB0 ifFalse:[^false].
+ 	foo := (instr bitShift: -20) bitAnd: 16rE3.
- 	foo := (instr >> 20 bitAnd: 16rE3).
  	^foo = 16r4 "strh r1, [r2, #+/-imm]"
  		or:[foo = 16r0 "strh r1, [r2, r3]"]!

Item was changed:
  ----- Method: GdbARMAlien>>instructionIsSTRSP: (in category 'testing') -----
  instructionIsSTRSP: instr
  "is this a STR sp, [??] instruction? Special case to detect STR sp, [] affecting stack pointer"
+ 	^(self instructionIsSTR: instr)  and:[((instr bitShift: -12) bitAnd: 16rF) = 13]!
- 	^(self instructionIsSTR: instr)  and:[(instr >>12 bitAnd: 16rF) = 13]!

Item was removed:
- ----- Method: GdbARMAlien>>primitiveRunInMemory:minimumAddress:maximumAddress:readOnlyBelow: (in category 'primitives') -----
- primitiveRunInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" maximumAddress: maximimAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
- 	"Run the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
- 	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
- 	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals."
- 	<primitive: 'primitiveRunInMemoryMinAddressMaxAddressReadWrite' module: 'GdbARMPlugin' error: ec>
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
- 		ifFalse: [self reportPrimitiveFailure]
- 
- 	"self printRegistersOn: Transcript"!

Item was changed:
  ----- Method: GdbARMAlien>>primitiveRunInMemory:minimumAddress:readOnlyBelow: (in category 'primitives') -----
  primitiveRunInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
  	"Run the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
  	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
  	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals.
  	Note that minWriteMaxExecAddress is both the minimum writeable address AND the maximum executable address"
  	<primitive: 'primitiveRunInMemoryMinimumAddressReadWrite' module: 'GdbARMPlugin' error: ec>
+ 	^ec isPrimitiveError
+ 		ifTrue:
+ 			[self handleExecutionPrimitiveFailureIn: memoryArray
+ 				minimumAddress: minimumAddress
+ 				code: ec errorCode]
+ 		ifFalse:
+ 			[ec == #'inappropriate operation'
+ 				ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
+ 							minimumAddress: minimumAddress]
+ 				ifFalse: [self reportPrimitiveFailure]]!
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
- 		ifFalse: [self reportPrimitiveFailure]
- 
- 	"self printRegistersOn: Transcript"!

Item was removed:
- ----- Method: GdbARMAlien>>primitiveSingleStepInMemory:minimumAddress:maximumAddress:readOnlyBelow: (in category 'primitives') -----
- primitiveSingleStepInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" maximumAddress: maximimAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
- 	"Single-step the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
- 	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
- 	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals."
- 	<primitive: 'primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite' module: 'GdbARMPlugin' error: ec>
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
- 		ifFalse: [self reportPrimitiveFailure]!

Item was changed:
  ----- Method: GdbARMAlien>>primitiveSingleStepInMemory:minimumAddress:readOnlyBelow: (in category 'primitives') -----
  primitiveSingleStepInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
  	"Single-step the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
  	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
  	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals."
  	<primitive: 'primitiveSingleStepInMemoryMinimumAddressReadWrite' module: 'GdbARMPlugin' error: ec>
+ 	^ec isPrimitiveError
+ 		ifTrue:
+ 			[self handleExecutionPrimitiveFailureIn: memoryArray
+ 				minimumAddress: minimumAddress
+ 				code: ec errorCode]
+ 		ifFalse:
+ 			[ec == #'inappropriate operation'
+ 				ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
+ 							minimumAddress: minimumAddress]
+ 				ifFalse: [self reportPrimitiveFailure]]!
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
- 		ifFalse: [self reportPrimitiveFailure]!

Item was removed:
- ----- Method: GdbARMv8Alien>>primitiveRunInMemory:minimumAddress:maximumAddress:readOnlyBelow: (in category 'primitives') -----
- primitiveRunInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" maximumAddress: maximimAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
- 	"Run the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
- 	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
- 	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals."
- 	<primitive: 'primitiveRunInMemoryMinAddressMaxAddressReadWrite' module: 'GdbARMv8Plugin' error: ec>
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
- 		ifFalse: [self reportPrimitiveFailure]
- 
- 	"self printRegistersOn: Transcript"!

Item was changed:
  ----- Method: GdbARMv8Alien>>primitiveRunInMemory:minimumAddress:readOnlyBelow: (in category 'primitives') -----
  primitiveRunInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
  	"Run the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
  	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
  	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals.
  	Note that minWriteMaxExecAddress is both the minimum writeable address AND the maximum executable address"
  	<primitive: 'primitiveRunInMemoryMinimumAddressReadWrite' module: 'GdbARMv8Plugin' error: ec>
  	^ec isPrimitiveError
  		ifTrue:
  			[self handleExecutionPrimitiveFailureIn: memoryArray
  				minimumAddress: minimumAddress
  				code: ec errorCode]
  		ifFalse:
  			[ec == #'inappropriate operation'
  				ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
  							minimumAddress: minimumAddress]
+ 				ifFalse: [self reportPrimitiveFailure]]!
- 				ifFalse: [self reportPrimitiveFailure]]
- 
- 	"self printRegistersOn: Transcript"!

Item was removed:
- ----- Method: GdbARMv8Alien>>primitiveSingleStepInMemory:minimumAddress:maximumAddress:readOnlyBelow: (in category 'primitives') -----
- primitiveSingleStepInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" maximumAddress: maximimAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
- 	"Single-step the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
- 	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
- 	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals."
- 	<primitive: 'primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite' module: 'GdbARMv8Plugin' error: ec>
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
- 		ifFalse: [self reportPrimitiveFailure]!

Item was changed:
  ----- Method: GdbARMv8Alien>>primitiveSingleStepInMemory:minimumAddress:readOnlyBelow: (in category 'primitives') -----
  primitiveSingleStepInMemory: memoryArray "<Bitmap|ByteArray>" minimumAddress: minimumAddress "<Integer>" readOnlyBelow: minimumWritableAddress "<Integer>"
  	"Single-step the receiver using the argument as the store.  Origin the argument at 0. i.e. the first byte of the
  	 memoryArray is address 0.  Make addresses below minimumAddress illegal.  Convert out-of-range
  	 calls, jumps and memory read/writes into ProcessorSimulationTrap signals."
  	<primitive: 'primitiveSingleStepInMemoryMinimumAddressReadWrite' module: 'GdbARMv8Plugin' error: ec>
+ 	^ec isPrimitiveError
+ 		ifTrue:
+ 			[self handleExecutionPrimitiveFailureIn: memoryArray
+ 				minimumAddress: minimumAddress
+ 				code: ec errorCode]
+ 		ifFalse:
+ 			[ec == #'inappropriate operation'
+ 				ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
+ 							minimumAddress: minimumAddress]
+ 				ifFalse: [self reportPrimitiveFailure]]!
- 	^ec == #'inappropriate operation'
- 		ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
- 					minimumAddress: minimumAddress]
- 		ifFalse: [self reportPrimitiveFailure]!



More information about the Vm-dev mailing list