vm_machdep.c (216255) | vm_machdep.c (216634) |
---|---|
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/amd64/amd64/vm_machdep.c 216255 2010-12-07 12:44:33Z kib $"); | 44__FBSDID("$FreeBSD: head/sys/amd64/amd64/vm_machdep.c 216634 2010-12-22 00:18:42Z jkim $"); |
45 46#include "opt_isa.h" 47#include "opt_cpu.h" 48#include "opt_compat.h" 49 50#include <sys/param.h> 51#include <sys/systm.h> 52#include <sys/bio.h> --- 132 unchanged lines hidden (view full) --- 185 /* Setup to release spin count in fork_exit(). */ 186 td2->td_md.md_spinlock_count = 1; 187 td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; 188 189 /* As an i386, do not copy io permission bitmap. */ 190 pcb2->pcb_tssp = NULL; 191 192 /* New segment registers. */ | 45 46#include "opt_isa.h" 47#include "opt_cpu.h" 48#include "opt_compat.h" 49 50#include <sys/param.h> 51#include <sys/systm.h> 52#include <sys/bio.h> --- 132 unchanged lines hidden (view full) --- 185 /* Setup to release spin count in fork_exit(). */ 186 td2->td_md.md_spinlock_count = 1; 187 td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; 188 189 /* As an i386, do not copy io permission bitmap. */ 190 pcb2->pcb_tssp = NULL; 191 192 /* New segment registers. */ |
193 pcb2->pcb_full_iret = 1; | 193 set_pcb_flags(pcb2, PCB_FULL_IRET); |
194 195 /* Copy the LDT, if necessary. */ 196 mdp1 = &td1->td_proc->p_md; 197 mdp2 = &p2->p_md; 198 mtx_lock(&dt_lock); 199 if (mdp1->md_ldt != NULL) { 200 if (flags & RFMEM) { 201 mdp1->md_ldt->ldt_refcnt++; --- 68 unchanged lines hidden (view full) --- 270 fpudrop(); 271 critical_exit(); 272 273 pcb = td->td_pcb; 274 275 /* Disable any hardware breakpoints. */ 276 if (pcb->pcb_flags & PCB_DBREGS) { 277 reset_dbregs(); | 194 195 /* Copy the LDT, if necessary. */ 196 mdp1 = &td1->td_proc->p_md; 197 mdp2 = &p2->p_md; 198 mtx_lock(&dt_lock); 199 if (mdp1->md_ldt != NULL) { 200 if (flags & RFMEM) { 201 mdp1->md_ldt->ldt_refcnt++; --- 68 unchanged lines hidden (view full) --- 270 fpudrop(); 271 critical_exit(); 272 273 pcb = td->td_pcb; 274 275 /* Disable any hardware breakpoints. */ 276 if (pcb->pcb_flags & PCB_DBREGS) { 277 reset_dbregs(); |
278 pcb->pcb_flags &= ~PCB_DBREGS; | 278 clear_pcb_flags(pcb, PCB_DBREGS); |
279 } 280} 281 282void 283cpu_thread_clean(struct thread *td) 284{ 285 struct pcb *pcb; 286 --- 93 unchanged lines hidden (view full) --- 380 pcb2 = td->td_pcb; 381 382 /* 383 * Copy the upcall pcb. This loads kernel regs. 384 * Those not loaded individually below get their default 385 * values here. 386 */ 387 bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); | 279 } 280} 281 282void 283cpu_thread_clean(struct thread *td) 284{ 285 struct pcb *pcb; 286 --- 93 unchanged lines hidden (view full) --- 380 pcb2 = td->td_pcb; 381 382 /* 383 * Copy the upcall pcb. This loads kernel regs. 384 * Those not loaded individually below get their default 385 * values here. 386 */ 387 bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); |
388 pcb2->pcb_flags &= ~(PCB_FPUINITDONE | PCB_USERFPUINITDONE); | 388 clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE); |
389 pcb2->pcb_save = &pcb2->pcb_user_save; | 389 pcb2->pcb_save = &pcb2->pcb_user_save; |
390 pcb2->pcb_full_iret = 1; | 390 set_pcb_flags(pcb2, PCB_FULL_IRET); |
391 392 /* 393 * Create a new fresh stack for the new thread. 394 */ 395 bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); 396 397 /* If the current thread has the trap bit set (i.e. a debugger had 398 * single stepped the process to the system call), we need to clear --- 87 unchanged lines hidden (view full) --- 486 * function as a parameter on the stack. 487 */ 488 td->td_frame->tf_rdi = (register_t)arg; 489} 490 491int 492cpu_set_user_tls(struct thread *td, void *tls_base) 493{ | 391 392 /* 393 * Create a new fresh stack for the new thread. 394 */ 395 bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); 396 397 /* If the current thread has the trap bit set (i.e. a debugger had 398 * single stepped the process to the system call), we need to clear --- 87 unchanged lines hidden (view full) --- 486 * function as a parameter on the stack. 487 */ 488 td->td_frame->tf_rdi = (register_t)arg; 489} 490 491int 492cpu_set_user_tls(struct thread *td, void *tls_base) 493{ |
494 struct pcb *pcb; |
|
494 495 if ((u_int64_t)tls_base >= VM_MAXUSER_ADDRESS) 496 return (EINVAL); 497 | 495 496 if ((u_int64_t)tls_base >= VM_MAXUSER_ADDRESS) 497 return (EINVAL); 498 |
499 pcb = td->td_pcb; |
|
498#ifdef COMPAT_FREEBSD32 499 if (td->td_proc->p_sysent->sv_flags & SV_ILP32) { | 500#ifdef COMPAT_FREEBSD32 501 if (td->td_proc->p_sysent->sv_flags & SV_ILP32) { |
500 td->td_pcb->pcb_gsbase = (register_t)tls_base; | 502 pcb->pcb_gsbase = (register_t)tls_base; |
501 return (0); 502 } 503#endif | 503 return (0); 504 } 505#endif |
504 td->td_pcb->pcb_fsbase = (register_t)tls_base; 505 td->td_pcb->pcb_full_iret = 1; | 506 pcb->pcb_fsbase = (register_t)tls_base; 507 set_pcb_flags(pcb, PCB_FULL_IRET); |
506 return (0); 507} 508 509#ifdef SMP 510static void 511cpu_reset_proxy() 512{ 513 --- 167 unchanged lines hidden --- | 508 return (0); 509} 510 511#ifdef SMP 512static void 513cpu_reset_proxy() 514{ 515 --- 167 unchanged lines hidden --- |