14Srgrimes/*-
24Srgrimes * Copyright (c) 1990 The Regents of the University of California.
34Srgrimes * All rights reserved.
44Srgrimes *
54Srgrimes * This code is derived from software contributed to Berkeley by
64Srgrimes * William Jolitz.
74Srgrimes *
84Srgrimes * Redistribution and use in source and binary forms, with or without
94Srgrimes * modification, are permitted provided that the following conditions
104Srgrimes * are met:
114Srgrimes * 1. Redistributions of source code must retain the above copyright
124Srgrimes *    notice, this list of conditions and the following disclaimer.
134Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
144Srgrimes *    notice, this list of conditions and the following disclaimer in the
154Srgrimes *    documentation and/or other materials provided with the distribution.
164Srgrimes * 4. Neither the name of the University nor the names of its contributors
174Srgrimes *    may be used to endorse or promote products derived from this software
184Srgrimes *    without specific prior written permission.
194Srgrimes *
204Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
214Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
224Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
234Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
244Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
254Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
264Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
274Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
284Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
294Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
304Srgrimes * SUCH DAMAGE.
314Srgrimes *
32621Srgrimes *	from: @(#)npx.h	5.3 (Berkeley) 1/18/91
3350477Speter * $FreeBSD$
344Srgrimes */
354Srgrimes
364Srgrimes/*
374Srgrimes * 287/387 NPX Coprocessor Data Structures and Constants
384Srgrimes * W. Jolitz 1/90
394Srgrimes */
404Srgrimes
414175Sbde#ifndef _MACHINE_NPX_H_
424175Sbde#define	_MACHINE_NPX_H_
434Srgrimes
44233044Stijl#include <x86/fpu.h>
454Srgrimes
4655205Speter#ifdef _KERNEL
47146137Snyan
48208833Skib#define	PCB_USER_FPU(pcb) (((pcb)->pcb_flags & PCB_KERNNPX) == 0)
49208833Skib
5092761Salfredint	npxdna(void);
51103408Sminivoid	npxdrop(void);
5292761Salfredvoid	npxexit(struct thread *td);
53103408Sminiint	npxformat(void);
54215865Skibint	npxgetregs(struct thread *td);
55189418Sjhbvoid	npxinit(void);
56271999Sjhbvoid	npxresume(union savefpu *addr);
5792761Salfredvoid	npxsave(union savefpu *addr);
58103408Sminivoid	npxsetregs(struct thread *td, union savefpu *addr);
59271999Sjhbvoid	npxsuspend(union savefpu *addr);
60238678Skibint	npxtrap_x87(void);
61238678Skibint	npxtrap_sse(void);
62215865Skibvoid	npxuserinited(struct thread *);
63230426Skibstruct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags);
64230426Skibvoid	fpu_kern_free_ctx(struct fpu_kern_ctx *ctx);
65208833Skibint	fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx,
66208833Skib	    u_int flags);
67208833Skibint	fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx);
68208833Skibint	fpu_kern_thread(u_int flags);
69208833Skibint	is_fpu_kern_thread(u_int flags);
70158995Sdavidxu
71208833Skib/*
72208833Skib * Flags for fpu_kern_enter() and fpu_kern_thread().
73208833Skib */
74208833Skib#define	FPU_KERN_NORMAL	0x0000
75230426Skib#define	FPU_KERN_NOWAIT	0x0001
76268033Skib#define	FPU_KERN_KTHR	0x0002
77208833Skib
784175Sbde#endif
794175Sbde
804175Sbde#endif /* !_MACHINE_NPX_H_ */
81