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

commits at source.squeak.org commits at source.squeak.org
Thu Oct 29 00:00:44 UTC 2020


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

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

Name: Cog-eem.419
Author: eem
Time: 28 October 2020, 5:00:42.614467 pm
UUID: 82e5725f-bce2-42a6-a9e0-2c048b5553cb
Ancestors: Cog-eem.418

Add the simulating-the-simulator primitives for the processor aliens.  Use these to simulate runCPU:In:Size:MinAddressRead:Write: & singleStepCPU:In:Size:MinAddressRead:Write:.
Fix my misunderstanding of the use of Context>>cut: in MultiProcessor>>saveStackFor:above:homeContext: and consequently the COGMTVM happily simulates more than 1k methods into simulating-the-simulator before an assertt-fail.  COGMTVM is officially undead ;-)

=============== Diff against Cog-eem.418 ===============

Item was added:
+ ----- Method: BochsIA32Alien>>rawPrimitiveRunInMemory:offsetBy:minimumAddress:readOnlyBelow: (in category 'primitives-simulation') -----
+ rawPrimitiveRunInMemory: memoryArray offsetBy: offset minimumAddress: minimumAddress readOnlyBelow: minimumWritableAddress
+ 	"A version of primitiveRunInMemory:offsetBy:minimumAddress:readOnlyBelow: for simulation"
+ 	<primitive: 'primitiveRunInMemoryOffsetMinimumAddressReadWrite' module: 'BochsIA32Plugin' error: ec>
+ 	^ec!

Item was added:
+ ----- Method: BochsIA32Alien>>rawPrimitiveSingleStepInMemory:offsetBy:minimumAddress:readOnlyBelow: (in category 'primitives-simulation') -----
+ rawPrimitiveSingleStepInMemory: memoryArray offsetBy: offset minimumAddress: minimumAddress readOnlyBelow: minimumWritableAddress
+ 	"A version of primitiveSingleStepInMemory:offsetBy:minimumAddress:readOnlyBelow: for simulation"
+ 	<primitive: 'primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite' module: 'BochsIA32Plugin' error: ec>
+ 	^ec!

Item was added:
+ ----- Method: BochsX64Alien>>rawPrimitiveRunInMemory:offsetBy:minimumAddress:readOnlyBelow: (in category 'primitives-simulation') -----
+ rawPrimitiveRunInMemory: memoryArray offsetBy: offset minimumAddress: minimumAddress readOnlyBelow: minimumWritableAddress
+ 	"A version of primitiveRunInMemory:offsetBy:minimumAddress:readOnlyBelow: for simulation"
+ 	<primitive: 'primitiveRunInMemoryOffsetMinimumAddressReadWrite' module: 'BochsX64Plugin' error: ec>
+ 	^ec!

Item was added:
+ ----- Method: BochsX64Alien>>rawPrimitiveSingleStepInMemory:offsetBy:minimumAddress:readOnlyBelow: (in category 'primitives-simulation') -----
+ rawPrimitiveSingleStepInMemory: memoryArray offsetBy: offset minimumAddress: minimumAddress readOnlyBelow: minimumWritableAddress
+ 	"A version of primitiveSingleStepInMemory:offsetBy:minimumAddress:readOnlyBelow: for simulation"
+ 	<primitive: 'primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite' module: 'BochsX64Plugin' error: ec>
+ 	^ec!

Item was added:
+ ----- Method: GdbARMAlien>>rawPrimitiveRunInMemory:offsetBy:minimumAddress:readOnlyBelow: (in category 'primitives-simulation') -----
+ rawPrimitiveRunInMemory: memoryArray offsetBy: offset minimumAddress: minimumAddress readOnlyBelow: minimumWritableAddress
+ 	"A version of primitiveRunInMemory:offsetBy:minimumAddress:readOnlyBelow: for simulation"
+ 	<primitive: 'primitiveRunInMemoryOffsetMinimumAddressReadWrite' module: 'GdbARMPlugin' error: ec>
+ 	^ec!

Item was added:
+ ----- Method: GdbARMAlien>>rawPrimitiveSingleStepInMemory:offsetBy:minimumAddress:readOnlyBelow: (in category 'primitives-simulation') -----
+ rawPrimitiveSingleStepInMemory: memoryArray offsetBy: offset minimumAddress: minimumAddress readOnlyBelow: minimumWritableAddress
+ 	"A version of primitiveSingleStepInMemory:offsetBy:minimumAddress:readOnlyBelow: for simulation"
+ 	<primitive: 'primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite' module: 'GdbARMPlugin' error: ec>
+ 	^ec!

Item was changed:
  ----- Method: MultiProcessor>>saveStackFor:above:homeContext: (in category 'private-deep hackery') -----
  saveStackFor: signalerContext above: contextInCritical homeContext: doesNotUnderstandContext
  	"Some processors, notably ARMv8, support load/store pair instructions which may raise two
  	 ProcessorSimulationTraps. To handle this we must preserve the continuation following the
  	 raising of the first simulaiton trap.  This cuts up, and restitches the stack so that when the
  	 first ProcessorSimulationTrap is raised outside the critical: block in our doesNotUnderstand:
  	 method, control continues to the second trap." 
+ 	| contextAboveSignalerContext |
- 	| contextAboveContextInCritical contextAboveSignalerContext |
- 	contextAboveContextInCritical := signalerContext findContextSuchThat: [:ctxt| ctxt sender == contextInCritical].
  	"This is our continuation, which should be changed to continue back into the critical section."
  	contextAboveSignalerContext := thisContext findContextSuchThat: [:ctxt| ctxt sender == signalerContext].
- 	self deny: contextAboveContextInCritical isNil.
  	self deny: contextAboveSignalerContext isNil.
  
+ 	"signalerContext through the context above contextInCritical is the stack that is the continuation
+ 	 for the trap.  This must be inserted between the doesNotUnderstandContext and its sender.
+ 	 N.B. Context>>cut: cuts above the argument!!!!"
+ 	signalerContext cut: contextInCritical.
+ 	contextInCritical privSender: doesNotUnderstandContext sender.
- 	"signalerContext through contextAboveContextInCritical is the stack that is the continuation
- 	 for the trap.  This must be inserted between the doesNotUnderstandContext and its sender."
- 	signalerContext cut: contextAboveContextInCritical.
- 	contextAboveContextInCritical privSender: doesNotUnderstandContext sender.
  	doesNotUnderstandContext privSender: signalerContext.
  
  	"Now arrange that the handler returns to contextInCritical; and we're done."
+ 	contextAboveSignalerContext privSender: contextInCritical!
- 	contextAboveSignalerContext privSender: contextInCritical.
- 	self deny: (thisContext findContextSuchThat: [:ctxt| ctxt == signalerContext]) isNil.
- 	self deny: (thisContext findContextSuchThat: [:ctxt| ctxt == contextInCritical]) isNil.
- 	self deny: (thisContext findContextSuchThat: [:ctxt| ctxt == doesNotUnderstandContext]) isNil!

Item was changed:
  ----- Method: ProcessorSimulatorPlugin>>runCPU:In:Size:MinAddressRead:Write: (in category 'simulation') -----
  runCPU: cpu In: memoryCArray Size: memorySize MinAddressRead: minAddress Write: minWriteMaxExecAddress
  	<doNotGenerate>
  	"*now* we need derived pointers. Ho hum...
  	 But all we need is one more level of indirection..."
+ 	| result |
+ 	result := mySimulatorAlien
+ 				rawPrimitiveRunInMemory: interpreterProxy memory
+ 				offsetBy: memoryCArray ptrAddress
+ 				minimumAddress: minAddress
+ 				readOnlyBelow: minWriteMaxExecAddress.
+ 	^result == mySimulatorAlien
+ 		ifTrue: [0]
+ 		ifFalse:
+ 			[result isPrimitiveError
+ 				ifTrue: [result errorCode]
+ 				ifFalse: [result]]!
- 	^mySimulatorAlien
- 		primitiveRunInMemory: interpreterProxy memory
- 		offsetBy: memoryCArray ptrAddress
- 		minimumAddress: minAddress
- 		readOnlyBelow: minWriteMaxExecAddress!

Item was changed:
  ----- Method: ProcessorSimulatorPlugin>>singleStepCPU:In:Size:MinAddressRead:Write: (in category 'simulation') -----
  singleStepCPU: cpu In: memoryCArray Size: memorySize MinAddressRead: minAddress Write: minWriteMaxExecAddress
  	<doNotGenerate>
  	"*now* we need derived pointers. Ho hum...
  	 But all we need is one more level of indirection..."
+ 	| result |
+ 	self break.
+ 	result := mySimulatorAlien
+ 				rawPrimitiveSingleStepInMemory: interpreterProxy memory
+ 				offsetBy: memoryCArray ptrAddress
+ 				minimumAddress: minAddress
+ 				readOnlyBelow: minWriteMaxExecAddress.
+ 	^result == mySimulatorAlien
+ 		ifTrue: [0]
+ 		ifFalse:
+ 			[result isPrimitiveError
+ 				ifTrue: [result errorCode]
+ 				ifFalse: [result]]!
- 	^mySimulatorAlien
- 		primitiveSingleStepInMemory: interpreterProxy memory
- 		offsetBy: memoryCArray ptrAddress
- 		minimumAddress: minAddress
- 		readOnlyBelow: minWriteMaxExecAddress!



More information about the Vm-dev mailing list