Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7168 → Rev 7167

/kernel/trunk/core/fpu.inc
12,7 → 12,7
clts
fninit
 
bt [cpu_caps+(CAPS_XSAVE/32)], CAPS_XSAVE mod 32
bt [cpu_caps+(CAPS_XSAVE/8)], CAPS_XSAVE mod 8
jnc .no_xsave
 
mov ecx, cr4
136,7 → 136,7
ret
 
; param
; eax= 512 bytes memory area aligned on a 16-byte boundary
; eax= 512 bytes memory area
 
align 4
fpu_save:
155,7 → 155,7
cmp ecx, esi
jne .save
 
call save_fpu_context
call save_context
jmp .exit
.save:
mov [fpu_owner], esi
165,7 → 165,6
 
call save_context
 
; first 512 bytes of XSAVE area have the same format as FXSAVE
shl esi, 8
mov esi, [esi+SLOT_BASE+APPDATA.fpu_state]
mov ecx, 512/4
179,62 → 178,16
pop ecx
ret
 
avx_save_size:
mov eax, [xsave_area_size]
ret
 
; param
; eax= avx_save_size() bytes memory area aligned on a 64-byte boundary
 
avx_save:
push ecx
push esi
push edi
 
pushfd
cli
 
clts
mov edi, eax
 
mov ecx, [fpu_owner]
mov esi, [CURRENT_TASK]
cmp ecx, esi
jne .save
 
call save_context
jmp .exit
.save:
mov [fpu_owner], esi
 
shl ecx, 8
mov eax, [ecx+SLOT_BASE+APPDATA.fpu_state]
 
call save_context
 
shl esi, 8
mov esi, [esi+SLOT_BASE+APPDATA.fpu_state]
mov ecx, [xsave_area_size]
add ecx, 3
shr ecx, 2
rep movsd
fninit
.exit:
popfd
pop edi
pop esi
pop ecx
ret
 
align 4
save_context:
bt [cpu_caps+(CAPS_OSXSAVE/32)], CAPS_OSXSAVE mod 32
jnc save_fpu_context
bt [cpu_caps+(CAPS_OSXSAVE/8)], CAPS_OSXSAVE mod 8
jnc .no_xsave
xsave [eax]
ret
save_fpu_context:
.no_xsave:
bt [cpu_caps], CAPS_SSE
jnc .no_SSE
 
fxsave [eax]
ret
.no_SSE:
241,7 → 194,6
fnsave [eax]
ret
 
 
align 4
fpu_restore:
push ecx
258,48 → 210,7
jne .copy
 
clts
bt [cpu_caps], CAPS_SSE
jnc .no_SSE
 
fxrstor [esi]
popfd
pop esi
pop ecx
ret
.no_SSE:
fnclex ;fix possible problems
frstor [esi]
popfd
pop esi
pop ecx
ret
.copy:
shl eax, 8
mov edi, [eax+SLOT_BASE+APPDATA.fpu_state]
mov ecx, 512/4
cld
rep movsd
popfd
pop esi
pop ecx
ret
 
avx_restore:
push ecx
push esi
 
mov esi, eax
 
pushfd
cli
 
mov ecx, [fpu_owner]
mov eax, [CURRENT_TASK]
cmp ecx, eax
jne .copy
 
clts
bt [cpu_caps+(CAPS_OSXSAVE/32)], CAPS_OSXSAVE mod 32
bt [cpu_caps+(CAPS_OSXSAVE/8)], CAPS_OSXSAVE mod 8
jnc .no_xsave
xrstor [esi]
popfd
325,9 → 236,7
.copy:
shl eax, 8
mov edi, [eax+SLOT_BASE+APPDATA.fpu_state]
mov ecx, [xsave_area_size]
add ecx, 3
shr ecx, 2
mov ecx, 512/4
cld
rep movsd
popfd
349,18 → 258,6
 
shl ebx, 8
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
bt [cpu_caps+(CAPS_OSXSAVE/32)], CAPS_OSXSAVE mod 32
jnc .no_xsave
xsave [eax]
mov ebx, [CURRENT_TASK]
mov [fpu_owner], ebx
shl ebx, 8
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
xrstor [eax]
.exit:
restore_ring3_context
iret
.no_xsave:
bt [cpu_caps], CAPS_SSE
jnc .no_SSE
 
370,6 → 267,7
shl ebx, 8
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
fxrstor [eax]
.exit:
restore_ring3_context
iret
 
/kernel/trunk/core/exports.inc
91,9 → 91,6
srv_handler, 'ServiceHandler', \
fpu_save, 'FpuSave', \
fpu_restore, 'FpuRestore', \
avx_save_size, 'AvxSaveSize', \
avx_save, 'AvxSave', \
avx_restore, 'AvxRestore', \
r_f_port_area, 'ReservePortArea', \
boot_log, 'Boot_Log', \
\