Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Apr 2003 21:33:50 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 28689 for review
Message-ID:  <200304100433.h3A4XoXr005140@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=28689

Change 28689 by peter@peter_daintree on 2003/04/09 21:33:18

	do not mess with %gs.  Use the right symbols for the user code/data segs.
	set %cs.  Entering userland with a null descriptor isn't a good idea.

Affected files ...

.. //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#62 edit

Differences ...

==== //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#62 (text+ko) ====

@@ -463,17 +463,20 @@
 	u_long ps_strings;
 {
 	struct trapframe *regs = td->td_frame;
+#if 0
 	struct pcb *pcb = td->td_pcb;
 
 	/* Reset pc->pcb_gs and %gs before possibly invalidating it. */
 	pcb->pcb_gs = _udatasel;
 	load_gs(_udatasel);
+#endif
 
 	bzero((char *)regs, sizeof(struct trapframe));
 	regs->tf_rip = entry;
 	regs->tf_rsp = stack;
 	regs->tf_rflags = PSL_USER | (regs->tf_rflags & PSL_T);
 	regs->tf_ss = _udatasel;
+	regs->tf_cs = _ucodesel;
 
 	/*
 	 * Arrange to trap the next npx or `fwait' instruction (see npx.c
@@ -511,7 +514,9 @@
 	cr0 |= CR0_MP | CR0_TS;		/* Done at every execve() too. */
 	cr0 |= CR0_WP | CR0_AM;
 	load_cr0(cr0);
+#if 0
 	load_gs(_udatasel);
+#endif
 }
 
 static int
@@ -1264,8 +1269,8 @@
 
 	/* transfer to user mode */
 
-	_ucodesel = GSEL(LUCODE_SEL, SEL_UPL);
-	_udatasel = GSEL(LUDATA_SEL, SEL_UPL);
+	_ucodesel = GSEL(GUCODE_SEL, SEL_UPL);
+	_udatasel = GSEL(GUDATA_SEL, SEL_UPL);
 
 	/* setup proc 0's pcb */
 	thread0.td_pcb->pcb_flags = 0; /* XXXKSE */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304100433.h3A4XoXr005140>