Date: Sun, 2 Aug 2009 04:23:12 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r196030 - projects/ppc64/sys/powerpc/aim Message-ID: <200908020423.n724NCbl002160@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Sun Aug 2 04:23:12 2009 New Revision: 196030 URL: http://svn.freebsd.org/changeset/base/196030 Log: Fix the onfault handler by bringing it into the new SLB world order. This brings the kernel to the same level of functionality as before I decided to redo the SLB handling. Modified: projects/ppc64/sys/powerpc/aim/trap.c Modified: projects/ppc64/sys/powerpc/aim/trap.c ============================================================================== --- projects/ppc64/sys/powerpc/aim/trap.c Sun Aug 2 02:10:27 2009 (r196029) +++ projects/ppc64/sys/powerpc/aim/trap.c Sun Aug 2 04:23:12 2009 (r196030) @@ -486,6 +486,27 @@ syscall(struct trapframe *frame) PTRACESTOP_SC(p, td, S_PT_SCX); } +#ifdef __powerpc64__ +static uint64_t +slb_esid_lookup(pmap_t pm, uint64_t vsid) +{ + uint64_t esid; + int i; + + vsid <<= SLBV_VSID_SHIFT; + + for (i = 0; i < sizeof(pm->pm_slb)/sizeof(pm->pm_slb[0]); i++) { + if ((pm->pm_slb[i].slbv & SLBV_VSID_MASK) == vsid) { + esid = pm->pm_slb[i].slbe & SLBE_ESID_MASK; + esid >>= SLBE_ESID_SHIFT; + return (esid); + } + } + + return (0); +} +#endif + static int trap_pfault(struct trapframe *frame, int user) { @@ -523,12 +544,8 @@ trap_pfault(struct trapframe *frame, int : "=r"(user_sr) : "r"(USER_SR)); - /* XXX: THIS DOES NOT WORK */ - - user_sr >>= 12; - - /* XXX - limit to 46 byte EA space */ - user_sr &= (1UL << 17) - 1UL; + user_sr >>= SLBV_VSID_SHIFT; + user_sr = slb_esid_lookup(&p->p_vmspace->vm_pmap, user_sr); #else __asm ("mfsr %0, %1"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908020423.n724NCbl002160>