Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/i386 x86: Add kthread_fpu_enter/exit support, ...
details: https://anonhg.NetBSD.org/src/rev/6e8cc92235d3
branches: trunk
changeset: 373751:6e8cc92235d3
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat Feb 25 18:35:54 2023 +0000
description:
x86: Add kthread_fpu_enter/exit support, take two -- forgot i386 bits.
diffstat:
sys/arch/i386/i386/genassym.cf | 3 ++-
sys/arch/i386/i386/locore.S | 21 ++++++++++++++++++---
2 files changed, 20 insertions(+), 4 deletions(-)
diffs (66 lines):
diff -r 27be365a49ea -r 6e8cc92235d3 sys/arch/i386/i386/genassym.cf
--- a/sys/arch/i386/i386/genassym.cf Sat Feb 25 18:28:57 2023 +0000
+++ b/sys/arch/i386/i386/genassym.cf Sat Feb 25 18:35:54 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.131 2022/12/27 08:40:40 msaitoh Exp $
+# $NetBSD: genassym.cf,v 1.132 2023/02/25 18:35:54 riastradh Exp $
#
# Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -175,6 +175,7 @@
define L_MD_ASTPENDING offsetof(struct lwp, l_md.md_astpending)
define LW_SYSTEM LW_SYSTEM
+define LW_SYSTEM_FPU LW_SYSTEM_FPU
define MDL_FPU_IN_CPU MDL_FPU_IN_CPU
define P_FLAG offsetof(struct proc, p_flag)
diff -r 27be365a49ea -r 6e8cc92235d3 sys/arch/i386/i386/locore.S
--- a/sys/arch/i386/i386/locore.S Sat Feb 25 18:28:57 2023 +0000
+++ b/sys/arch/i386/i386/locore.S Sat Feb 25 18:35:54 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.191 2023/02/03 09:21:58 mlelstv Exp $ */
+/* $NetBSD: locore.S,v 1.192 2023/02/25 18:35:54 riastradh Exp $ */
/*
* Copyright-o-rama!
@@ -128,7 +128,7 @@
*/
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.191 2023/02/03 09:21:58 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.192 2023/02/25 18:35:54 riastradh Exp $");
#include "opt_copy_symtab.h"
#include "opt_ddb.h"
@@ -1447,7 +1447,7 @@
/* Don't bother with the rest if switching to a system process. */
testl $LW_SYSTEM,L_FLAG(%edi)
- jnz switch_return
+ jnz .Lswitch_system
#ifndef XENPV
/* Restore thread-private %fs/%gs descriptors. */
@@ -1501,6 +1501,21 @@
popl %ebx
ret
+.Lswitch_system:
+ /*
+ * If it has LWP_SYSTEM_FPU set, meaning it's running in
+ * kthread_fpu_enter/exit, we need to restore the FPU state
+ * and enable FPU instructions with fpu_handle_deferred.
+ *
+ * No need to test MDL_FPU_IN_CPU via HANDLE_DEFERRED_FPU --
+ * fpu_switch guarantees it is clear, so we can just call
+ * fpu_handle_deferred unconditionally.
+ */
+ testl $LW_SYSTEM_FPU,L_FLAG(%edi)
+ jz switch_return
+ call _C_LABEL(fpu_handle_deferred)
+ jmp switch_return
+
.Lcopy_iobitmap:
/* Copy I/O bitmap. */
incl _C_LABEL(pmap_iobmp_evcnt)+EV_COUNT
Home |
Main Index |
Thread Index |
Old Index