Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/mips loongson whack-a-mole.



details:   https://anonhg.NetBSD.org/src/rev/e1fb3784c0e9
branches:  trunk
changeset: 817340:e1fb3784c0e9
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Aug 17 20:59:08 2016 +0000

description:
loongson whack-a-mole.

- clear the top bits so the legal address check is correct.
- need to sign-extend the seg offset for kernel fault check

diffstat:

 sys/arch/mips/mips/mipsX_subr.S |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (22 lines):

diff -r 7e3b0b808fe0 -r e1fb3784c0e9 sys/arch/mips/mips/mipsX_subr.S
--- a/sys/arch/mips/mips/mipsX_subr.S   Wed Aug 17 19:08:18 2016 +0000
+++ b/sys/arch/mips/mips/mipsX_subr.S   Wed Aug 17 20:59:08 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mipsX_subr.S,v 1.91 2016/08/16 09:55:14 skrll Exp $    */
+/*     $NetBSD: mipsX_subr.S,v 1.92 2016/08/17 20:59:08 skrll Exp $    */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -373,9 +373,10 @@
        nop                                     #01: nop
        PTR_SRL k1, k0, 31                      #02: clear useg bits
        beqz    k1, 2f                          #03: k1==0 -> useg address
-        PTR_SRL k1,k0,XSEGSHIFT+XSEGLENGTH     #04: clear valid bits
+        PTR_SLL k1, k0, 2                      #0x: clear top bits
+       PTR_SRL k1, XSEGSHIFT+XSEGLENGTH+2      #04: clear valid bits
        bnez    k1, MIPSX(nopagetable)          #05: not legal address
-        PTR_SRL k0, XSEGSHIFT - PTR_SCALESHIFT #06: k0=seg offset (almost)
+        PTR_SRA k0, XSEGSHIFT - PTR_SCALESHIFT #06: k0=seg offset (almost)
        bgez    k0, 1f                          #07: k0<0 -> kernel fault
         lui    k1, %hi(CPUVAR(PMAP_SEGTAB))    #08: k1=hi of segtab
        PTR_ADDI k1,  1 << PTR_SCALESHIFT       #09: kernel segtab entry



Home | Main Index | Thread Index | Old Index