Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpkern Define kthread_fpu_enter/exit for ...
details: https://anonhg.NetBSD.org/src/rev/e86d9d7a3d3b
branches: trunk
changeset: 936696:e86d9d7a3d3b
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat Aug 01 22:30:57 2020 +0000
description:
Define kthread_fpu_enter/exit for rump.
XXX Not 100% sure that it's safe to touch curlwp->l_flag in this
context, but this change will make progress, at least.
diffstat:
sys/rump/librump/rumpkern/threads.c | 30 ++++++++++++++++++++++++++++--
1 files changed, 28 insertions(+), 2 deletions(-)
diffs (51 lines):
diff -r 9c687fe375c9 -r e86d9d7a3d3b sys/rump/librump/rumpkern/threads.c
--- a/sys/rump/librump/rumpkern/threads.c Sat Aug 01 21:51:22 2020 +0000
+++ b/sys/rump/librump/rumpkern/threads.c Sat Aug 01 22:30:57 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: threads.c,v 1.26 2017/04/21 19:16:10 kamil Exp $ */
+/* $NetBSD: threads.c,v 1.27 2020/08/01 22:30:57 riastradh Exp $ */
/*
* Copyright (c) 2007-2009 Antti Kantee. All Rights Reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: threads.c,v 1.26 2017/04/21 19:16:10 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: threads.c,v 1.27 2020/08/01 22:30:57 riastradh Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -247,6 +247,32 @@
return rv;
}
+int
+kthread_fpu_enter(void)
+{
+ struct lwp *l = curlwp;
+ int s;
+
+ KASSERTMSG(l->l_flag & LW_SYSTEM,
+ "%s is allowed only in kthreads", __func__);
+ s = l->l_flag & LW_SYSTEM_FPU;
+ l->l_flag |= LW_SYSTEM_FPU;
+
+ return s;
+}
+
+void
+kthread_fpu_exit(int s)
+{
+ struct lwp *l = curlwp;
+
+ KASSERT(s == (s & LW_SYSTEM_FPU));
+ KASSERTMSG(l->l_flag & LW_SYSTEM,
+ "%s is allowed only in kthreads", __func__);
+ KASSERT(l->l_flag & LW_SYSTEM_FPU);
+ l->l_flag ^= s ^ LW_SYSTEM_FPU;
+}
+
/*
* Create a non-kernel thread that is scheduled by a rump kernel hypercall.
*
Home |
Main Index |
Thread Index |
Old Index