1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-12 09:58:36 +00:00

Add support for saving and restoring kernel floating point state. The state

will be saved if we context switch as a result of an interrupt which occured
while using the floating point registers in the kernel (which actually can't
happen right now).  This allows fp disabled traps in the kernel, which
normally shouldn't happen, so make sure the trapping code is what we expect
it is.
This commit is contained in:
Jake Burkholder 2003-04-03 18:34:05 +00:00
parent 7dafcb6914
commit 937e05327e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113024
2 changed files with 45 additions and 1 deletions

View File

@ -1219,6 +1219,36 @@ ENTRY(tl1_insn_exceptn_trap)
mov %g2, %o0
END(tl1_insn_exceptn_trap)
.macro tl1_fp_disabled
ba,a %xcc, tl1_fp_disabled_1
nop
.align 32
.endm
ENTRY(tl1_fp_disabled_1)
rdpr %tpc, %g1
set fpu_fault_begin, %g2
sub %g1, %g2, %g1
cmp %g1, fpu_fault_size
bgeu,a,pn %xcc, 1f
nop
wr %g0, FPRS_FEF, %fprs
wr %g0, ASI_BLK_S, %asi
ldda [PCB_REG + PCB_KFP + (0 * 64)] %asi, %f0
ldda [PCB_REG + PCB_KFP + (1 * 64)] %asi, %f16
ldda [PCB_REG + PCB_KFP + (2 * 64)] %asi, %f32
ldda [PCB_REG + PCB_KFP + (3 * 64)] %asi, %f48
membar #Sync
retry
1: tl1_split
clr %o1
set trap, %o2
ba %xcc, tl1_trap
mov T_FP_DISABLED | T_KERNEL, %o0
END(tl1_fp_disabled_1)
.macro tl1_data_excptn
wrpr %g0, PSTATE_ALT, %pstate
b,a %xcc, tl1_data_excptn_trap
@ -1913,7 +1943,7 @@ tl1_priv_opcode:
tl1_gen T_PRIVILEGED_OPCODE ! 0x211
tl1_reserved 14 ! 0x212-0x21f
tl1_fp_disabled:
tl1_gen T_FP_DISABLED ! 0x220
tl1_fp_disabled ! 0x220
tl1_fp_ieee:
tl1_gen T_FP_EXCEPTION_IEEE_754 ! 0x221
tl1_fp_other:

View File

@ -53,6 +53,20 @@ ENTRY(cpu_switch)
save %sp, -CCFSZ, %sp
mov %i1, %i0
/*
* If the current thread was using floating point in the kernel, save
* its context. The userland floating point context has already been
* saved.
*/
rd %fprs, %l2
andcc %l2, FPRS_FEF, %g0
bz,a,pt %xcc, 1f
nop
call savefpctx
add PCB_REG, PCB_KFP, %o0
ba,a %xcc, 2f
nop
/*
* If the current thread was using floating point in userland, save
* its context.