Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Apr 2003 18:03:19 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 28118 for review
Message-ID:  <200304050203.h3523JIZ092613@repoman.freebsd.org>

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

Change 28118 by peter@peter_daintree on 2003/04/04 18:03:01

	no dbregs, ldt, kse

Affected files ...

.. //depot/projects/hammer/sys/x86_64/x86_64/vm_machdep.c#10 edit

Differences ...

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

@@ -99,22 +99,8 @@
 	register_t savecrit;
 
 	p1 = td1->td_proc;
-	if ((flags & RFPROC) == 0) {
-		if ((flags & RFMEM) == 0) {
-			/* unshare user LDT */
-			struct mdproc *mdp1 = &p1->p_md;
-			struct proc_ldt *pldt = mdp1->md_ldt;
-			if (pldt && pldt->ldt_refcnt > 1) {
-				pldt = user_ldt_alloc(mdp1, pldt->ldt_len);
-				if (pldt == NULL)
-					panic("could not copy LDT");
-				mdp1->md_ldt = pldt;
-				set_user_ldt(mdp1);
-				user_ldt_free(td1);
-			}
-		}
+	if ((flags & RFPROC) == 0)
 		return;
-	}
 
 	/* Ensure that p1's pcb is up to date. */
 	if (td1 == curthread)
@@ -164,7 +150,6 @@
 	pcb2->pcb_eip = (int)fork_trampoline;
 	pcb2->pcb_psl = td2->td_frame->tf_eflags & ~PSL_I; /* ints disabled */
 	/*-
-	 * pcb2->pcb_dr*:	cloned above.
 	 * pcb2->pcb_savefpu:	cloned above.
 	 * pcb2->pcb_flags:	cloned above.
 	 * pcb2->pcb_onfault:	cloned above (always NULL here?).
@@ -177,20 +162,6 @@
 	 */
 	pcb2->pcb_ext = 0;
 
-        /* Copy the LDT, if necessary. */
-	mtx_lock_spin(&sched_lock);
-        if (mdp2->md_ldt != 0) {
-		if (flags & RFMEM) {
-			mdp2->md_ldt->ldt_refcnt++;
-		} else {
-			mdp2->md_ldt = user_ldt_alloc(mdp2,
-			    mdp2->md_ldt->ldt_len);
-			if (mdp2->md_ldt == NULL)
-				panic("could not copy LDT");
-		}
-        }
-	mtx_unlock_spin(&sched_lock);
-
 	/*
 	 * Now, cpu_switch() can schedule the new process.
 	 * pcb_esp is loaded pointing to the cpu_switch() stack frame
@@ -228,9 +199,6 @@
 	struct mdproc *mdp;
 
 	mdp = &td->td_proc->p_md;
-	if (mdp->md_ldt)
-		user_ldt_free(td);
-	reset_dbregs();
 }
 
 void
@@ -239,34 +207,11 @@
 	struct pcb *pcb = td->td_pcb; 
 
 	npxexit(td);
-        if (pcb->pcb_flags & PCB_DBREGS) {
-                /*
-                 * disable all hardware breakpoints
-                 */
-                reset_dbregs();
-                pcb->pcb_flags &= ~PCB_DBREGS;
-        }
 }
 
 void
 cpu_thread_clean(struct thread *td)
 {
-	struct pcb *pcb;
-
-	pcb = td->td_pcb; 
-	if (pcb->pcb_ext != 0) {
-		/* XXXKSE  XXXSMP  not SMP SAFE.. what locks do we have? */
-		/* if (pcb->pcb_ext->ext_refcount-- == 1) ?? */
-		/*
-		 * XXX do we need to move the TSS off the allocated pages
-		 * before freeing them?  (not done here)
-		 */
-		mtx_lock(&Giant);
-		kmem_free(kernel_map, (vm_offset_t)pcb->pcb_ext,
-		    ctob(IOPAGES + 1));
-		mtx_unlock(&Giant);
-		pcb->pcb_ext = 0;
-	}
 }
 
 void
@@ -294,59 +239,6 @@
 void
 cpu_set_upcall(struct thread *td, void *pcb)
 {
-	struct pcb *pcb2;
-
-	/* Point the pcb to the top of the stack. */
-	pcb2 = td->td_pcb;
-
-	/*
-	 * Copy the upcall pcb.  This loads kernel regs.
-	 * Those not loaded individually below get their default
-	 * values here.
-	 *
-	 * XXXKSE It might be a good idea to simply skip this as
-	 * the values of the other registers may be unimportant.
-	 * This would remove any requirement for knowing the KSE
-	 * at this time (see the matching comment below for
-	 * more analysis) (need a good safe default).
-	 */
-	bcopy(pcb, pcb2, sizeof(*pcb2));
-
-	/*
-	 * Create a new fresh stack for the new thread.
-	 * 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 *)pcb2 - 1;
-
-	/*
-	 * Set registers for trampoline to user mode.  Leave space for the
-	 * return address on stack.  These are the kernel mode register values.
-	 */
-#ifdef PAE
-	pcb2->pcb_cr3 = vtophys(vmspace_pmap(td->td_proc->p_vmspace)->pm_pdpt);
-#else
-	pcb2->pcb_cr3 = vtophys(vmspace_pmap(td->td_proc->p_vmspace)->pm_pdir);
-#endif
-	pcb2->pcb_edi = 0;
-	pcb2->pcb_esi = (int)fork_return;		    /* trampoline arg */
-	pcb2->pcb_ebp = 0;
-	pcb2->pcb_esp = (int)td->td_frame - sizeof(void *); /* trampoline arg */
-	pcb2->pcb_ebx = (int)td;			    /* trampoline arg */
-	pcb2->pcb_eip = (int)fork_trampoline;
-	pcb2->pcb_psl &= ~(PSL_I);	/* interrupts must be disabled */
-	/*
-	 * If we didn't copy the pcb, we'd need to do the following registers:
-	 * pcb2->pcb_dr*:	cloned above.
-	 * pcb2->pcb_savefpu:	cloned above.
-	 * pcb2->pcb_flags:	cloned above.
-	 * pcb2->pcb_onfault:	cloned above (always NULL here?).
-	 * pcb2->pcb_gs:	cloned above.  XXXKSE ???
-	 * pcb2->pcb_ext:	cleared below.
-	 */
-	 pcb2->pcb_ext = NULL;
 }
 
 /*
@@ -357,30 +249,6 @@
 void
 cpu_set_upcall_kse(struct thread *td, struct kse_upcall *ku)
 {
-
-	/* 
-	 * Do any extra cleaning that needs to be done.
-	 * The thread may have optional components
-	 * that are not present in a fresh thread.
-	 * This may be a recycled thread so make it look
-	 * as though it's newly allocated.
-	 */
-	cpu_thread_clean(td);
-
-	/*
-	 * Set the trap frame to point at the beginning of the uts
-	 * function.
-	 */
-	td->td_frame->tf_esp =
-	    (int)ku->ku_stack.ss_sp + ku->ku_stack.ss_size;
-	td->td_frame->tf_eip = (int)ku->ku_func;
-
-	/*
-	 * Pass the address of the mailbox for this kse to the uts
-	 * function as a parameter on the stack.
-	 */
-	suword((void *)(td->td_frame->tf_esp + sizeof(void *)),
-	    (int)ku->ku_mailbox);
 }
 
 void



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