-
Notifications
You must be signed in to change notification settings - Fork 67
/
CogICacheFlushingIA32Compiler.class.st
51 lines (47 loc) · 1.3 KB
/
CogICacheFlushingIA32Compiler.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
39
40
41
42
43
44
45
46
47
48
49
50
51
"
This is a subclass that uses CPUID to serialize instruction modification. This is not needed with Intel processors on systems where code and data have the same linear address, hence Cog uses the superclass by default.
"
Class {
#name : #CogICacheFlushingIA32Compiler,
#superclass : #CogIA32Compiler,
#category : #'VMMaker-JIT'
}
{ #category : #'inline cacheing' }
CogICacheFlushingIA32Compiler >> flushICacheFrom: startAddress "<Integer>" to: endAddress [ "<Integer>"
<cmacro: '(me,startAddress,endAddress) ceFlushICache(startAddress,endAddress)'>
self halt: #ceFlushICache
]
{ #category : #'inline cacheing' }
CogICacheFlushingIA32Compiler >> generateICacheFlush [
"Use CPUID as a serializing instruction for instruction modification.
MFENCE doesn't work which is a shame because CPUID updates registers."
cogit
PushR: EDX;
PushR: ECX;
PushR: EBX;
XorR: EAX R: EAX;
gen: CPUID;
PopR: EBX;
PopR: ECX;
PopR: EDX;
RetN: 8 "pop from,to args"
"self hasSSE2Instructions
ifTrue:
[cogit
gen: MFENCE]
ifFalse:
[cogit
PushR: EDX;
PushR: ECX;
PushR: EBX;
XorR: EAX R: EAX;
gen: CPUID;
PopR: EBX;
PopR: ECX;
PopR: EDX].
cogit RetN: 8 ``pop from,to args''"
]
{ #category : #'inline cacheing' }
CogICacheFlushingIA32Compiler >> numICacheFlushOpcodes [
^10
]