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

commits at source.squeak.org commits at source.squeak.org
Sun Nov 21 06:15:08 UTC 2021


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

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

Name: Cog-eem.447
Author: eem
Time: 20 November 2021, 10:15:05.906973 pm
UUID: 5670a6c1-87d5-43b5-8087-5b0826d5cfcb
Ancestors: Cog-eem.446

ProcessorSimulatorPlugin:
Remember to apply the memory offset to disassembly.
Fix a slip in primitiveSingleStepInMemory:minimumAddress:maximumAddress:readOnlyBelow: from Cog-eem.446

=============== Diff against Cog-eem.446 ===============

Item was changed:
  ----- Method: ProcessorSimulatorPlugin>>primitiveDisassembleAt:InMemory: (in category 'primitives') -----
  "cpuAlien <CogProcessorAlien>" primitiveDisassembleAt: address "<Integer>" InMemory: memory "<Bitmap|ByteArray|WordArray|DoubleWordArray>"
  	"Return an Array of the instruction length and its decompilation as a string for the instruction at address in memory."
  	| cpuAlien cpu instrLenOrErr resultObj log logLen logObj |
  	<var: #cpu type: #'void *'>
  	<var: #log type: #'char *'>
  	<var: #logLen type: #long>
  	cpuAlien := self primitive: #primitiveDisassembleAtInMemory
  					parameters: #(SmallInteger WordsOrBytes)
  					receiver: #Oop.
  	(cpu := self cCoerceSimple: (self startOfData: cpuAlien) to: #'void *') = 0 ifTrue:
  		[^interpreterProxy primitiveFailFor: PrimErrBadReceiver].
+ 	address < memoryOffset ifTrue:
+ 		[^self primitiveFailFor: PrimErrBadArgument].
  	instrLenOrErr := self disassembleFor: cpu
  						At: address
+ 						In: memory - memoryOffset
+ 						Size: (interpreterProxy byteSizeOf: memory cPtrAsOop) + memoryOffset.
- 						In: memory
- 						Size: (interpreterProxy byteSizeOf: memory cPtrAsOop).
  	instrLenOrErr < 0 ifTrue:
  		[^interpreterProxy primitiveFailForOSError: instrLenOrErr negated].
  	log := self getlog: (self addressOf: logLen put: [:v| logLen := v]).
  	resultObj := interpreterProxy instantiateClass: interpreterProxy classArray indexableSize: 2.
  	resultObj ifNil:
  		[^interpreterProxy primitiveFailFor: PrimErrNoMemory].
  
  	"Easier keeping the damn thing on the stack than using pushRemappableOop:/popRemappableOop.
  	 Where is topRemappableOop when you need it?"
  	interpreterProxy pushRemappableOop: resultObj.
  	logObj := interpreterProxy
  				instantiateClass: interpreterProxy classString
  				indexableSize: logLen.
  	resultObj := interpreterProxy popRemappableOop.
  	logObj ifNil:
  		[^interpreterProxy primitiveFailFor: PrimErrNoMemory].
  	self mem: (interpreterProxy firstIndexableField: logObj) cp: log y: logLen.
  	interpreterProxy
  		storeInteger: 0 ofObject: resultObj withValue: instrLenOrErr;
  		storePointer: 1 ofObject: resultObj withValue: logObj.
  
  	^resultObj!

Item was changed:
  ----- Method: ProcessorSimulatorPlugin>>primitiveSingleStepInMemory:minimumAddress:maximumAddress:readOnlyBelow: (in category 'primitives-legacy') -----
  "cpuAlien <BochsIA32|X86Alien>" primitiveSingleStepInMemory: memory "<Bitmap|ByteArray|WordArray>" minimumAddress: minAddress "<Integer>" maximumAddress: maxAddress "<Integer>" readOnlyBelow: minWriteMaxExecAddress "<Integer>"
  	"Single-step the cpu using the first argument as the memory and the following arguments defining valid addresses."
  	<legacy>
  	| cpuAlien cpu memorySize maybeErr |
  	<var: #cpu type: #'void *'>
  	cpuAlien := self primitive: #primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite
  					parameters: #(WordsOrBytes SmallInteger SmallInteger SmallInteger)
  					receiver: #Oop.
  	(cpu := self cCoerceSimple: (self startOfData: cpuAlien) to: #'void *') = 0 ifTrue:
  		[^interpreterProxy primitiveFailFor: PrimErrBadReceiver].
  	(minAddress < memoryOffset
  	or: [maxAddress < memoryOffset
  	or: [minWriteMaxExecAddress < memoryOffset]]) ifTrue:
  		[^self primitiveFailFor: PrimErrBadArgument].
  	memorySize := interpreterProxy byteSizeOf: memory cPtrAsOop.
  	maybeErr := self singleStepCPU: cpu
+ 					In: memory - memoryOffset
- 					In: memory - memory offset
  					Size: (memorySize + memoryOffset min: maxAddress)
  					MinAddressRead: minAddress
  					Write: minWriteMaxExecAddress.
  	maybeErr ~= 0 ifTrue:
  		[^interpreterProxy primitiveFailForOSError: maybeErr].
  	^cpuAlien!



More information about the Vm-dev mailing list