Subversion Repositories Kolibri OS

Rev

Rev 357 | Rev 380 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 357 Rev 378
Line 34... Line 34...
34
           mov cr0, ecx
34
           mov cr0, ecx
35
           fnsave [fpu_data]
35
           fnsave [fpu_data]
36
           ret
36
           ret
37
 
37
 
Line -... Line 38...
-
 
38
; param
-
 
39
;  eax= 512 bytes memory area
-
 
40
 
38
align 4
41
align 4
39
proc fpu_save
42
fpu_save:
-
 
43
           push ecx
-
 
44
           push esi
-
 
45
           push edi
-
 
46
 
-
 
47
           pushfd
-
 
48
           cli
-
 
49
 
40
           clts
50
           clts
-
 
51
           mov edi, eax
-
 
52
 
41
           mov ebx, [fpu_owner]
53
           mov ecx, [fpu_owner]
-
 
54
           mov eax, [CURRENT_TASK]
-
 
55
           cmp ecx, eax
-
 
56
           jne .save
-
 
57
.copy:
42
           shl ebx, 8
58
           shl eax, 8
43
           mov eax, [ebx+PROC_BASE+0x10]
59
           mov esi, [eax+PROC_BASE+APPDATA.fpu_state]
44
           mov ebx, [CURRENT_TASK]
60
           mov ecx, 512/4
-
 
61
           cld
-
 
62
           rep movsd
-
 
63
           fninit
-
 
64
 
-
 
65
           popfd
-
 
66
           pop edi
-
 
67
           pop esi
-
 
68
           pop ecx
-
 
69
           ret
-
 
70
.save:
45
           mov [fpu_owner], ebx
71
           mov [fpu_owner], eax
-
 
72
 
-
 
73
           shl ecx, 8
-
 
74
           mov ecx, [ecx+PROC_BASE+APPDATA.fpu_state]
Line 46... Line 75...
46
 
75
 
47
           bt [cpu_caps], CAPS_SSE
76
           bt [cpu_caps], CAPS_SSE
Line 48... Line 77...
48
           jnc .no_SSE
77
           jnc .no_SSE
49
 
-
 
50
           fxsave [eax]
78
 
51
           fninit            ;re-init fpu
79
           fxsave [ecx]
52
           ret
80
           jmp .copy
53
.no_SSE:
81
.no_SSE:
54
           fnsave [eax]
-
 
Line 55... Line 82...
55
           ret
82
           fnsave [ecx]
56
endp
83
           jmp .copy
-
 
84
 
-
 
85
align 4
-
 
86
fpu_restore:
-
 
87
           push ecx
-
 
88
           push esi
-
 
89
 
-
 
90
           mov esi, eax
-
 
91
 
-
 
92
           pushfd
57
 
93
           cli
58
align 4
94
 
59
proc fpu_restore
95
           mov ecx, [fpu_owner]
-
 
96
           mov eax, [CURRENT_TASK]
-
 
97
           cmp ecx, eax
-
 
98
           jne .copy
60
           mov ebx, [CURRENT_TASK]
99
 
61
           shl ebx, 8
100
           clts
Line 62... Line 101...
62
           mov eax, [ebx+PROC_BASE+0x10]
101
 
-
 
102
           bt [cpu_caps], CAPS_SSE
-
 
103
           jnc .no_SSE
-
 
104
 
63
           bt [cpu_caps], CAPS_SSE
105
           fxrstor [esi]
64
           jnc .no_SSE
106
           popfd
65
 
107
           pop esi
66
           fxrstor [eax]
108
           pop ecx
-
 
109
           ret
-
 
110
.no_SSE:
-
 
111
           fnclex               ;fix possible problems
-
 
112
           frstor [esi]
-
 
113
           popfd
-
 
114
           pop esi
-
 
115
           pop ecx
-
 
116
           ret
-
 
117
.copy:
-
 
118
           shl eax, 8
-
 
119
           mov edi, [eax+PROC_BASE+APPDATA.fpu_state]
-
 
120
           mov ecx, 512/4
-
 
121
           cld
67
           ret
122
           rep movsd
68
.no_SSE:
-
 
Line 69... Line 123...
69
           fnclex               ;fix possible problems
123
           popfd
70
           frstor [eax]
124
           pop esi
71
           ret
125
           pop ecx
72
endp
126
           ret