vm_machdep.c (204309) | vm_machdep.c (208833) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986 The Regents of the University of California. 3 * Copyright (c) 1989, 1990 William Jolitz 4 * Copyright (c) 1994 John Dyson 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * the Systems Programming Group of the University of Utah Computer --- 27 unchanged lines hidden (view full) --- 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 40 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ 41 */ 42 43#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986 The Regents of the University of California. 3 * Copyright (c) 1989, 1990 William Jolitz 4 * Copyright (c) 1994 John Dyson 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * the Systems Programming Group of the University of Utah Computer --- 27 unchanged lines hidden (view full) --- 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 40 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ 41 */ 42 43#include <sys/cdefs.h> |
44__FBSDID("$FreeBSD: head/sys/i386/i386/vm_machdep.c 204309 2010-02-25 14:13:39Z attilio $"); | 44__FBSDID("$FreeBSD: head/sys/i386/i386/vm_machdep.c 208833 2010-06-05 15:59:59Z kib $"); |
45 46#include "opt_isa.h" 47#include "opt_npx.h" 48#include "opt_reset.h" 49#include "opt_cpu.h" 50#include "opt_xbox.h" 51 52#include <sys/param.h> --- 118 unchanged lines hidden (view full) --- 171 set_user_ldt(mdp1); 172 user_ldt_deref(pldt1); 173 } else 174 mtx_unlock_spin(&dt_lock); 175 } 176 return; 177 } 178 | 45 46#include "opt_isa.h" 47#include "opt_npx.h" 48#include "opt_reset.h" 49#include "opt_cpu.h" 50#include "opt_xbox.h" 51 52#include <sys/param.h> --- 118 unchanged lines hidden (view full) --- 171 set_user_ldt(mdp1); 172 user_ldt_deref(pldt1); 173 } else 174 mtx_unlock_spin(&dt_lock); 175 } 176 return; 177 } 178 |
179 /* Ensure that p1's pcb is up to date. */ | 179 /* Ensure that td1's pcb is up to date. */ |
180 if (td1 == curthread) 181 td1->td_pcb->pcb_gs = rgs(); 182#ifdef DEV_NPX 183 savecrit = intr_disable(); 184 if (PCPU_GET(fpcurthread) == td1) | 180 if (td1 == curthread) 181 td1->td_pcb->pcb_gs = rgs(); 182#ifdef DEV_NPX 183 savecrit = intr_disable(); 184 if (PCPU_GET(fpcurthread) == td1) |
185 npxsave(&td1->td_pcb->pcb_save); | 185 npxsave(td1->td_pcb->pcb_save); |
186 intr_restore(savecrit); 187#endif 188 189 /* Point the pcb to the top of the stack */ 190 pcb2 = (struct pcb *)(td2->td_kstack + 191 td2->td_kstack_pages * PAGE_SIZE) - 1; 192 td2->td_pcb = pcb2; 193 | 186 intr_restore(savecrit); 187#endif 188 189 /* Point the pcb to the top of the stack */ 190 pcb2 = (struct pcb *)(td2->td_kstack + 191 td2->td_kstack_pages * PAGE_SIZE) - 1; 192 td2->td_pcb = pcb2; 193 |
194 /* Copy p1's pcb */ | 194 /* Copy td1's pcb */ |
195 bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); 196 | 195 bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); 196 |
197 /* Properly initialize pcb_save */ 198 pcb2->pcb_save = &pcb2->pcb_user_save; 199 |
|
197 /* Point mdproc and then copy over td1's contents */ 198 mdp2 = &p2->p_md; 199 bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); 200 201 /* 202 * Create a new fresh stack for the new process. 203 * Copy the trap frame for the return to user mode as if from a 204 * syscall. This copies most of the user mode register values. --- 162 unchanged lines hidden (view full) --- 367void 368cpu_thread_alloc(struct thread *td) 369{ 370 371 td->td_pcb = (struct pcb *)(td->td_kstack + 372 td->td_kstack_pages * PAGE_SIZE) - 1; 373 td->td_frame = (struct trapframe *)((caddr_t)td->td_pcb - 16) - 1; 374 td->td_pcb->pcb_ext = NULL; | 200 /* Point mdproc and then copy over td1's contents */ 201 mdp2 = &p2->p_md; 202 bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); 203 204 /* 205 * Create a new fresh stack for the new process. 206 * Copy the trap frame for the return to user mode as if from a 207 * syscall. This copies most of the user mode register values. --- 162 unchanged lines hidden (view full) --- 370void 371cpu_thread_alloc(struct thread *td) 372{ 373 374 td->td_pcb = (struct pcb *)(td->td_kstack + 375 td->td_kstack_pages * PAGE_SIZE) - 1; 376 td->td_frame = (struct trapframe *)((caddr_t)td->td_pcb - 16) - 1; 377 td->td_pcb->pcb_ext = NULL; |
378 td->td_pcb->pcb_save = &td->td_pcb->pcb_user_save; |
|
375} 376 377void 378cpu_thread_free(struct thread *td) 379{ 380 381 cpu_thread_clean(td); 382} --- 49 unchanged lines hidden (view full) --- 432 pcb2 = td->td_pcb; 433 434 /* 435 * Copy the upcall pcb. This loads kernel regs. 436 * Those not loaded individually below get their default 437 * values here. 438 */ 439 bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); | 379} 380 381void 382cpu_thread_free(struct thread *td) 383{ 384 385 cpu_thread_clean(td); 386} --- 49 unchanged lines hidden (view full) --- 436 pcb2 = td->td_pcb; 437 438 /* 439 * Copy the upcall pcb. This loads kernel regs. 440 * Those not loaded individually below get their default 441 * values here. 442 */ 443 bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); |
440 pcb2->pcb_flags &= ~(PCB_NPXTRAP|PCB_NPXINITDONE); | 444 pcb2->pcb_flags &= ~(PCB_NPXTRAP|PCB_NPXINITDONE|PCB_NPXUSERINITDONE); 445 pcb2->pcb_save = &pcb2->pcb_user_save; |
441 442 /* 443 * Create a new fresh stack for the new thread. 444 */ 445 bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); 446 447 /* If the current thread has the trap bit set (i.e. a debugger had 448 * single stepped the process to the system call), we need to clear --- 504 unchanged lines hidden --- | 446 447 /* 448 * Create a new fresh stack for the new thread. 449 */ 450 bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); 451 452 /* If the current thread has the trap bit set (i.e. a debugger had 453 * single stepped the process to the system call), we need to clear --- 504 unchanged lines hidden --- |