Skip to content

Maybe need to reset fpu state after saving it #1019

@nyh

Description

@nyh

This issue was created due to a thought experiment - I don't have evidence that it leads to an actual bug.

When OSv code runs in the middle of some user code, e.g., interrupt handling, we use fpu_lock() to save the user code's FPU state so we can restore it later. However, after the kernel saves the FPU state, it doesn't attempt to clear it. The kernel, which needs to do FPU calculations (e.g., in the scheduler), might inherit weird control bits or a full FPU stack, and misbehave.

I think maybe after saving the FPU state, we should run the FNINIT instruction, or our fpu_init() function (which also resets the sse control register).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions