diff --git a/sys/arch/mac68k/mac68k/fpu.c b/sys/arch/mac68k/mac68k/fpu.c index 6cfba0018337..828ddeee828b 100644 --- a/sys/arch/mac68k/mac68k/fpu.c +++ b/sys/arch/mac68k/mac68k/fpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: fpu.c,v 1.16 1996/06/11 02:56:22 scottr Exp $ */ +/* $NetBSD: fpu.c,v 1.17 1996/09/16 18:00:26 scottr Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross @@ -45,7 +45,11 @@ #include #include -extern int fpu_type; +/* + * FPU type; emulator uses FPU_NONE + */ +int fputype; + extern int *nofault; static int fpu_match __P((struct device *, void *, void *)); @@ -77,7 +81,8 @@ static char *fpu_descr[] = { "mc68881", /* 1 */ "mc68882", /* 2 */ "mc68040", /* 3 */ - "?" }; + "mc68060", /* 4 */ + "unknown" }; static void fpu_attach(parent, self, args) @@ -87,9 +92,9 @@ fpu_attach(parent, self, args) { char *descr; - fpu_type = fpu_probe(); - if ((0 <= fpu_type) && (fpu_type <= 3)) - descr = fpu_descr[fpu_type]; + fputype = fpu_probe(); + if ((0 <= fputype) && (fputype <= 3)) + descr = fpu_descr[fputype]; else descr = "unknown type"; @@ -110,7 +115,7 @@ fpu_probe() nofault = (int *) &faultbuf; if (setjmp(&faultbuf)) { nofault = (int *) 0; - return(0); + return (FPU_NONE); } /* @@ -127,9 +132,8 @@ fpu_probe() * Presumably, if we're an 040 and did not take exception * above, we have an FPU. Don't bother probing. */ - if (mmutype == MMU_68040) { - return 3; - } + if (mmutype == MMU_68040) + return (FPU_68040); /* * Presumably, this will not cause a fault--the fnop should @@ -150,11 +154,13 @@ fpu_probe() * The size of a 68881 IDLE frame is 0x18 * and a 68882 frame is 0x38 */ - if (b == 0x18) return 1; - if (b == 0x38) return 2; + if (b == 0x18) + return (FPU_68881); + if (b == 0x38) + return (FPU_68882); /* * If it's not one of the above, we have no clue what it is. */ - return 4; + return (FPU_UNKNOWN); } diff --git a/sys/arch/mac68k/mac68k/genassym.c b/sys/arch/mac68k/mac68k/genassym.c index 53c051108329..2e25027446d4 100644 --- a/sys/arch/mac68k/mac68k/genassym.c +++ b/sys/arch/mac68k/mac68k/genassym.c @@ -1,4 +1,4 @@ -/* $NetBSD: genassym.c,v 1.19 1996/09/12 21:25:29 scottr Exp $ */ +/* $NetBSD: genassym.c,v 1.20 1996/09/16 18:00:27 scottr Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -184,6 +184,10 @@ main(void) printf("#define\tSYS_execve %d\n", SYS_execve); printf("#define\tSYS_sigreturn %d\n", SYS_sigreturn); + printf("#define\tFPU_68881 %d\n", FPU_68881); + printf("#define\tFPU_68882 %d\n", FPU_68882); + printf("#define\tFPU_68040 %d\n", FPU_68040); + printf("#define\tMMU_68040 %d\n", MMU_68040); printf("#define\tMMU_68030 %d\n", MMU_68030); printf("#define\tMMU_68851 %d\n", MMU_68851); diff --git a/sys/arch/mac68k/mac68k/locore.s b/sys/arch/mac68k/mac68k/locore.s index 5f99df74abe5..795ae05867cc 100644 --- a/sys/arch/mac68k/mac68k/locore.s +++ b/sys/arch/mac68k/mac68k/locore.s @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.66 1996/09/12 21:25:31 scottr Exp $ */ +/* $NetBSD: locore.s,v 1.67 1996/09/16 18:00:28 scottr Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -278,7 +278,7 @@ Lstkadj: */ _fpfline: #if defined(M68040) - cmpl #0x3,_fpu_type | 68040? (see fpu.c) + cmpl #FPU_68040,_fputype | 68040? (see fpu.c) jne Lfp_unimp | no, skip FPSP cmpw #0x202c,sp@(6) | format type 2? jne _illinst | no, treat as illinst @@ -300,7 +300,7 @@ Lfp_unimp: _fpunsupp: #if defined(M68040) - cmpl #0x3,_fpu_type | 68040? (see fpu.c) + cmpl #FPU_68040,_fputype | 68040? (see fpu.c) jne Lfp_unsupp | no, treat as illinst #ifdef FPSP .globl fpsp_unsupp @@ -1347,7 +1347,7 @@ Lsw2: movl usp,a2 | grab USP (a2 has been saved) movl a2,a1@(PCB_USP) | and save it - tstl _fpu_type | Do we have an fpu? + tstl _fputype | Do we have an fpu? jeq Lswnofpsave | No? Then don't attempt save. lea a1@(PCB_FPCTX),a2 | pointer to FP save area fsave a2@ | save FP state @@ -1410,7 +1410,7 @@ Lcxswdone: movl a1@(PCB_USP),a0 movl a0,usp | and USP - tstl _fpu_type | If we don't have an fpu, + tstl _fputype | If we don't have an fpu, jeq Lnofprest | don't try to restore it. lea a1@(PCB_FPCTX),a0 | pointer to FP save area tstb a0@ | null state frame? @@ -1443,7 +1443,7 @@ ENTRY(savectx) movl a0,a1@(PCB_USP) | and save it moveml #0xFCFC,a1@(PCB_REGS) | save non-scratch registers - tstl _fpu_type | Do we have FPU? + tstl _fputype | Do we have FPU? jeq Lsavedone | No? Then don't save state. lea a1@(PCB_FPCTX),a0 | pointer to FP save area fsave a0@ | save FP state diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c index f8824199eb48..711bcfdc5cea 100644 --- a/sys/arch/mac68k/mac68k/machdep.c +++ b/sys/arch/mac68k/mac68k/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.115 1996/08/09 10:30:23 mrg Exp $ */ +/* $NetBSD: machdep.c,v 1.116 1996/09/16 18:00:30 scottr Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -195,11 +195,6 @@ int physmem = MAXMEM; /* max supported memory, changes to actual */ */ int safepri = PSL_LOWIPL; -/* - * For the fpu emulation and fpu driver. - */ -int fpu_type; - static void identifycpu __P((void)); static u_long get_physical __P((u_int, u_long *)); void dumpsys __P((void)); @@ -468,7 +463,7 @@ setregs(p, pack, sp, retval) /* restore a null state frame */ p->p_addr->u_pcb.pcb_fpregs.fpf_null = 0; - if (fpu_type) { + if (fputype) { m68881_restore(&p->p_addr->u_pcb.pcb_fpregs); } } @@ -606,7 +601,7 @@ sendsig(catcher, sig, mask, code) p->p_pid, exframesize[ft], ft); #endif } - if (fpu_type) { + if (fputype) { kfp->sf_state.ss_flags |= SS_FPSTATE; m68881_save(&kfp->sf_state.ss_fpstate); } diff --git a/sys/arch/mac68k/mac68k/vm_machdep.c b/sys/arch/mac68k/mac68k/vm_machdep.c index 9d007c1babf1..7b6b3314db2e 100644 --- a/sys/arch/mac68k/mac68k/vm_machdep.c +++ b/sys/arch/mac68k/mac68k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.20 1996/05/05 16:50:34 briggs Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.21 1996/09/16 18:00:31 scottr Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -62,8 +62,6 @@ #include #include -extern int fpu_type; - void savectx __P((struct pcb *)); /* @@ -194,7 +192,7 @@ cpu_coredump(p, vp, cred, chdr) md_core.intreg.r_sr = f->f_sr; md_core.intreg.r_pc = f->f_pc; } - if (fpu_type) { + if (fputype) { register struct fpframe *f; f = &up->u_pcb.pcb_fpregs;