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 Pull up revision 1.24 (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/c65a08cf232e
branches:  netbsd-1-4
changeset: 471310:c65a08cf232e
user:      he <he%NetBSD.org@localhost>
date:      Mon Jan 14 14:33:26 2002 +0000

description:
Pull up revision 1.24 (requested by sommerfeld):
  Rework how user-mode instructions and stack fetches are done.
  Also fix another vm86 protocol bug.

diffstat:

 sys/arch/i386/i386/vm86.c |  75 +++++++++++++---------------------------------
 1 files changed, 21 insertions(+), 54 deletions(-)

diffs (106 lines):

diff -r 42793331d0af -r c65a08cf232e sys/arch/i386/i386/vm86.c
--- a/sys/arch/i386/i386/vm86.c Sun Jul 29 20:55:19 2001 +0000
+++ b/sys/arch/i386/i386/vm86.c Mon Jan 14 14:33:26 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm86.c,v 1.22 1998/10/26 19:11:57 sommerfe Exp $       */
+/*     $NetBSD: vm86.c,v 1.22.6.1 2002/01/14 14:33:26 he Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -69,68 +69,28 @@
 #define        SS(tf)          (*(u_short *)&tf->tf_ss)
 #define        SP(tf)          (*(u_short *)&tf->tf_esp)
 
-
 #define putword(base, ptr, val) \
-__asm__ __volatile__( \
-       "decw %w0\n\t" \
-       "movb %h2,0(%1,%0)\n\t" \
-       "decw %w0\n\t" \
-       "movb %b2,0(%1,%0)" \
-       : "=r" (ptr) \
-       : "r" (base), "q" (val), "0" (ptr))
+       ({ ptr = (ptr - 1) & 0xffff;                    \
+          subyte((void *)(base+ptr), (val>>8));                        \
+           ptr = (ptr - 1) & 0xffff;                   \
+          subyte((void *)(base+ptr), (val&0xff)); })
 
 #define putdword(base, ptr, val) \
-__asm__ __volatile__( \
-       "rorl $16,%2\n\t" \
-       "decw %w0\n\t" \
-       "movb %h2,0(%1,%0)\n\t" \
-       "decw %w0\n\t" \
-       "movb %b2,0(%1,%0)\n\t" \
-       "rorl $16,%2\n\t" \
-       "decw %w0\n\t" \
-       "movb %h2,0(%1,%0)\n\t" \
-       "decw %w0\n\t" \
-       "movb %b2,0(%1,%0)" \
-       : "=r" (ptr) \
-       : "r" (base), "q" (val), "0" (ptr))
+       ({ putword(base, ptr, (val >> 16));             \
+          putword(base, ptr, (val & 0xffff)); })
 
 #define getbyte(base, ptr) \
-({ unsigned long __res; \
-__asm__ __volatile__( \
-       "movb 0(%1,%0),%b2\n\t" \
-       "incw %w0" \
-       : "=r" (ptr), "=r" (base), "=q" (__res) \
-       : "0" (ptr), "1" (base), "2" (0)); \
-__res; })
+       ({ unsigned long __tmp = fubyte((void *)(base+ptr));     \
+          if (__tmp == ~0) goto bad;                            \
+          ptr = (ptr + 1) & 0xffff; __tmp; })
 
 #define getword(base, ptr) \
-({ unsigned long __res; \
-__asm__ __volatile__( \
-       "movb 0(%1,%0),%b2\n\t" \
-       "incw %w0\n\t" \
-       "movb 0(%1,%0),%h2\n\t" \
-       "incw %w0" \
-       : "=r" (ptr), "=r" (base), "=q" (__res) \
-       : "0" (ptr), "1" (base), "2" (0)); \
-__res; })
+       ({ unsigned long __tmp = getbyte(base, ptr);    \
+          __tmp |= (getbyte(base, ptr) << 8); __tmp;})
 
 #define getdword(base, ptr) \
-({ unsigned long __res; \
-__asm__ __volatile__( \
-       "movb 0(%1,%0),%b2\n\t" \
-       "incw %w0\n\t" \
-       "movb 0(%1,%0),%h2\n\t" \
-       "incw %w0\n\t" \
-       "rorl $16,%2\n\t" \
-       "movb 0(%1,%0),%b2\n\t" \
-       "incw %w0\n\t" \
-       "movb 0(%1,%0),%h2\n\t" \
-       "incw %w0\n\t" \
-       "rorl $16,%2" \
-       : "=r" (ptr), "=r" (base), "=q" (__res) \
-       : "0" (ptr), "1" (base)); \
-__res; })
-
+       ({ unsigned long __tmp = getword(base, ptr);    \
+          __tmp |= (getword(base, ptr) << 16); __tmp;})
 
 static __inline int
 is_bitset(nr, bitmap)
@@ -242,7 +202,14 @@
 #endif
                sigexit(p, SIGILL);
                /* NOTREACHED */
+       } else if (sigismember(&p->p_sigctx.ps_sigignore, SIGURG)) {
+#ifdef DIAGNOSTIC
+               printf("pid %d killed on VM86 protocol screwup (SIGURG ignored)\n",
+                   p->p_pid);
+#endif
+               sigexit(p, SIGILL);
        }
+       
        trapsignal(p, SIGURG, retval);
 }
 



Home | Main Index | Thread Index | Old Index