Deleted Added
full compact
npx.c (158996) npx.c (159027)
1/*-
2 * Copyright (c) 1990 William Jolitz.
3 * Copyright (c) 1991 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 17 unchanged lines hidden (view full) ---

26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * from: @(#)npx.c 7.2 (Berkeley) 5/12/91
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1990 William Jolitz.
3 * Copyright (c) 1991 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 17 unchanged lines hidden (view full) ---

26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * from: @(#)npx.c 7.2 (Berkeley) 5/12/91
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/i386/isa/npx.c 158996 2006-05-28 04:40:45Z davidxu $");
34__FBSDID("$FreeBSD: head/sys/i386/isa/npx.c 159027 2006-05-29 02:58:37Z davidxu $");
35
36#include "opt_cpu.h"
37#include "opt_isa.h"
38#include "opt_npx.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/bus.h>

--- 894 unchanged lines hidden (view full) ---

937 intr_restore(s);
938 } else {
939 intr_restore(s);
940 bcopy(addr, &td->td_pcb->pcb_save, sizeof(*addr));
941 }
942 curthread->td_pcb->pcb_flags |= PCB_NPXINITDONE;
943}
944
35
36#include "opt_cpu.h"
37#include "opt_isa.h"
38#include "opt_npx.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/bus.h>

--- 894 unchanged lines hidden (view full) ---

937 intr_restore(s);
938 } else {
939 intr_restore(s);
940 bcopy(addr, &td->td_pcb->pcb_save, sizeof(*addr));
941 }
942 curthread->td_pcb->pcb_flags |= PCB_NPXINITDONE;
943}
944
945/*
946 * POSIX requires new thread to inherit floating-point environment.
947 */
948void
949npx_fork_thread(struct thread *td, struct thread *newtd)
950{
951 union savefpu *state;
952 u_int32_t mxcsr;
953 u_int32_t cw;
954
955 if (!(td->td_pcb->pcb_flags & PCB_NPXINITDONE)) {
956 newtd->td_pcb->pcb_flags &= ~PCB_NPXINITDONE;
957 return;
958 }
959
960 state = &newtd->td_pcb->pcb_save;
961 /* get control word */
962 if (npxgetregs(td, state))
963 return;
964 if (cpu_fxsr) {
965 mxcsr = state->sv_xmm.sv_env.en_mxcsr;
966 cw = state->sv_xmm.sv_env.en_cw;
967 } else {
968 cw = state->sv_87.sv_env.en_cw;
969 mxcsr = 0;
970 }
971 bcopy(&npx_cleanstate, state, sizeof(*state));
972 if (cpu_fxsr) {
973 state->sv_xmm.sv_env.en_cw = cw;
974 state->sv_xmm.sv_env.en_mxcsr = mxcsr;
975 } else
976 state->sv_87.sv_env.en_cw = cw;
977 newtd->td_pcb->pcb_flags |= PCB_NPXINITDONE;
978}
979
980static void
981fpusave(addr)
982 union savefpu *addr;
983{
984
985#ifdef CPU_ENABLE_SSE
986 if (cpu_fxsr)
987 fxsave(addr);

--- 159 unchanged lines hidden ---
945static void
946fpusave(addr)
947 union savefpu *addr;
948{
949
950#ifdef CPU_ENABLE_SSE
951 if (cpu_fxsr)
952 fxsave(addr);

--- 159 unchanged lines hidden ---