summaryrefslogtreecommitdiff
path: root/sys/powerpc/include
diff options
context:
space:
mode:
authorShawn Anastasio <sanastasio@raptorengineering.com>2023-09-17 14:40:48 +0000
committerAlfredo Dal'Ava Junior <alfredo@FreeBSD.org>2023-11-19 20:55:24 +0000
commit91e53779b4fc39e755a03190f785ce0cf3f83eb7 (patch)
tree21455ac1c9572355018803830f4ef8070269b0cb /sys/powerpc/include
parent4595a9e9af827db03b293a9aed72618bc285f54f (diff)
Diffstat (limited to 'sys/powerpc/include')
-rw-r--r--sys/powerpc/include/altivec.h2
-rw-r--r--sys/powerpc/include/fpu.h20
-rw-r--r--sys/powerpc/include/pcb.h7
3 files changed, 27 insertions, 2 deletions
diff --git a/sys/powerpc/include/altivec.h b/sys/powerpc/include/altivec.h
index 581a568b7034..e5151529f698 100644
--- a/sys/powerpc/include/altivec.h
+++ b/sys/powerpc/include/altivec.h
@@ -35,5 +35,7 @@
void enable_vec(struct thread *);
void save_vec(struct thread *);
void save_vec_nodrop(struct thread *);
+void enable_vec_kern(void);
+void disable_vec(struct thread *td);
#endif /* _MACHINE_ALTIVEC_H_ */
diff --git a/sys/powerpc/include/fpu.h b/sys/powerpc/include/fpu.h
index 30df3a470b09..aa5640ea31fb 100644
--- a/sys/powerpc/include/fpu.h
+++ b/sys/powerpc/include/fpu.h
@@ -76,6 +76,26 @@ void save_fpu(struct thread *);
void save_fpu_nodrop(struct thread *);
void cleanup_fpscr(void);
u_int get_fpu_exception(struct thread *);
+void enable_fpu_kern(void);
+void disable_fpu(struct thread *td);
+
+/*
+ * Flags for fpu_kern_alloc_ctx(), fpu_kern_enter() and fpu_kern_thread().
+ */
+#define FPU_KERN_NORMAL 0x0000
+#define FPU_KERN_NOWAIT 0x0001
+#define FPU_KERN_KTHR 0x0002
+#define FPU_KERN_NOCTX 0x0004
+
+struct fpu_kern_ctx;
+
+struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags);
+void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx);
+void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx,
+ u_int flags);
+int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx);
+int fpu_kern_thread(u_int flags);
+int is_fpu_kern_thread(u_int flags);
#endif /* _KERNEL */
diff --git a/sys/powerpc/include/pcb.h b/sys/powerpc/include/pcb.h
index e5e6e3223406..050ada6b0f64 100644
--- a/sys/powerpc/include/pcb.h
+++ b/sys/powerpc/include/pcb.h
@@ -48,7 +48,7 @@ struct pcb {
register_t pcb_toc; /* toc pointer */
register_t pcb_lr; /* link register */
register_t pcb_dscr; /* dscr value */
- register_t pcb_fscr;
+ register_t pcb_fscr;
register_t pcb_tar;
struct pmap *pcb_pm; /* pmap of our vmspace */
jmp_buf *pcb_onfault; /* For use during
@@ -56,11 +56,14 @@ struct pcb {
int pcb_flags;
#define PCB_FPU 0x1 /* Process uses FPU */
#define PCB_FPREGS 0x2 /* Process had FPU registers initialized */
-#define PCB_VEC 0x4 /* Process had Altivec initialized */
+#define PCB_VEC 0x4 /* Process uses Altivec */
#define PCB_VSX 0x8 /* Process had VSX initialized */
#define PCB_CDSCR 0x10 /* Process had Custom DSCR initialized */
#define PCB_HTM 0x20 /* Process had HTM initialized */
#define PCB_CFSCR 0x40 /* Process had FSCR updated */
+#define PCB_KERN_FPU 0x80 /* Kernel is using FPU/Vector unit */
+#define PCB_KERN_FPU_NOSAVE 0x100 /* FPU/Vec state not saved for kernel use */
+#define PCB_VECREGS 0x200 /* Process had Altivec registers initialized */
struct fpu {
union {
#if _BYTE_ORDER == _BIG_ENDIAN