trap.c (212715) | trap.c (212722) |
---|---|
1/*- 2 * Copyright (C) 1995, 1996 Wolfgang Solfrank. 3 * Copyright (C) 1995, 1996 TooLs GmbH. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 * $NetBSD: trap.c,v 1.58 2002/03/04 04:07:35 dbj Exp $ 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (C) 1995, 1996 Wolfgang Solfrank. 3 * Copyright (C) 1995, 1996 TooLs GmbH. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 * $NetBSD: trap.c,v 1.58 2002/03/04 04:07:35 dbj Exp $ 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/powerpc/aim/trap.c 212715 2010-09-16 00:22:25Z nwhitehorn $"); | 35__FBSDID("$FreeBSD: head/sys/powerpc/aim/trap.c 212722 2010-09-16 03:46:17Z nwhitehorn $"); |
36 37#include <sys/param.h> 38#include <sys/kdb.h> 39#include <sys/proc.h> 40#include <sys/ktr.h> 41#include <sys/lock.h> 42#include <sys/mutex.h> 43#include <sys/pioctl.h> --- 396 unchanged lines hidden (view full) --- 440 error = syscallenter(td, &sa); 441 syscallret(td, error, &sa); 442} 443 444#ifdef __powerpc64__ 445static int 446handle_slb_spill(pmap_t pm, vm_offset_t addr) 447{ | 36 37#include <sys/param.h> 38#include <sys/kdb.h> 39#include <sys/proc.h> 40#include <sys/ktr.h> 41#include <sys/lock.h> 42#include <sys/mutex.h> 43#include <sys/pioctl.h> --- 396 unchanged lines hidden (view full) --- 440 error = syscallenter(td, &sa); 441 syscallret(td, error, &sa); 442} 443 444#ifdef __powerpc64__ 445static int 446handle_slb_spill(pmap_t pm, vm_offset_t addr) 447{ |
448 struct slb kern_entry, *user_entry; | 448 struct slb *user_entry; |
449 uint64_t esid; 450 int i; 451 452 esid = (uintptr_t)addr >> ADDR_SR_SHFT; 453 454 if (pm == kernel_pmap) { | 449 uint64_t esid; 450 int i; 451 452 esid = (uintptr_t)addr >> ADDR_SR_SHFT; 453 454 if (pm == kernel_pmap) { |
455 kern_entry.slbv = kernel_va_to_slbv(addr); 456 kern_entry.slbe = (esid << SLBE_ESID_SHIFT) | SLBE_VALID; 457 458 slb_insert(pm, PCPU_GET(slb), &kern_entry); | 455 slb_insert_kernel((esid << SLBE_ESID_SHIFT) | SLBE_VALID, 456 kernel_va_to_slbv(addr)); |
459 return (0); 460 } 461 462 PMAP_LOCK(pm); 463 user_entry = user_va_to_slb_entry(pm, addr); 464 465 if (user_entry == NULL) { 466 /* allocate_vsid auto-spills it */ | 457 return (0); 458 } 459 460 PMAP_LOCK(pm); 461 user_entry = user_va_to_slb_entry(pm, addr); 462 463 if (user_entry == NULL) { 464 /* allocate_vsid auto-spills it */ |
467 (void)allocate_vsid(pm, esid, 0); | 465 (void)allocate_user_vsid(pm, esid, 0); |
468 } else { 469 /* 470 * Check that another CPU has not already mapped this. 471 * XXX: Per-thread SLB caches would be better. 472 */ | 466 } else { 467 /* 468 * Check that another CPU has not already mapped this. 469 * XXX: Per-thread SLB caches would be better. 470 */ |
473 for (i = 0; i < 64; i++) 474 if (pm->pm_slb[i].slbe == (user_entry->slbe | i)) | 471 for (i = 0; i < pm->pm_slb_len; i++) 472 if (pm->pm_slb[i] == user_entry) |
475 break; 476 | 473 break; 474 |
477 if (i == 64) 478 slb_insert(pm, pm->pm_slb, user_entry); | 475 if (i == pm->pm_slb_len) 476 slb_insert_user(pm, user_entry); |
479 } 480 PMAP_UNLOCK(pm); 481 482 return (0); 483} 484#endif 485 486static int --- 199 unchanged lines hidden --- | 477 } 478 PMAP_UNLOCK(pm); 479 480 return (0); 481} 482#endif 483 484static int --- 199 unchanged lines hidden --- |