All of lore.kernel.org
 help / color / mirror / Atom feed
* math_state_restore() question
@ 2005-08-17  7:58 Hiro Yoshioka
  2005-08-17  8:07 ` Hirokazu Takahashi
  0 siblings, 1 reply; 4+ messages in thread
From: Hiro Yoshioka @ 2005-08-17  7:58 UTC (permalink / raw)
  To: linux-kernel

Hi,

I have a quick question.

The math_state_restore() restores the FPU/MMX/XMM states.
However where do we save the previous task's states if it is necessary?

asmlinkage void math_state_restore(struct pt_regs regs)
{
        struct thread_info *thread = current_thread_info();
        struct task_struct *tsk = thread->task;

        clts();         /* Allow maths ops (or we recurse) */
        if (!tsk_used_math(tsk))
                init_fpu(tsk);
        restore_fpu(tsk);
        thread->status |= TS_USEDFPU;   /* So we fnsave on switch_to() */
}

Thanks in advance,
  Hiro
-- 
Hiro Yoshioka
mailto:hyoshiok at miraclelinux.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: math_state_restore() question
  2005-08-17  7:58 math_state_restore() question Hiro Yoshioka
@ 2005-08-17  8:07 ` Hirokazu Takahashi
  2005-08-17  8:42   ` Hiro Yoshioka
  0 siblings, 1 reply; 4+ messages in thread
From: Hirokazu Takahashi @ 2005-08-17  8:07 UTC (permalink / raw)
  To: hyoshiok, lkml.hyoshiok; +Cc: linux-kernel

Hi,

Just take a look at __switch_to(), where __unlazy_fpu() is called.

> Hi,
> 
> I have a quick question.
> 
> The math_state_restore() restores the FPU/MMX/XMM states.
> However where do we save the previous task's states if it is necessary?
> 
> asmlinkage void math_state_restore(struct pt_regs regs)
> {
>         struct thread_info *thread = current_thread_info();
>         struct task_struct *tsk = thread->task;
> 
>         clts();         /* Allow maths ops (or we recurse) */
>         if (!tsk_used_math(tsk))
>                 init_fpu(tsk);
>         restore_fpu(tsk);
>         thread->status |= TS_USEDFPU;   /* So we fnsave on switch_to() */
> }
> 
> Thanks in advance,
>   Hiro
> -- 
> Hiro Yoshioka
> mailto:hyoshiok at miraclelinux.com
> -



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: math_state_restore() question
  2005-08-17  8:07 ` Hirokazu Takahashi
@ 2005-08-17  8:42   ` Hiro Yoshioka
  2005-08-17 15:18     ` Akira Tsukamoto
  0 siblings, 1 reply; 4+ messages in thread
From: Hiro Yoshioka @ 2005-08-17  8:42 UTC (permalink / raw)
  To: taka; +Cc: lkml.hyoshiok, linux-kernel, hyoshiok

> Just take a look at __switch_to(), where __unlazy_fpu() is called.

Thanks. Does an exception handler (like page_fault, etc) come 
from __switch_to()?

Regards,
  Hiro

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: math_state_restore() question
  2005-08-17  8:42   ` Hiro Yoshioka
@ 2005-08-17 15:18     ` Akira Tsukamoto
  0 siblings, 0 replies; 4+ messages in thread
From: Akira Tsukamoto @ 2005-08-17 15:18 UTC (permalink / raw)
  To: Hiro Yoshioka; +Cc: taka, lkml.hyoshiok, linux-kernel


On Wed, 17 Aug 2005 17:42:22 +0900 (JST)
Hiro Yoshioka <hyoshiok@miraclelinux.com> mentioned:
> > Just take a look at __switch_to(), where __unlazy_fpu() is called.
> 
> Thanks. Does an exception handler (like page_fault, etc) come 
> from __switch_to()?

No, page_fault is generated when the location of memory access(virtual) 
does not have physical memory.

If you have a code like this,
   movq   (%%esi), %%mm0
a page of address %%esi might be swapped out already and might not 
have any physical memory page allocated.


-- 
Akira Tsukamoto <akira-t@suna-asobi.com, at541@columbia.edu>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-08-17 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-17  7:58 math_state_restore() question Hiro Yoshioka
2005-08-17  8:07 ` Hirokazu Takahashi
2005-08-17  8:42   ` Hiro Yoshioka
2005-08-17 15:18     ` Akira Tsukamoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.