vm_machdep.c (209812) | vm_machdep.c (209950) |
---|---|
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 --- 24 unchanged lines hidden (view full) --- 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 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$ | 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 --- 24 unchanged lines hidden (view full) --- 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 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 * $FreeBSD: head/sys/powerpc/aim/vm_machdep.c 209812 2010-07-08 15:38:55Z nwhitehorn $ | 41 * $FreeBSD: head/sys/powerpc/aim/vm_machdep.c 209950 2010-07-12 16:08:07Z nwhitehorn $ |
42 */ 43/*- 44 * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. 45 * All rights reserved. 46 * 47 * Author: Chris G. Demetriou 48 * 49 * Permission to use, copy, modify and distribute this software and --- 303 unchanged lines hidden (view full) --- 353} 354 355/* 356 * Software interrupt handler for queued VM system processing. 357 */ 358void 359swi_vm(void *dummy) 360{ | 42 */ 43/*- 44 * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. 45 * All rights reserved. 46 * 47 * Author: Chris G. Demetriou 48 * 49 * Permission to use, copy, modify and distribute this software and --- 303 unchanged lines hidden (view full) --- 353} 354 355/* 356 * Software interrupt handler for queued VM system processing. 357 */ 358void 359swi_vm(void *dummy) 360{ |
361 |
|
361 if (busdma_swi_pending != 0) 362 busdma_swi(); 363} 364 365/* 366 * Tell whether this address is in some physical memory region. 367 * Currently used by the kernel coredump code in order to avoid 368 * dumping the ``ISA memory hole'' which could cause indefinite hangs, --- 11 unchanged lines hidden (view full) --- 380 */ 381 382 return 1; 383} 384 385/* 386 * Threading functions 387 */ | 362 if (busdma_swi_pending != 0) 363 busdma_swi(); 364} 365 366/* 367 * Tell whether this address is in some physical memory region. 368 * Currently used by the kernel coredump code in order to avoid 369 * dumping the ``ISA memory hole'' which could cause indefinite hangs, --- 11 unchanged lines hidden (view full) --- 381 */ 382 383 return 1; 384} 385 386/* 387 * Threading functions 388 */ |
388void 389cpu_thread_exit(struct thread *td) 390{ 391} | |
392 393void | 389 390void |
394cpu_thread_clean(struct thread *td) 395{ 396} 397 398void 399cpu_thread_alloc(struct thread *td) 400{ 401 struct pcb *pcb; 402 403 pcb = (struct pcb *)((td->td_kstack + td->td_kstack_pages * PAGE_SIZE - 404 sizeof(struct pcb)) & ~0x2fU); 405 td->td_pcb = pcb; 406 td->td_frame = (struct trapframe *)pcb - 1; 407} 408 409void 410cpu_thread_free(struct thread *td) 411{ 412} 413 414void | |
415cpu_thread_swapin(struct thread *td) 416{ 417} 418 419void 420cpu_thread_swapout(struct thread *td) 421{ 422} 423 | 391cpu_thread_swapin(struct thread *td) 392{ 393} 394 395void 396cpu_thread_swapout(struct thread *td) 397{ 398} 399 |
424void 425cpu_set_syscall_retval(struct thread *td, int error) 426{ 427 struct proc *p; 428 struct trapframe *tf; 429 int fixup; 430 431 if (error == EJUSTRETURN) 432 return; 433 434 p = td->td_proc; 435 tf = td->td_frame; 436 437 if (tf->fixreg[0] == SYS___syscall) { 438 int code = tf->fixreg[FIRSTARG + 1]; 439 if (p->p_sysent->sv_mask) 440 code &= p->p_sysent->sv_mask; 441 fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek) ? 442 1 : 0; 443 } else 444 fixup = 0; 445 446 switch (error) { 447 case 0: 448 if (fixup) { 449 /* 450 * 64-bit return, 32-bit syscall. Fixup byte order 451 */ 452 tf->fixreg[FIRSTARG] = 0; 453 tf->fixreg[FIRSTARG + 1] = td->td_retval[0]; 454 } else { 455 tf->fixreg[FIRSTARG] = td->td_retval[0]; 456 tf->fixreg[FIRSTARG + 1] = td->td_retval[1]; 457 } 458 tf->cr &= ~0x10000000; /* XXX: Magic number */ 459 break; 460 case ERESTART: 461 /* 462 * Set user's pc back to redo the system call. 463 */ 464 tf->srr0 -= 4; 465 break; 466 default: 467 if (p->p_sysent->sv_errsize) { 468 error = (error < p->p_sysent->sv_errsize) ? 469 p->p_sysent->sv_errtbl[error] : -1; 470 } 471 tf->fixreg[FIRSTARG] = error; 472 tf->cr |= 0x10000000; /* XXX: Magic number */ 473 break; 474 } 475} 476 477void 478cpu_set_upcall(struct thread *td, struct thread *td0) 479{ 480 struct pcb *pcb2; 481 struct trapframe *tf; 482 struct callframe *cf; 483 484 pcb2 = td->td_pcb; 485 486 /* Copy the upcall pcb */ 487 bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); 488 489 /* Create a stack for the new thread */ 490 tf = td->td_frame; 491 bcopy(td0->td_frame, tf, sizeof(struct trapframe)); 492 tf->fixreg[FIRSTARG] = 0; 493 tf->fixreg[FIRSTARG + 1] = 0; 494 tf->cr &= ~0x10000000; 495 496 /* Set registers for trampoline to user mode. */ 497 cf = (struct callframe *)tf - 1; 498 memset(cf, 0, sizeof(struct callframe)); 499 cf->cf_func = (register_t)fork_return; 500 cf->cf_arg0 = (register_t)td; 501 cf->cf_arg1 = (register_t)tf; 502 503 pcb2->pcb_sp = (register_t)cf; 504 pcb2->pcb_lr = (register_t)fork_trampoline; 505 pcb2->pcb_cpu.aim.usr = kernel_pmap->pm_sr[USER_SR]; 506 507 /* Setup to release spin count in fork_exit(). */ 508 td->td_md.md_spinlock_count = 1; 509 td->td_md.md_saved_msr = PSL_KERNSET; 510} 511 512void 513cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg, 514 stack_t *stack) 515{ 516 struct trapframe *tf; 517 uint32_t sp; 518 519 tf = td->td_frame; 520 /* align stack and alloc space for frame ptr and saved LR */ 521 sp = ((uint32_t)stack->ss_sp + stack->ss_size - sizeof(uint64_t)) & 522 ~0x1f; 523 bzero(tf, sizeof(struct trapframe)); 524 525 tf->fixreg[1] = (register_t)sp; 526 tf->fixreg[3] = (register_t)arg; 527 tf->srr0 = (register_t)entry; 528 tf->srr1 = PSL_MBO | PSL_USERSET | PSL_FE_DFLT; 529 td->td_pcb->pcb_flags = 0; 530 531 td->td_retval[0] = (register_t)entry; 532 td->td_retval[1] = 0; 533} 534 535int 536cpu_set_user_tls(struct thread *td, void *tls_base) 537{ 538 539 td->td_frame->fixreg[2] = (register_t)tls_base + 0x7008; 540 return (0); 541} | |