do the correct thing for the "cpu" config definition, and require

options "MATH_EMULATE" for math emulation
This commit is contained in:
cgd 1993-05-20 14:33:41 +00:00
parent c13e0190b7
commit 42ff6b7e23
4 changed files with 69 additions and 46 deletions

View File

@ -33,7 +33,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)locore.s 7.3 (Berkeley) 5/13/91
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.10 1993/05/20 14:33:41 cgd Exp $
*/
@ -141,6 +142,28 @@ start: movw $0x1234,%ax
movl 12(%esp),%eax
movl %eax, _cyloffset-SYSTEM
/* find out our CPU type. */
pushfl
popl %eax
movl %eax, %ecx
xorl $0x40000, %eax
pushl %eax
popfl
pushfl
popl %eax
xorl %ecx, %eax
shrl $18, %eax
andl $1, %eax
push %ecx
popfl
cmpl $0, %eax
jne 1f
movl $CPU_386, _cpu-SYSTEM
jmp 2f
1: movl $CPU_486, _cpu-SYSTEM
2:
#ifdef garbage
/* count up memory */
@ -293,8 +316,6 @@ begin: /* now running relocated at SYSTEM where the system is linked to run */
lea 7*NBPG(%esi),%esi # skip past stack.
pushl %esi
call _set_cpu_type # get kind of cpu
call _init386 # wire 386 chip for unix operation
movl $0,_PTD
@ -1853,30 +1874,6 @@ IDTVEC(syscall)
pushl $0
jmp doreti
ALIGN32
ENTRY(set_cpu_type)
pushfl
popl %eax
movl %eax, %ecx
xorl $0x40000, %eax
pushl %eax
popfl
pushfl
popl %eax
xorl %ecx, %eax
shrl $18, %eax
andl $1, %eax
push %ecx
popfl
movl $_cpu, %ecx
cmpl $0, %eax
jne 1f
movl $CPU_386, (%ecx)
ret
1: movl $CPU_486, (%ecx)
ret
ALIGN32
ENTRY(htonl)
ENTRY(ntohl)

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.15 1993/05/20 02:14:49 cgd Exp $
* $Id: machdep.c,v 1.16 1993/05/20 14:33:44 cgd Exp $
*/
#include "param.h"
@ -140,6 +140,7 @@ cpu_startup()
* Good {morning,afternoon,evening,night}.
*/
printf(version);
identifycpu();
printf("real mem = %d\n", ctob(physmem));
/*
@ -256,6 +257,37 @@ again:
configure();
}
identifycpu() /* translated from hp300 -- cgd */
{
if (cpu < CPU_MINTYPE || cpu > CPU_MAXTYPE) {
printf("unknown cpu type %d\n", cpu);
panic("startup: bad cpu id");
}
printf("CPU: %s\n", cpu_typenames[cpu]);
/*
* Now that we have told the user what they have,
* let them know if that machine type isn't configured.
*/
switch (cpu) {
case -1: /* keep compilers happy */
#if !defined(I386_CPU)
case CPU_386:
case CPU_386SX:
#endif
#if !defined(I486_CPU)
case CPU_486:
case CPU_486SX:
#endif
#if !defined(I586_CPU)
case CPU_586:
#endif
panic("CPU type not configured");
default:
break;
}
}
#ifdef PGINPROF
/*
* Return the difference (in microseconds)

View File

@ -1,4 +1,9 @@
/* [expediant "port" of linux 8087 emulator to 386BSD, with apologies -wfj] */
/*
* expediant "port" of linux 8087 emulator to 386BSD, with apologies -wfj
*
* $Id: math_emulate.c,v 1.3 1993/05/20 14:33:45 cgd Exp $
*/
/*
* linux/kernel/math/math_emulate.c
*
@ -29,16 +34,6 @@
* The other files also don't care about ST(x) etc - they just get addresses
* to 80-bit temporary reals, and do with them as they please. I wanted to
* hide most of the 387-specific things here.
*
* PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
* -------------------- ----- ----------------------
* CURRENT PATCH LEVEL: 2 00060
* -------------------- ----- ----------------------
*
* 19 Sep 92 Ishii Masahiro Fix 0x1fd instruction
* kym@bingsuns.cc.binghamton.edu Fix fscale
* 28 Nov 92 Poul-Henning Kamp Reduce kernel size if you have
* a 387 or 486 chip
*/
#include "machine/cpu.h"
@ -78,10 +73,6 @@ put_fs_long(unsigned long val, unsigned long *adr) { (void)suword(adr,val); }
math_emulate(struct trapframe * info)
{
#if defined(i486) || defined(i387)
panic("math_emulate(), shouldn't happen with -Di486 or -Di387");
}
#else
unsigned short code;
temp_real tmp;
char * address;
@ -1484,4 +1475,3 @@ void int_to_real(const temp_int * a, temp_real * b)
:"0" (b->a),"1" (b->b));
}
}
#endif /* defined(i486) || defined(i387) */

View File

@ -35,7 +35,7 @@
*
* @(#)trap.c 7.4 (Berkeley) 5/13/91
*/
static char rcsid[] = "$Header: /cvsroot/src/sys/arch/i386/i386/trap.c,v 1.4 1993/05/13 21:39:38 deraadt Exp $";
static char rcsid[] = "$Header: /cvsroot/src/sys/arch/i386/i386/trap.c,v 1.5 1993/05/20 14:33:47 cgd Exp $";
/*
* 386 Trap and System call handleing
@ -166,12 +166,16 @@ copyfault:
goto out;
case T_DNA|T_USER:
#ifdef NPX
#ifdef NPX
/* if a transparent fault (due to context switch "late") */
if (npxdna()) return;
#endif
#ifdef MATH_EMULATE
i = math_emulate(&frame);
if (i == 0) return;
#else
panic("trap: math emulation necessary!");
#endif
ucode = FPE_FPU_NP_TRAP;
break;