History log of /haiku/headers/private/kernel/arch/x86/64/cpu.h
Revision Date Author Comments
# c7360f4b 13-Nov-2023 Jérôme Duval <jerome.duval@gmail.com>

kernel/x86_64: on context switch, load defaults in fpu control and mxcsr

after a0131eaae2884fdced27158c3d34732d1656aca9 mxcsr was possibly also incorrect.
fpu control and mxcsr will be restored with fxrstor/xrstor.
no need to clear pending exceptions on #MF
fix #18656 (and #18624 after reverting).

Change-Id: I7dd5e2e4610747c5b82abd6c67e302d264b4be92
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7104
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 53e2dc0f 31-Oct-2023 Jérôme Duval <jerome.duval@gmail.com>

kernel/x86_64: clear any pending exceptions on #MF

* also on x86 for simplicity.
* fixes #18624
* also makes x87 FPU data registers available for x87 floating instructions. EMMS is cheap.
see https://github.com/cloudius-systems/osv/commit/25209d81f7b872111beb02ab9758f0d86898ec6b

Change-Id: I5c1b399377102f3eb10bc6d7f7247afbaf6d8483
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7089
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 396b7422 10-Sep-2014 Paweł Dziepak <pdziepak@quarnos.org>

kernel/x86_64: save fpu state at interrupts

The kernel is allowed to use fpu anywhere so we must make sure that
user state is not clobbered by saving fpu state at interrupt entry.
There is no need to do that in case of system calls since all fpu
data registers are caller saved.

We do not need, though, to save the whole fpu state at task swich
(again, thanks to calling convention). Only status and control
registers are preserved. This patch actually adds xmm0-15 register
to clobber list of task swich code, but the only reason of that is
to make sure that nothing bad happens inside the function that
executes that task swich. Inspection of the generated code shows
that no xmm registers are actually saved.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>


# 4b75a1e2 25-Aug-2014 Paweł Dziepak <pdziepak@quarnos.org>

kernel/x86_64: implement x86_swap_pgdir in C++

No reason not to inline this function.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>


# 76636769 06-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

kernel/x86_64: inline x86_{read, write}_msr()

This patch makes it possible to inline rdmsr and wrmsr instruction. The
performance impact shouldn't be significant since they are used relatively
rarely and wrmsr is usually a serializing instruction, but there is no reason
not to do so.


# 88e8e24c 06-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

kernel/x86_64: improve context switch implementation

The goal of this patch is to amortize the cost of context switch by making
the compiler aware that context switch clobbers all registers. Because all
register need to be saved anyway there is no additional cost of using
callee saved register in the function that does the context switch.


# 396b74228eefcf4bc21333e05c1909b8692d1b86 10-Sep-2014 Paweł Dziepak <pdziepak@quarnos.org>

kernel/x86_64: save fpu state at interrupts

The kernel is allowed to use fpu anywhere so we must make sure that
user state is not clobbered by saving fpu state at interrupt entry.
There is no need to do that in case of system calls since all fpu
data registers are caller saved.

We do not need, though, to save the whole fpu state at task swich
(again, thanks to calling convention). Only status and control
registers are preserved. This patch actually adds xmm0-15 register
to clobber list of task swich code, but the only reason of that is
to make sure that nothing bad happens inside the function that
executes that task swich. Inspection of the generated code shows
that no xmm registers are actually saved.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>


# 4b75a1e2377d5380d6bea4319fc8f1bc2f595665 25-Aug-2014 Paweł Dziepak <pdziepak@quarnos.org>

kernel/x86_64: implement x86_swap_pgdir in C++

No reason not to inline this function.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>


# 76636769bd9a53acbf21bbfd411f731d2ab51e49 06-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

kernel/x86_64: inline x86_{read, write}_msr()

This patch makes it possible to inline rdmsr and wrmsr instruction. The
performance impact shouldn't be significant since they are used relatively
rarely and wrmsr is usually a serializing instruction, but there is no reason
not to do so.


# 88e8e24c84aded0ff085aa93402c71862c5e4fe0 06-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

kernel/x86_64: improve context switch implementation

The goal of this patch is to amortize the cost of context switch by making
the compiler aware that context switch clobbers all registers. Because all
register need to be saved anyway there is no additional cost of using
callee saved register in the function that does the context switch.