VM Maker: Cog-eem.389.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.389.mcz

Eliot Miranda uploaded a new version of Cog to project VM Maker:

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

Name: Cog-eem.389
Author: eem
Time: 12 January 2020, 7:10:18.216284 pm
UUID: aec9c8bf-988e-4ed0-8caa-ab2608f8abb6
Ancestors: Cog-eem.388

Processor plugins: get the element type of the register state vector right no matter what the platform's word size is.

=============== Diff against Cog-eem.388 ===============

Item was added:
+ ----- Method: BochsIA32Plugin>>integerRegisterElementType (in category 'primitives') -----
+ integerRegisterElementType
+ <inline: #always>
+ ^#int!

Item was added:
+ ----- Method: BochsX64Plugin>>integerRegisterElementType (in category 'primitives') -----
+ integerRegisterElementType
+ <inline: #always>
+ ^#sqLong!

Item was added:
+ ----- Method: GdbARMv6Plugin>>integerRegisterElementType (in category 'primitives') -----
+ integerRegisterElementType
+ <inline: #always>
+ ^#int!

Item was added:
+ ----- Method: GdbARMv8Plugin>>integerRegisterElementType (in category 'primitives') -----
+ integerRegisterElementType
+ <inline: #always>
+ ^#sqLong!

Item was changed:
  ----- Method: ProcessorSimulatorPlugin>>primitiveIntegerRegisterState: (in category 'primitives') -----
  primitiveIntegerRegisterState: integerArrayClass
  "Answer an IntegerArray of the processor's integer register state, ending with, if these are not otherwise
  included in the register state, the pc and the flags (if the processor has flags). The integer array will be an
  instance of the class argument, which must be large enough for the natural word size of the processor.
  This primitive is unnecessary; it exists only to speed up single stepping."
  | cpuAlien cpu registerStateVector |
  <var: #cpu type: #'void *'>
  cpuAlien := self primitive: #primitiveIntegerRegisterState parameters: #(Oop) receiver: #Oop.
  (cpu := self cCoerceSimple: (self startOfData: cpuAlien) to: #'void *') = 0 ifTrue:
  [^interpreterProxy primitiveFailFor: PrimErrBadReceiver].
  "The plugin specific include file must define NumIntegerRegisterStateFields"
  registerStateVector := interpreterProxy instantiateClass: integerArrayClass indexableSize: NumIntegerRegisterStateFields.
  registerStateVector = 0 ifTrue:
  [^interpreterProxy primitiveFailFor: PrimErrNoMemory].
+ (interpreterProxy byteSizeOf: registerStateVector) ~= (NumIntegerRegisterStateFields * (self sizeof: self integerRegisterElementType)) ifTrue:
- (interpreterProxy byteSizeOf: registerStateVector) ~= (NumIntegerRegisterStateFields * (self sizeof: #long)) ifTrue:
  [^interpreterProxy primitiveFailFor: PrimErrBadArgument].
  self storeIntegerRegisterStateOf: cpu into: (interpreterProxy firstIndexableField: registerStateVector).