Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/sys/arch/i386/i386 pullup 1.20->1.21 (fvdl)



details:   https://anonhg.NetBSD.org/src/rev/5d032c68a5b2
branches:  netbsd-1-4
changeset: 468487:5d032c68a5b2
user:      perry <perry%NetBSD.org@localhost>
date:      Mon Apr 26 16:31:47 1999 +0000

description:
pullup 1.20->1.21 (fvdl)

diffstat:

 sys/arch/i386/i386/math_emulate.c |  47 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 45 insertions(+), 2 deletions(-)

diffs (69 lines):

diff -r d8d6001024ae -r 5d032c68a5b2 sys/arch/i386/i386/math_emulate.c
--- a/sys/arch/i386/i386/math_emulate.c Mon Apr 26 16:30:52 1999 +0000
+++ b/sys/arch/i386/i386/math_emulate.c Mon Apr 26 16:31:47 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: math_emulate.c,v 1.20 1998/01/24 13:19:53 mycroft Exp $        */
+/*     $NetBSD: math_emulate.c,v 1.20.8.1 1999/04/26 16:31:47 perry Exp $      */
 
 /*
  * expediant "port" of linux 8087 emulator to 386BSD, with apologies -wfj
@@ -76,6 +76,10 @@
        temp_real tmp;
        char * address;
        u_long oldeip;
+       int override_seg, override_addrsize, override_datasize;
+       int prefix;
+
+       override_seg = override_addrsize = override_datasize = 0;
 
        if (!USERMODE(info->tf_cs, info->tf_eflags))
                panic("math emulator called from supervisor mode");
@@ -94,8 +98,47 @@
                I387.swd &= 0x7fff;
 
        I387.fip = oldeip = info->tf_eip;
+
+       /*
+        * Scan for instruction prefixes. More to be politically correct
+        * than anything else. Prefixes aren't useful for the instructions
+        * we can emulate anyway.
+        */
+       while (1) {
+               prefix = fubyte((const void *)info->tf_eip);
+               switch (prefix) {
+               case INSPREF_LOCK:
+                       math_abort(info, SIGILL);
+                       break;
+               case INSPREF_REPN:
+               case INSPREF_REPE:
+                       break;
+               case INSPREF_CS:
+               case INSPREF_SS:
+               case INSPREF_DS:
+               case INSPREF_ES:
+               case INSPREF_FS:
+               case INSPREF_GS:
+                       override_seg = prefix;
+                       break;
+               case INSPREF_OSIZE:
+                       override_datasize = prefix;     
+                       break;
+               case INSPREF_ASIZE:
+                       override_addrsize = prefix;
+                       break;
+               case -1:
+                       math_abort(info,SIGSEGV);
+                       break;
+               default:
+                       goto done;
+               }
+               info->tf_eip++;
+       }
+
+done:
+       code = htons(fusword((u_short *) info->tf_eip)) & 0x7ff;
        info->tf_eip += 2;
-       code = htons(fusword((u_short *) oldeip)) & 0x7ff;
        *((u_short *) &I387.fcs) = (u_short) info->tf_cs;
        *((u_short *) &I387.fcs + 1) = code;
 



Home | Main Index | Thread Index | Old Index