blob: 8065188aadb063dbc51748bbab787e80a63b37cc (
plain) (
blame)
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
|
.global enable_fpu
.type enable_fpu @function
enable_fpu:
fninit
fldcw [fcw_init]
ret
.size enable_fpu, . - enable_fpu
.global enable_sse
.type enable_sse @function
enable_sse:
movq %cr0, %rax
//Disable coprocessor emulation
and $0xFFFB, %ax
//Set coprocessor monitoring
or $0x22, %ax
//Save cr0
movq %rax, %cr0
movq %cr4, %rax
//Set CR4.OSFXR and CR4.OSXMMEXCEPT
or $3 << 9, %ax
movq %rax, %cr4
ret
.size enable_sse, . - enable_sse
.global enable_avx
.type enable_avx, @function
enable_avx:
pushq %rax
pushq %rcx
pushq %rdx
xorq %rcx, %rcx
xgetbv
or $7, %eax
xsetbv
popq %rdx
popq %rcx
popq %rax
ret
.size enable_avx, . - enable_avx
.data
fcw_init:
.word 0x037F
|