Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Sep 2002 19:09:10 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 17797 for review
Message-ID:  <200209210209.g8L29AqN084908@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=17797

Change 17797 by peter@peter_daintree on 2002/09/20 19:08:21

	chop out the evil -16 offset stuff for vm86 support (no vm86!!)

Affected files ...

.. //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#2 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/swtch.s#2 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/sys_machdep.c#2 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/vm_machdep.c#2 edit

Differences ...

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

@@ -1823,9 +1823,8 @@
 	initializecpu();	/* Initialize CPU registers */
 
 	/* make an initial tss so cpu can get interrupt stack on syscall! */
-	/* Note: -16 is so we can grow the trapframe if we came from vm86 */
 	PCPU_SET(common_tss.tss_esp0, thread0.td_kstack +
-	    KSTACK_PAGES * PAGE_SIZE - sizeof(struct pcb) - 16);
+	    KSTACK_PAGES * PAGE_SIZE - sizeof(struct pcb));
 	PCPU_SET(common_tss.tss_ss0, GSEL(GDATA_SEL, SEL_KPL));
 	gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
 	private_tss = 0;

==== //depot/projects/hammer/sys/x86_64/x86_64/swtch.s#2 (text+ko) ====

@@ -199,9 +199,8 @@
 1:	/*
 	 * Use the common default TSS instead of our own.
 	 * Set our stack pointer into the TSS, it's set to just
-	 * below the PCB.  In C, common_tss.tss_esp0 = &pcb - 16;
+	 * below the PCB.  In C, common_tss.tss_esp0 = &pcb;
 	 */
-	leal	-16(%edx), %ebx			/* leave space for vm86 */
 	movl	%ebx, PCPU(COMMON_TSS) + TSS_ESP0
 
 	/*

==== //depot/projects/hammer/sys/x86_64/x86_64/sys_machdep.c#2 (text+ko) ====

@@ -136,9 +136,8 @@
 	if (ext == 0)
 		return (ENOMEM);
 	bzero(ext, sizeof(struct pcb_ext)); 
-	/* -16 is so we can convert a trapframe into vm86trapframe inplace */
 	ext->ext_tss.tss_esp0 = td->td_kstack + ctob(KSTACK_PAGES) -
-	    sizeof(struct pcb) - 16;
+	    sizeof(struct pcb);
 	ext->ext_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
 	/*
 	 * The last byte of the i/o map must be followed by an 0xff byte.

==== //depot/projects/hammer/sys/x86_64/x86_64/vm_machdep.c#2 (text+ko) ====

@@ -69,7 +69,6 @@
 #include <machine/md_var.h>
 #include <machine/pcb.h>
 #include <machine/pcb_ext.h>
-#include <machine/vm86.h>
 
 #include <vm/vm.h>
 #include <vm/vm_param.h>
@@ -174,9 +173,8 @@
 	 * Create a new fresh stack for the new process.
 	 * Copy the trap frame for the return to user mode as if from a
 	 * syscall.  This copies most of the user mode register values.
-	 * The -16 is so we can expand the trapframe if we go to vm86.
 	 */
-	td2->td_frame = (struct trapframe *)((caddr_t)td2->td_pcb - 16) - 1;
+	td2->td_frame = (struct trapframe *)td2->td_pcb - 1;
 	bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe));
 
 	td2->td_frame->tf_eax = 0;		/* Child returns zero */
@@ -304,7 +302,7 @@
 
 	td->td_pcb =
 	     (struct pcb *)(td->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
-	td->td_frame = (struct trapframe *)((caddr_t)td->td_pcb - 16) - 1;
+	td->td_frame = (struct trapframe *)td->td_pcb - 1;
 }
 
 /*
@@ -336,13 +334,12 @@
 
 	/*
 	 * Create a new fresh stack for the new thread.
-	 * The -16 is so we can expand the trapframe if we go to vm86.
 	 * Don't forget to set this stack value into whatever supplies
 	 * the address for the fault handlers.
 	 * The contexts are filled in at the time we actually DO the
 	 * upcall as only then do we know which KSE we got.
 	 */
-	td->td_frame = (struct trapframe *)((caddr_t)pcb2 - 16) - 1;
+	td->td_frame = (struct trapframe *)pcb2 - 1;
 
 	/*
 	 * Set registers for trampoline to user mode.  Leave space for the
@@ -381,7 +378,7 @@
 	 * function.
 	 */
 	td->td_frame->tf_esp =
-	    (int)ke->ke_stack.ss_sp + ke->ke_stack.ss_size - 16;
+	    (int)ke->ke_stack.ss_sp + ke->ke_stack.ss_size;
 	td->td_frame->tf_eip = (int)ke->ke_upcall;
 
 	/*

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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