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

commits at source.squeak.org commits at source.squeak.org
Thu Dec 3 23:12:35 UTC 2015


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

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

Name: Cog-eem.302
Author: eem
Time: 3 December 2015, 3:12:23.656 pm
UUID: 41077df0-b3a6-46a8-9247-c7500c69f44a
Ancestors: Cog-eem.301

Add (or simplify) byte generators to x86 & x64 Bochs aliens.

Implement x64 handleMovGbEbFailureAt:in:rex:

Fix the accessors in BochsX64Alien's execution methods to be 64-bit.

Make sure the call/return emulation includes PostBuildStackDelta.

=============== Diff against Cog-eem.301 ===============

Item was changed:
  ----- Method: BochsIA32Alien>>al (in category 'accessing') -----
  al
+ 	^self unsignedByteAt: 469!
- 	^self eax bitAnd: 16rFF!

Item was changed:
  ----- Method: BochsIA32Alien>>al: (in category 'accessing') -----
+ al: anUnsignedInteger
+ 	^self unsignedByteAt: 469 put: anUnsignedInteger!
- al: aByte
- 	self eax: ((self eax bitAnd: -16rFF) + aByte).
- 	^aByte!

Item was changed:
  ----- Method: BochsIA32Alien>>bl (in category 'accessing') -----
  bl
+ 	^self unsignedByteAt: 481!
- 	^self ebx bitAnd: 16rFF!

Item was changed:
  ----- Method: BochsIA32Alien>>bl: (in category 'accessing') -----
+ bl: anUnsignedInteger
+ 	^self unsignedByteAt: 481 put: anUnsignedInteger!
- bl: aByte
- 	self ebx: ((self ebx bitAnd: -16rFF) + aByte).
- 	^aByte!

Item was added:
+ ----- Method: BochsIA32Alien>>bpl (in category 'accessing') -----
+ bpl
+ 	^self unsignedByteAt: 489!

Item was added:
+ ----- Method: BochsIA32Alien>>bpl: (in category 'accessing') -----
+ bpl: anUnsignedInteger
+ 	^self unsignedByteAt: 489 put: anUnsignedInteger!

Item was changed:
  ----- Method: BochsIA32Alien>>cl (in category 'accessing') -----
  cl
+ 	^self unsignedByteAt: 473!
- 	^self ecx bitAnd: 16rFF!

Item was changed:
  ----- Method: BochsIA32Alien>>cl: (in category 'accessing') -----
+ cl: anUnsignedInteger
+ 	^self unsignedByteAt: 473 put: anUnsignedInteger!
- cl: aByte
- 	self ecx: ((self ecx bitAnd: -16rFF) + aByte).
- 	^aByte!

Item was added:
+ ----- Method: BochsIA32Alien>>dil (in category 'accessing') -----
+ dil
+ 	^self unsignedByteAt: 497!

Item was added:
+ ----- Method: BochsIA32Alien>>dil: (in category 'accessing') -----
+ dil: anUnsignedInteger
+ 	^self unsignedByteAt: 497 put: anUnsignedInteger!

Item was changed:
  ----- Method: BochsIA32Alien>>dl (in category 'accessing') -----
  dl
+ 	^self unsignedByteAt: 477!
- 	^self edx bitAnd: 16rFF!

Item was changed:
  ----- Method: BochsIA32Alien>>dl: (in category 'accessing') -----
+ dl: anUnsignedInteger
+ 	^self unsignedByteAt: 477 put: anUnsignedInteger!
- dl: aByte
- 	self edx: ((self edx bitAnd: -16rFF) + aByte).
- 	^aByte!

Item was changed:
+ ----- Method: BochsIA32Alien>>popWordIn: (in category 'execution') -----
- ----- Method: BochsIA32Alien>>popWordIn: (in category 'accessing-abstract') -----
  popWordIn: aMemory 
  	| sp word |
  	word := aMemory unsignedLongAt: (sp := self esp) + 1 bigEndian: false.
  	self esp: sp + 4.
  	^word!

Item was added:
+ ----- Method: BochsIA32Alien>>sil (in category 'accessing') -----
+ sil
+ 	^self unsignedByteAt: 493!

Item was added:
+ ----- Method: BochsIA32Alien>>sil: (in category 'accessing') -----
+ sil: anUnsignedInteger
+ 	^self unsignedByteAt: 493 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsIA32Alien>>spl (in category 'accessing') -----
+ spl
+ 	^self unsignedByteAt: 485!

Item was added:
+ ----- Method: BochsIA32Alien>>spl: (in category 'accessing') -----
+ spl: anUnsignedInteger
+ 	^self unsignedByteAt: 485 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>al (in category 'accessing') -----
+ al
+ 	^self unsignedByteAt: 469!

Item was added:
+ ----- Method: BochsX64Alien>>al: (in category 'accessing') -----
+ al: anUnsignedInteger
+ 	^self unsignedByteAt: 469 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>bl (in category 'accessing') -----
+ bl
+ 	^self unsignedByteAt: 493!

Item was added:
+ ----- Method: BochsX64Alien>>bl: (in category 'accessing') -----
+ bl: anUnsignedInteger
+ 	^self unsignedByteAt: 493 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>bpl (in category 'accessing') -----
+ bpl
+ 	^self unsignedByteAt: 509!

Item was added:
+ ----- Method: BochsX64Alien>>bpl: (in category 'accessing') -----
+ bpl: anUnsignedInteger
+ 	^self unsignedByteAt: 509 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>cl (in category 'accessing') -----
+ cl
+ 	^self unsignedByteAt: 477!

Item was added:
+ ----- Method: BochsX64Alien>>cl: (in category 'accessing') -----
+ cl: anUnsignedInteger
+ 	^self unsignedByteAt: 477 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>dil (in category 'accessing') -----
+ dil
+ 	^self unsignedByteAt: 525!

Item was added:
+ ----- Method: BochsX64Alien>>dil: (in category 'accessing') -----
+ dil: anUnsignedInteger
+ 	^self unsignedByteAt: 525 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>dl (in category 'accessing') -----
+ dl
+ 	^self unsignedByteAt: 485!

Item was added:
+ ----- Method: BochsX64Alien>>dl: (in category 'accessing') -----
+ dl: anUnsignedInteger
+ 	^self unsignedByteAt: 485 put: anUnsignedInteger!

Item was changed:
  ----- Method: BochsX64Alien>>handleMovGbEbFailureAt:in:rex: (in category 'error handling') -----
  handleMovGbEbFailureAt: pc "<Integer>" in: memoryArray "<Bitmap|ByteArray>" rex: rexByteOrNil "<Integer|nil>"
  	"Convert an execution primitive failure for a byte register load into a ProcessorSimulationTrap signal."
+ 	| modrmByte offset size |
+ 	modrmByte := memoryArray byteAt: pc + 3.
+ 	(modrmByte bitAnd: 16rC0) caseOf: {
+ 		[16r80 "ModRegRegDisp32"] -> [offset := memoryArray unsignedLongAt: pc + 4 bigEndian: false.
+ 										 size := 7].
+ 		[16r40 "ModRegRegDisp8"] -> [offset := memoryArray byteAt: pc + 4.
+ 										offset > 127 ifTrue: [offset := offset - 256].
+ 										 size := 4] }
+ 		otherwise: [self reportPrimitiveFailure].
+ 	^(ProcessorSimulationTrap
+ 			pc: pc
+ 			nextpc: pc + size
+ 			address: (((self perform: (self registerStateGetters at: (modrmByte bitAnd: 7) + ((rexByteOrNil bitAnd: 1) bitShift: 3) + 1))
+ 					+ offset)
+ 						bitAnd: 16rFFFFFFFFFFFFFFFF)
+ 			type: #read
+ 			accessor: (#(al: cl: dl: bl: spl: bpl: sil: dil: r8l: r9l: r10l: r11l: r12l: r13l: r14l: r15l:) at: ((modrmByte >> 3 bitAnd: 7) + ((rexByteOrNil bitAnd: 4) bitShift: 1) + 1)))
+ 		signal!
- 	| modrmByte |
- 	self shouldBeImplemented.
- 	^(((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: BochsX64Alien>>initializeStackFor: (in category 'processor setup') -----
  initializeStackFor: aCogit
  	"Different cpus need different stack alignment etc, so handle the details here."
  	"From the System V ABI:
  	 3.2.2 The Stack Frame
  	 ...	The end of the input argument area shall be aligned on a 16 (32, if __m256 is
  		passed on stack) byte boundary. In other words, the value (%rsp + 8) is always
  		a multiple of 16 (32) when control is transferred to the function entry point."
+ 	| stackAlignment |
+ 	stackAlignment := 16.
+ 	aCogit setStackAlignment: stackAlignment expectedSPOffset: 0 expectedFPOffset: 16.
+ 	PostBuildStackDelta := stackAlignment > 16
+ 								ifTrue: [stackAlignment - 16]
+ 								ifFalse: [0]!
- 	aCogit setStackAlignment: 16 expectedSPOffset: 0 expectedFPOffset: 0!

Item was changed:
+ ----- Method: BochsX64Alien>>popWordIn: (in category 'execution') -----
- ----- Method: BochsX64Alien>>popWordIn: (in category 'accessing-abstract') -----
  popWordIn: aMemory 
  	| sp word |
+ 	word := aMemory long64At: (sp := self rsp) + 1.
- 	word := aMemory unsignedLongAt: (sp := self rsp) + 1 bigEndian: false.
  	self rsp: sp + 8.
  	^word!

Item was added:
+ ----- Method: BochsX64Alien>>r10l (in category 'accessing') -----
+ r10l
+ 	^self unsignedByteAt: 549!

Item was added:
+ ----- Method: BochsX64Alien>>r10l: (in category 'accessing') -----
+ r10l: anUnsignedInteger
+ 	^self unsignedByteAt: 549 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>r11l (in category 'accessing') -----
+ r11l
+ 	^self unsignedByteAt: 557!

Item was added:
+ ----- Method: BochsX64Alien>>r11l: (in category 'accessing') -----
+ r11l: anUnsignedInteger
+ 	^self unsignedByteAt: 557 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>r12l (in category 'accessing') -----
+ r12l
+ 	^self unsignedByteAt: 565!

Item was added:
+ ----- Method: BochsX64Alien>>r12l: (in category 'accessing') -----
+ r12l: anUnsignedInteger
+ 	^self unsignedByteAt: 565 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>r13l (in category 'accessing') -----
+ r13l
+ 	^self unsignedByteAt: 573!

Item was added:
+ ----- Method: BochsX64Alien>>r13l: (in category 'accessing') -----
+ r13l: anUnsignedInteger
+ 	^self unsignedByteAt: 573 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>r14l (in category 'accessing') -----
+ r14l
+ 	^self unsignedByteAt: 581!

Item was added:
+ ----- Method: BochsX64Alien>>r14l: (in category 'accessing') -----
+ r14l: anUnsignedInteger
+ 	^self unsignedByteAt: 581 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>r15l (in category 'accessing') -----
+ r15l
+ 	^self unsignedByteAt: 589!

Item was added:
+ ----- Method: BochsX64Alien>>r15l: (in category 'accessing') -----
+ r15l: anUnsignedInteger
+ 	^self unsignedByteAt: 589 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>r8l (in category 'accessing') -----
+ r8l
+ 	^self unsignedByteAt: 533!

Item was added:
+ ----- Method: BochsX64Alien>>r8l: (in category 'accessing') -----
+ r8l: anUnsignedInteger
+ 	^self unsignedByteAt: 533 put: anUnsignedInteger!

Item was added:
+ ----- Method: BochsX64Alien>>r9l (in category 'accessing') -----
+ r9l
+ 	^self unsignedByteAt: 541!

Item was added:
+ ----- Method: BochsX64Alien>>r9l: (in category 'accessing') -----
+ r9l: anUnsignedInteger
+ 	^self unsignedByteAt: 541 put: anUnsignedInteger!

Item was changed:
  ----- Method: BochsX64Alien>>retpcIn: (in category 'accessing-abstract') -----
  retpcIn: aMemory
+ 	^aMemory long64At: self rbp + 9!
- 	^aMemory unsignedLongAt: self rbp + 9 bigEndian: false!

Item was added:
+ ----- Method: BochsX64Alien>>sil (in category 'accessing') -----
+ sil
+ 	^self unsignedByteAt: 517!

Item was added:
+ ----- Method: BochsX64Alien>>sil: (in category 'accessing') -----
+ sil: anUnsignedInteger
+ 	^self unsignedByteAt: 517 put: anUnsignedInteger!

Item was changed:
  ----- Method: BochsX64Alien>>simulateCallOf:nextpc:memory: (in category 'execution') -----
  simulateCallOf: address nextpc: nextpc memory: aMemory
  	"Simulate a frame-building call of address.  Build a frame since
  	a) this is used for calls into the run-time which are unlikely to be leaf-calls, and
  	b) stack alignment needs to be realistic for assert checking
  
  	From the System V ABI:
  	 3.2.2 The Stack Frame
  	 ...	The end of the input argument area shall be aligned on a 16 (32, if __m256 is
  		passed on stack) byte boundary. In other words, the value (%rsp + 8) is always
  		a multiple of 16 (32) when control is transferred to the function entry point."
  	self pushWord: nextpc in: aMemory.
  	self pushWord: self rbp in: aMemory.
  	self rbp: self rsp.
+ 	PostBuildStackDelta ~= 0 ifTrue:
+ 		[self rsp: self rsp - PostBuildStackDelta].
  	self rip: address!

Item was added:
+ ----- Method: BochsX64Alien>>spl (in category 'accessing') -----
+ spl
+ 	^self unsignedByteAt: 501!

Item was added:
+ ----- Method: BochsX64Alien>>spl: (in category 'accessing') -----
+ spl: anUnsignedInteger
+ 	^self unsignedByteAt: 501 put: anUnsignedInteger!



More information about the Vm-dev mailing list