Source-Changes-HG archive

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

[src/nathanw_sa]: src/sys/arch/i386/i386 Handle FS and GS in the proper new-w...



details:   https://anonhg.NetBSD.org/src/rev/62d8383dc32d
branches:  nathanw_sa
changeset: 504834:62d8383dc32d
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Wed Jul 11 05:02:39 2001 +0000

description:
Handle FS and GS in the proper new-world-order way.

diffstat:

 sys/arch/i386/i386/machdep.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r 62dbe134ec53 -r 62d8383dc32d sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Tue Jul 10 18:09:32 2001 +0000
+++ b/sys/arch/i386/i386/machdep.c      Wed Jul 11 05:02:39 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.429.2.4 2001/07/09 22:37:27 nathanw Exp $        */
+/*     $NetBSD: machdep.c,v 1.429.2.5 2001/07/11 05:02:39 nathanw Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -1765,6 +1765,8 @@
        tf->tf_eip = (int)((caddr_t) p->p_sigctx.ps_sigcode + (
                (caddr_t)upcallcode - (caddr_t)sigcode));
        tf->tf_esp = (int) sf;
+       tf->tf_gs = GSEL(GUDATA_SEL, SEL_UPL);
+       tf->tf_fs = GSEL(GUDATA_SEL, SEL_UPL);
        tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
        tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
        tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
@@ -3061,8 +3063,8 @@
        } else
 #endif
        {
-               __asm("movl %%gs,%w0" : "=r" (gr[_REG_GS]));
-               __asm("movl %%fs,%w0" : "=r" (gr[_REG_FS]));
+               gr[_REG_GS]  = tf->tf_gs;
+               gr[_REG_FS]  = tf->tf_fs;
                gr[_REG_ES]  = tf->tf_es;
                gr[_REG_DS]  = tf->tf_ds;
                gr[_REG_EFL] = tf->tf_eflags;
@@ -3140,8 +3142,8 @@
                                    gr[_REG_EFL], tf->tf_eflags, gr[_REG_CS]);
                                return (EINVAL);
                        }
-                       __asm("movl %w0,%%gs" : : "r" (gr[_REG_GS]));
-                       __asm("movl %w0,%%fs" : : "r" (gr[_REG_FS]));
+                       tf->tf_gs = gr[_REG_GS];
+                       tf->tf_fs = gr[_REG_FS];
                        tf->tf_es = gr[_REG_ES];
                        tf->tf_ds = gr[_REG_DS];
                        /* Only change the user-alterable part of eflags */



Home | Main Index | Thread Index | Old Index