VM Maker: Cog-eem.363.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: Cog-eem.363.mcz

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

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

Name: Cog-eem.363
Author: eem
Time: 19 November 2019, 3:04:32.859878 pm
UUID: 89357401-72b6-406a-9fa5-4c782990aff0
Ancestors: Cog-eem.362

Get GdbARMv8Alien[64] to an instantiable and printable state.
Clean up pronting of the CogProcessorAliens.

=============== Diff against Cog-eem.362 ===============

Item was removed:
- ----- Method: BochsIA32Alien>>registerAt: (in category 'accessing') -----
- registerAt: index
- ^self perform: (#(eax ecx edx ebx esp ebp esi edi) at: index + 1)!

Item was changed:
+ ----- Method: BochsIA32Alien>>reset (in category 'processor setup') -----
- ----- Method: BochsIA32Alien>>reset (in category 'execution') -----
  reset
  self primitiveResetCPU.
  "Enable SSE extensions by setting the OSFXSR (Operating System FXSAVE/FXRSTOR Support) bit"
  self cr4: (self cr4 bitOr: 1 << 9)!

Item was changed:
+ ----- Method: BochsX64Alien>>reset (in category 'processor setup') -----
- ----- Method: BochsX64Alien>>reset (in category 'primitives') -----
  reset
  self primitiveResetCPU.
  "Enable SSE extensions by setting the OSFXSR (Operating System FXSAVE/FXRSTOR Support) bit"
  self cr4: (self cr4 bitOr: 1 << 9)!

Item was added:
+ ----- Method: CogProcessorAlien>>printElementsOn:separatedBy: (in category 'printing') -----
+ printElementsOn: aStream separatedBy: separator
+ "Hack; we simply ignore the separator."
+ self printRegistersOn: aStream!

Item was added:
+ ----- Method: CogProcessorAlien>>printOn: (in category 'printing') -----
+ printOn: aStream
+ "Append a sequence of characters that identify the receiver to aStream."
+
+ self printNameOn: aStream.
+ self printRegistersOn: aStream!

Item was added:
+ ----- Method: CogProcessorAlien>>registerAt: (in category 'accessing-abstract') -----
+ registerAt: index
+ ^self perform: (self registerStateGetters at: index + 1)!

Item was added:
+ ----- Method: CogProcessorAlien>>registerAt:put: (in category 'accessing-abstract') -----
+ registerAt: index put: aValue
+ ^self perform: (self registerStateSetters at: index + 1) with: aValue!

Item was removed:
- ----- Method: GdbARMAlien>>printOn: (in category 'printing') -----
- printOn: aStream
- | first |
- first := true.
- aStream nextPutAll: 'an ARMAlien ('.
- self registerState with: self registerStateGetters do: [ :state :getter |
- first
- ifTrue: [first := false]
- ifFalse: [aStream << ', '].
- getter first = $d
- ifTrue:
- [aStream
- << getter << ': '
- << (Float fromIEEE64BitWord: state)]
- ifFalse:
- [getter == #eflags
- ifTrue:
- [aStream
- << 'NZCVIF: '
- << (state printStringBase: 2 length: 6 padded: true)]
- ifFalse:
- [aStream
- << getter << ': '
- << (state printStringBase: 16)]]]!

Item was removed:
- ----- Method: GdbARMAlien>>registerAt: (in category 'accessing') -----
- registerAt: index
- ^self perform: (self registerStateGetters at: index + 1)!

Item was changed:
+ ----- Method: GdbARMAlien>>reset (in category 'processor setup') -----
- ----- Method: GdbARMAlien>>reset (in category 'accessing') -----
  reset
  self priorPc: 0;
  primitiveResetCPU!

Item was changed:
  CogProcessorAlien variableByteSubclass: #GdbARMv8Alien
  instanceVariableNames: ''
+ classVariableNames: 'BadCPUInstance ExecutionError InstructionPrefetchError MemorBoundsError NoError PanicError SomethingLoggedError UnsupportedOperationError'
- classVariableNames: ''
  poolDictionaries: ''
  category: 'Cog-Processors'!

Item was added:
+ ----- Method: GdbARMv8Alien class>>dataSize (in category 'instance creation') -----
+ dataSize
+ ^2280!

Item was added:
+ ----- Method: GdbARMv8Alien class>>implementationClass (in category 'instance creation') -----
+ implementationClass
+ ^Smalltalk wordSize = 8 ifTrue: [GdbARMv8Alien64] ifFalse: [self]!

Item was added:
+ ----- Method: GdbARMv8Alien class>>initialize (in category 'class initialization') -----
+ initialize
+ "GdbARMv8Alien initialize"
+
+ "Return errors from GdbARMv8Plugin.h"
+ NoError := 0.
+ ExecutionError := 1.
+ BadCPUInstance := 2.
+ MemorBoundsError := 3.
+ "MemoryWriteBoundsError := 4."
+ InstructionPrefetchError := 5.
+ PanicError := 6.
+ UnsupportedOperationError := 7.
+ SomethingLoggedError := 8!

Item was added:
+ ----- Method: GdbARMv8Alien class>>primitiveNewCPU (in category 'primitives') -----
+ primitiveNewCPU
+ "Answer the address of a new struct sim_spu instance (see processors/ARM/gdb-8.3.1/sim/aarch64/sim_main.h)."
+ <primitive: 'primitiveNewCPU' module: 'GdbARMv8Plugin'>
+ ^self primitiveFailed!

Item was added:
+ ----- Method: GdbARMv8Alien>>primitiveDisassembleAt:inMemory: (in category 'primitives') -----
+ primitiveDisassembleAt: address inMemory: memoryArray "<Bitmap|ByteArray>"
+ "Answer an Array of the size and the disassembled code string for the instruction at the current instruction pointer in memory."
+ <primitive: 'primitiveDisassembleAtInMemory' module: 'GdbARMv8Plugin'>
+ ^self primitiveFailed!

Item was added:
+ ----- Method: GdbARMv8Alien>>primitiveErrorAndLog (in category 'primitives') -----
+ primitiveErrorAndLog
+ "Answer an array of the current error code and log contents"
+ <primitive: 'primitiveErrorAndLog' module: 'GdbARMv8Plugin'>
+ ^self primitiveFailed!

Item was added:
+ ----- Method: GdbARMv8Alien>>primitiveFlushICacheFrom:To: (in category 'primitives') -----
+ primitiveFlushICacheFrom: startAddress "<Integer>" To: endAddress "<Integer>"
+ "Flush the icache in the requested range"
+ <primitive: 'primitiveFlushICacheFromTo' module: 'GdbARMv8Plugin'>
+ ^self primitiveFailed!

Item was added:
+ ----- Method: GdbARMv8Alien>>primitiveResetCPU (in category 'primitives') -----
+ primitiveResetCPU
+ "Reset the receiver to registers all zero, and protected 32-bit mode."
+ <primitive: 'primitiveResetCPU' module: 'GdbARMv8Plugin'>
+ ^self reportPrimitiveFailure!

Item was added:
+ ----- 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 added:
+ ----- 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 == #'inappropriate operation'
+ ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
+ minimumAddress: minimumAddress]
+ ifFalse: [self reportPrimitiveFailure]
+
+ "self printRegistersOn: Transcript"!

Item was added:
+ ----- 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 added:
+ ----- 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 == #'inappropriate operation'
+ ifTrue: [self handleExecutionPrimitiveFailureIn: memoryArray
+ minimumAddress: minimumAddress]
+ ifFalse: [self reportPrimitiveFailure]!

Item was added:
+ ----- Method: GdbARMv8Alien>>printFields:inRegisterState:on: (in category 'printing') -----
+ printFields: fields inRegisterState: registerStateVector on: aStream
+ | rsvs |
+ aStream ensureCr.
+ rsvs := registerStateVector readStream.
+ fields withIndexDo:
+ [:sym :index| | val |
+ sym = #cr
+ ifTrue: [aStream cr]
+ ifFalse:
+ [(val := rsvs next) isNil ifTrue: [^self].
+ aStream nextPutAll: sym; nextPut: $:; space.
+ val printOn: aStream base: 16 length: 16 padded: true.
+ #eflags == sym
+ ifTrue:
+ [aStream space.
+ "'FIVCZN'"'--VCZN' withIndexDo:
+ [:flag :bitIndex|
+ flag ~= $- ifTrue:
+ [aStream nextPut: flag; nextPutAll: 'F='; print: (val bitAnd: 1 << (bitIndex - 1)) >> (bitIndex - 1); space]]]
+ ifFalse:
+ [val > 16 ifTrue:
+ [aStream space; nextPut: $(.
+ val printOn: aStream base: 10 length: 1 padded: false.
+ aStream nextPut: $)]].
+ (fields at: index + 1) ~~ #cr ifTrue:
+ [aStream tab]]]!

Item was added:
+ ----- Method: GdbARMv8Alien>>printRegisterState:on: (in category 'printing') -----
+ printRegisterState: registerStateVector on: aStream
+ self printFields: #( r0 r1 r2 r3 cr
+ r4 r5 r6 r7 cr
+ r8 r9 r10 r11 cr
+ r12 r13 r14 r15 cr
+ r16 r17 r18 r19 cr
+ r20 r21 r22 r23 cr
+ r24 r25 r26 r27 cr
+ r28 fp lr sp cr
+ d0 d1 d2 d3 cr
+ d4 d5 d6 d7 cr
+ d8 d9 d10 d11 cr
+ d12 d13 d14 d15 cr
+ d16 d17 d18 d19 cr
+ d20 d21 d22 d23 cr
+ d24 d25 d26 d27 cr
+ d28 d29 d30 d31 cr
+ pc cr)
+ inRegisterState: registerStateVector
+ on: aStream!

Item was added:
+ ----- Method: GdbARMv8Alien>>registerState (in category 'accessing-abstract') -----
+ registerState
+ ^{ self r0. self r1. self r2. self r3. self r4. self r5. self r6. self r7.
+ self r8. self r9. self r10. self r11. self r12. self r13. self r14. self r15.
+ self r16. self r17. self r18. self r19. self r20. self r21. self r22. self r23.
+ self r24. self r25. self r26. self r27. self r28. self fp. self lr. self sp.
+ self d0. self d1. self d2. self d3. self d4. self d5. self d6. self d7.
+ self d8. self d9. self d10. self d11. self d12. self d13. self d14. self d15.
+ self d16. self d17. self d18. self d19. self d20. self d21. self d22. self d23.
+ self d24. self d25. self d26. self d27. self d28. self d29. self d30. self d31.
+ self pc }!

Item was added:
+ ----- Method: GdbARMv8Alien>>registerStateGetters (in category 'accessing') -----
+ registerStateGetters
+ ^#(r0 r1 r2 r3 r4 r5 r6 r7
+ r8 r9 r10 r11 r12 r13 r14 r15
+ r16 r17 r18 r19 r20 r21 r22 r23
+ r24 r25 r26 r27 r28 fp lr sp
+ d0 d1 d2 d3 d4 d5 d6 d7
+ d8 d9 d10 d11 d12 d13 d14 d15
+ d16 d17 d18 d19 d20 d21 d22 d23
+ d24 d25 d26 d27 d28 d29 d30 d31
+ pc)!

Item was added:
+ ----- Method: GdbARMv8Alien>>registerStateSetters (in category 'accessing') -----
+ registerStateSetters
+ ^#(r0: r1: r2: r3: r4: r5: r6: r7:
+ r8: r9: r10: r11: r12: r13: r14: r15:
+ r16: r17: r18: r19: r20: r21: r22: r23:
+ r24: r25: r26: r27: r28: fp: lr: sp:
+ d0: d1: d2: d3: d4: d5: d6: d7:
+ d8: d9: d10: d11: d12: d13: d14: d15:
+ d16: d17: d18: d19: d20: d21: d22: d23:
+ d24: d25: d26: d27: d28: d29: d30: d31:
+ pc:)!

Item was added:
+ ----- Method: GdbARMv8Alien>>reset (in category 'processor setup') -----
+ reset
+ self primitiveResetCPU!