From 16b20de9541fa482c901b531bd6a49782e0dd12a Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Mon, 21 Apr 2008 19:19:15 +0000 Subject: [PATCH] optimizing switching of the FPU context git-svn-id: svn://kolibrios.org@794 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/sched.inc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/kernel/trunk/core/sched.inc b/kernel/trunk/core/sched.inc index 1f61f57405..5020343505 100644 --- a/kernel/trunk/core/sched.inc +++ b/kernel/trunk/core/sched.inc @@ -232,11 +232,17 @@ do_change_task: ; mov [tss._esp0], eax mov ax, graph_data mov gs, ax - mov ecx, cr0 - or ecx, CR0_TS ;set task switch flag - mov cr0, ecx - inc [context_counter] ;noname & halyavin + mov eax, [CURRENT_TASK] + cmp eax, [fpu_owner] + clts ;clear a task switch flag + je @F + ;and set it again if the owner + mov ecx, cr0 ;of a fpu has changed + or ecx, CR0_TS + mov cr0, ecx +@@: + inc [context_counter] ;noname & halyavin test [ebx+APPDATA.dbg_state], 1 jnz @F ret