Skip to contentSkip to conversation

math_state_restore() question

DISCUSSION Hiro Yoshioka 4 participants 4 messages Aug 17, 2005

lore
Share & tools
lore
#0 lore raw

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

Signature · 2 lines
Hiro Yoshioka
mailto:hyoshiok at miraclelinux.com
#1 lore raw

Hi,

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

Quoted 25 lines

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

Signature · 3 lines
Hiro Yoshioka
mailto:hyoshiok at miraclelinux.com
-
#2 lore raw
Quoted 1 line

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

#3 lore raw

On Wed, 17 Aug 2005 17:42:22 +0900 (JST) Hiro Yoshioka <[email protected]> mentioned:

Quoted 4 lines
Quoted 1 line

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.

Signature · 1 line
Akira Tsukamoto <[email protected], [email protected]>