/*-1* SPDX-License-Identifier: BSD-4-Clause2*3* Copyright (C) 1996 Wolfgang Solfrank.4* Copyright (C) 1996 TooLs GmbH.5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15* 3. All advertising materials mentioning features or use of this software16* must display the following acknowledgement:17* This product includes software developed by TooLs GmbH.18* 4. The name of TooLs GmbH may not be used to endorse or promote products19* derived from this software without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR22* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES23* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.24* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,25* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,26* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;27* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,28* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR29* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF30* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.31*32* $NetBSD: fpu.h,v 1.2 1999/12/07 15:14:56 danw Exp $33*/3435#ifndef _MACHINE_FPU_H_36#define _MACHINE_FPU_H_3738#define FPSCR_FX 0x8000000039#define FPSCR_FEX 0x4000000040#define FPSCR_VX 0x2000000041#define FPSCR_OX 0x1000000042#define FPSCR_UX 0x0800000043#define FPSCR_ZX 0x0400000044#define FPSCR_XX 0x0200000045#define FPSCR_VXSNAN 0x0100000046#define FPSCR_VXISI 0x0080000047#define FPSCR_VXIDI 0x0040000048#define FPSCR_VXZDZ 0x0020000049#define FPSCR_VXIMZ 0x0010000050#define FPSCR_VXVC 0x0008000051#define FPSCR_FR 0x0004000052#define FPSCR_FI 0x0002000053#define FPSCR_FPRF 0x0001f00054#define FPSCR_C 0x0001000055#define FPSCR_FPCC 0x0000f00056#define FPSCR_FL 0x0000800057#define FPSCR_FG 0x0000400058#define FPSCR_FE 0x0000200059#define FPSCR_FU 0x0000100060#define FPSCR_VXSOFT 0x0000040061#define FPSCR_VXSQRT 0x0000020062#define FPSCR_VXCVI 0x0000010063#define FPSCR_VE 0x0000008064#define FPSCR_OE 0x0000004065#define FPSCR_UE 0x0000002066#define FPSCR_ZE 0x0000001067#define FPSCR_XE 0x0000000868#define FPSCR_NI 0x0000000469#define FPSCR_RN 0x000000037071#ifdef _KERNEL7273void enable_fpu(struct thread *);74void save_fpu(struct thread *);75void save_fpu_nodrop(struct thread *);76void cleanup_fpscr(void);77u_int get_fpu_exception(struct thread *);78void enable_fpu_kern(void);79void disable_fpu(struct thread *td);8081/*82* Flags for fpu_kern_alloc_ctx(), fpu_kern_enter() and fpu_kern_thread().83*/84#define FPU_KERN_NORMAL 0x000085#define FPU_KERN_NOWAIT 0x000186#define FPU_KERN_KTHR 0x000287#define FPU_KERN_NOCTX 0x00048889struct fpu_kern_ctx;9091struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags);92void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx);93void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx,94u_int flags);95int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx);96int fpu_kern_thread(u_int flags);97int is_fpu_kern_thread(u_int flags);9899#endif /* _KERNEL */100101#endif /* _MACHINE_FPU_H_ */102103104