Rev 8869 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8869 | Rev 9715 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 8869 $ |
8 | $Revision: 9715 $ |
9 | 9 | ||
10 | 10 | ||
Line 175... | Line 175... | ||
175 | call save_fpu_context |
175 | call save_fpu_context |
176 | jmp .exit |
176 | jmp .exit |
177 | .save: |
177 | .save: |
178 | mov [fpu_owner], esi |
178 | mov [fpu_owner], esi |
Line 179... | Line 179... | ||
179 | 179 | ||
180 | shl ecx, 8 |
180 | shl ecx, BSF sizeof.APPDATA |
Line 181... | Line 181... | ||
181 | mov eax, [ecx+SLOT_BASE+APPDATA.fpu_state] |
181 | mov eax, [SLOT_BASE + ecx + APPDATA.fpu_state] |
Line 182... | Line 182... | ||
182 | 182 | ||
183 | call save_context |
183 | call save_context |
184 | 184 | ||
185 | ; first 512 bytes of XSAVE area have the same format as FXSAVE |
185 | ; first 512 bytes of XSAVE area have the same format as FXSAVE |
186 | shl esi, 8 |
186 | shl esi, BSF sizeof.APPDATA |
187 | mov esi, [esi+SLOT_BASE+APPDATA.fpu_state] |
187 | mov esi, [SLOT_BASE + esi + APPDATA.fpu_state] |
188 | mov ecx, 512/4 |
188 | mov ecx, 512/4 |
189 | cld |
189 | cld |
Line 223... | Line 223... | ||
223 | call save_context |
223 | call save_context |
224 | jmp .exit |
224 | jmp .exit |
225 | .save: |
225 | .save: |
226 | mov [fpu_owner], esi |
226 | mov [fpu_owner], esi |
Line 227... | Line 227... | ||
227 | 227 | ||
228 | shl ecx, 8 |
228 | shl ecx, BSF sizeof.APPDATA |
Line 229... | Line 229... | ||
229 | mov eax, [ecx+SLOT_BASE+APPDATA.fpu_state] |
229 | mov eax, [SLOT_BASE + ecx + APPDATA.fpu_state] |
Line 230... | Line 230... | ||
230 | 230 | ||
231 | call save_context |
231 | call save_context |
232 | 232 | ||
233 | shl esi, 8 |
233 | shl esi, BSF sizeof.APPDATA |
234 | mov esi, [esi+SLOT_BASE+APPDATA.fpu_state] |
234 | mov esi, [SLOT_BASE + esi + APPDATA.fpu_state] |
235 | mov ecx, [xsave_area_size] |
235 | mov ecx, [xsave_area_size] |
236 | add ecx, 3 |
236 | add ecx, 3 |
Line 295... | Line 295... | ||
295 | popfd |
295 | popfd |
296 | pop esi |
296 | pop esi |
297 | pop ecx |
297 | pop ecx |
298 | ret |
298 | ret |
299 | .copy: |
299 | .copy: |
300 | shl eax, 8 |
300 | shl eax, BSF sizeof.APPDATA |
301 | mov edi, [eax+SLOT_BASE+APPDATA.fpu_state] |
301 | mov edi, [SLOT_BASE + eax + APPDATA.fpu_state] |
302 | mov ecx, 512/4 |
302 | mov ecx, 512/4 |
303 | cld |
303 | cld |
304 | rep movsd |
304 | rep movsd |
305 | popfd |
305 | popfd |
306 | pop esi |
306 | pop esi |
Line 349... | Line 349... | ||
349 | popfd |
349 | popfd |
350 | pop esi |
350 | pop esi |
351 | pop ecx |
351 | pop ecx |
352 | ret |
352 | ret |
353 | .copy: |
353 | .copy: |
354 | shl eax, 8 |
354 | shl eax, BSF sizeof.APPDATA |
355 | mov edi, [eax+SLOT_BASE+APPDATA.fpu_state] |
355 | mov edi, [SLOT_BASE + eax + APPDATA.fpu_state] |
356 | mov ecx, [xsave_area_size] |
356 | mov ecx, [xsave_area_size] |
357 | add ecx, 3 |
357 | add ecx, 3 |
358 | shr ecx, 2 |
358 | shr ecx, 2 |
359 | cld |
359 | cld |
360 | rep movsd |
360 | rep movsd |
Line 373... | Line 373... | ||
373 | 373 | ||
374 | mov ebx, [fpu_owner] |
374 | mov ebx, [fpu_owner] |
375 | cmp ebx, [current_slot_idx] |
375 | cmp ebx, [current_slot_idx] |
Line 376... | Line 376... | ||
376 | je .exit |
376 | je .exit |
377 | 377 | ||
378 | shl ebx, 8 |
378 | shl ebx, BSF sizeof.APPDATA |
379 | mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state] |
379 | mov eax, [SLOT_BASE + ebx + APPDATA.fpu_state] |
380 | bt [cpu_caps+(CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32 |
380 | bt [cpu_caps + (CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32 |
381 | jnc .no_xsave |
381 | jnc .no_xsave |
382 | mov ecx, eax |
382 | mov ecx, eax |
383 | mov eax, [xsave_eax] |
383 | mov eax, [xsave_eax] |
384 | mov edx, [xsave_edx] |
384 | mov edx, [xsave_edx] |
385 | xsave [ecx] |
385 | xsave [ecx] |
386 | mov ebx, [current_slot_idx] |
386 | mov ebx, [current_slot_idx] |
387 | mov [fpu_owner], ebx |
387 | mov [fpu_owner], ebx |
388 | shl ebx, 8 |
388 | shl ebx, BSF sizeof.APPDATA |
389 | mov ecx, [ebx+SLOT_BASE+APPDATA.fpu_state] |
389 | mov ecx, [SLOT_BASE + ebx + APPDATA.fpu_state] |
390 | xrstor [ecx] |
390 | xrstor [ecx] |
391 | .exit: |
391 | .exit: |
392 | restore_ring3_context |
392 | restore_ring3_context |
Line 396... | Line 396... | ||
396 | jnc .no_SSE |
396 | jnc .no_SSE |
Line 397... | Line 397... | ||
397 | 397 | ||
398 | fxsave [eax] |
398 | fxsave [eax] |
399 | mov ebx, [current_slot_idx] |
399 | mov ebx, [current_slot_idx] |
400 | mov [fpu_owner], ebx |
400 | mov [fpu_owner], ebx |
401 | shl ebx, 8 |
401 | shl ebx, BSF sizeof.APPDATA |
402 | mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state] |
402 | mov eax, [SLOT_BASE + ebx + APPDATA.fpu_state] |
403 | fxrstor [eax] |
403 | fxrstor [eax] |
404 | restore_ring3_context |
404 | restore_ring3_context |
Line 405... | Line 405... | ||
405 | iret |
405 | iret |
406 | 406 | ||
407 | .no_SSE: |
407 | .no_SSE: |
408 | fnsave [eax] |
408 | fnsave [eax] |
409 | mov ebx, [current_slot_idx] |
409 | mov ebx, [current_slot_idx] |
410 | mov [fpu_owner], ebx |
410 | mov [fpu_owner], ebx |
411 | shl ebx, 8 |
411 | shl ebx, BSF sizeof.APPDATA |
412 | mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state] |
412 | mov eax, [SLOT_BASE + ebx + APPDATA.fpu_state] |
413 | frstor [eax] |
413 | frstor [eax] |
Line 414... | Line 414... | ||
414 | restore_ring3_context |
414 | restore_ring3_context |