Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/arch/i386/i386 Pull up revision 1.160 (via patch, r...



details:   https://anonhg.NetBSD.org/src/rev/73be800f7e98
branches:  netbsd-1-5
changeset: 491932:73be800f7e98
user:      he <he%NetBSD.org@localhost>
date:      Sun Jun 17 22:29:37 2001 +0000

description:
Pull up revision 1.160 (via patch, requested by sommerfeld):
  Add %fs/%gs to trap frame and save/restore them on trap/interupt/
  syscall entry from userspace.

  Remove special-case ``by hand'' validation of %fs/%gs register
  values s well as special handling of them in various signal
  handling paths.  Now, like %ds and %es, they are validated by
  the hardware on return to userland.

  This paves the way for the use of %fs for per-cpu data on multi-
  processor systems, and fixes an otherwise difficult-to-fix
  interaction between threads/clone(2) and USER_LDT.

diffstat:

 sys/arch/i386/i386/trap.c |  20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r ed0086fd1e77 -r 73be800f7e98 sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Sun Jun 17 22:29:16 2001 +0000
+++ b/sys/arch/i386/i386/trap.c Sun Jun 17 22:29:37 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.139.2.1 2001/06/11 20:40:19 he Exp $        */
+/*     $NetBSD: trap.c,v 1.139.2.2 2001/06/17 22:29:37 he Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -252,7 +252,9 @@
        u_quad_t sticks;
        struct pcb *pcb = NULL;
        extern char fusubail[],
-                   resume_iret[], resume_pop_ds[], resume_pop_es[];
+                   resume_iret[], resume_pop_ds[], resume_pop_es[],
+                   resume_pop_fs[], resume_pop_gs[];
+                   
        struct trapframe *vframe;
        int resume;
 
@@ -365,6 +367,20 @@
                            offsetof(struct trapframe, tf_es));
                        resume = (int)resume_pop_es;
                        break;
+               case 0x0f:      /* 0x0f prefix */
+                       switch (*(u_char *)(frame.tf_eip+1)) {
+                       case 0xa1:              /* popl %fs */
+                               vframe = (void *)((int)&frame.tf_esp - 
+                                   offsetof(struct trapframe, tf_fs));
+                               resume = (int)resume_pop_fs;
+                               break;
+                       case 0xa9:              /* popl %gs */
+                               vframe = (void *)((int)&frame.tf_esp -
+                                   offsetof(struct trapframe, tf_gs));
+                               resume = (int)resume_pop_gs;
+                               break;
+                       }
+                       break;
                default:
                        goto we_re_toast;
                }



Home | Main Index | Thread Index | Old Index