From 43e84d7672fd2d8b68d629397f29366577413ead Mon Sep 17 00:00:00 2001 From: CleverMouse Date: Mon, 19 Feb 2018 16:35:45 +0000 Subject: [PATCH] fix FPU after r7124 for other CPU configurations git-svn-id: svn://kolibrios.org@7165 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/fpu.inc | 4 ++++ kernel/trunk/core/taskman.inc | 4 +++- kernel/trunk/data32.inc | 3 ++- kernel/trunk/kernel.asm | 5 +++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/kernel/trunk/core/fpu.inc b/kernel/trunk/core/fpu.inc index a77ff73984..8687a7bce0 100644 --- a/kernel/trunk/core/fpu.inc +++ b/kernel/trunk/core/fpu.inc @@ -34,15 +34,19 @@ init_fpu: xor ecx, ecx cpuid mov [xsave_area_size], ebx + cmp ebx, fpu_data_size + ja $ test eax, XCR0_AVX512 jz @f call init_avx512 + xsave [fpu_data] ret @@: test eax, XCR0_AVX jz @f call init_avx + xsave [fpu_data] ret @@: test eax, XCR0_SSE diff --git a/kernel/trunk/core/taskman.inc b/kernel/trunk/core/taskman.inc index 5a2c60a28a..73e1d6b85f 100644 --- a/kernel/trunk/core/taskman.inc +++ b/kernel/trunk/core/taskman.inc @@ -924,7 +924,9 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword mov [eax+SLOT_BASE+APPDATA.io_map+4], ecx mov esi, fpu_data - mov ecx, 512/4 + mov ecx, [xsave_area_size] + add ecx, 3 + shr ecx, 2 rep movsd cmp ebx, [TASK_COUNT] diff --git a/kernel/trunk/data32.inc b/kernel/trunk/data32.inc index 6efaa3993d..2ac5ae4e9b 100644 --- a/kernel/trunk/data32.inc +++ b/kernel/trunk/data32.inc @@ -336,7 +336,8 @@ align 16 cur_saved_data: rb 4096 fpu_data: - rb 512 + rb 1024 +fpu_data_size = $ - fpu_data draw_data: rb 32*256 BPSLine_calc_area rd 1440 diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 02d3ff7bd0..3aaa66b68d 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -1116,8 +1116,9 @@ proc setup_os_slot mov dword [edx+APPDATA.terminate_protection], 1 ; make unkillable mov esi, fpu_data - mov ecx, 512/4 - cld + mov ecx, [xsave_area_size] + add ecx, 3 + shr ecx, 2 rep movsd lea eax, [edx+APP_OBJ_OFFSET]