-
Notifications
You must be signed in to change notification settings - Fork 68
/
StackInterpreterSimulatorLSB.class.st
38 lines (30 loc) · 1.28 KB
/
StackInterpreterSimulatorLSB.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"
This class overrides a few methods in StackInterpreterSimulator required for simulation to work on little-endian architectures (such as the x86 family of processors). To start it up simply use StackInterpreterSimulatorLSB instead of StackInterpreterSimulator (see the class comment there for more details). For example:
(StackInterpreterSimulatorLSB new openOn: Smalltalk imageName) test
Note that the image must have been saved at least once on the local architecture, since the compiled VM performs some byte swapping that the simulator cannot cope with.
"
Class {
#name : #StackInterpreterSimulatorLSB,
#superclass : #StackInterpreterSimulator,
#category : #'VMMaker-InterpreterSimulation'
}
{ #category : #'memory access' }
StackInterpreterSimulatorLSB >> halfWordHighInLong32: long32 [
"Used by Balloon"
^ long32 bitAnd: 16rFFFF
]
{ #category : #'memory access' }
StackInterpreterSimulatorLSB >> halfWordLowInLong32: long32 [
"Used by Balloon"
^ long32 bitShift: -16
]
{ #category : #initialization }
StackInterpreterSimulatorLSB >> nextShortFrom: aStream [
"Read a 16-bit quantity from the given (binary) stream."
^aStream nextLittleEndianNumber: 2
]
{ #category : #'memory access' }
StackInterpreterSimulatorLSB >> vmEndianness [
"return 0 for little endian, 1 for big endian"
^0
]