linux-mips
[Top] [All Lists]

[PATCH 2/4] MIPS: Fixup check for invalid scratch register

To: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: [PATCH 2/4] MIPS: Fixup check for invalid scratch register
From: "Jayachandran C" <jchandra@broadcom.com>
Date: Tue, 11 Jun 2013 21:11:36 +0530
Cc: "Jayachandran C" <jchandra@broadcom.com>
In-reply-to: <1370965298-29210-1-git-send-email-jchandra@broadcom.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1370965298-29210-1-git-send-email-jchandra@broadcom.com>
Sender: linux-mips-bounce@linux-mips.org
The invalid value for scratch register is -1, so update the checks of
the form (scratch_reg > 0) to be (scratch_reg >= 0).  This will fix
the case in Netlogic XLP where the scratch_reg can be 0.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
---
 arch/mips/mm/tlbex.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index b2eaa1c..4a6817c 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -349,7 +349,7 @@ static struct work_registers __cpuinit 
build_get_work_registers(u32 **p)
        int smp_processor_id_sel;
        int smp_processor_id_shift;
 
-       if (scratch_reg > 0) {
+       if (scratch_reg >= 0) {
                /* Save in CPU local C0_KScratch? */
                UASM_i_MTC0(p, 1, c0_kscratch(), scratch_reg);
                r.r1 = K0;
@@ -399,7 +399,7 @@ static struct work_registers __cpuinit 
build_get_work_registers(u32 **p)
 
 static void __cpuinit build_restore_work_registers(u32 **p)
 {
-       if (scratch_reg > 0) {
+       if (scratch_reg >= 0) {
                UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
                return;
        }
@@ -688,7 +688,7 @@ static __cpuinit void build_restore_pagemask(u32 **p,
                        uasm_i_mtc0(p, 0, C0_PAGEMASK);
                        uasm_il_b(p, r, lid);
                }
-               if (scratch_reg > 0)
+               if (scratch_reg >= 0)
                        UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
                else
                        UASM_i_LW(p, 1, scratchpad_offset(0), 0);
@@ -944,7 +944,7 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, 
struct uasm_reloc **r,
                uasm_i_jr(p, ptr);
 
                if (mode == refill_scratch) {
-                       if (scratch_reg > 0)
+                       if (scratch_reg >= 0)
                                UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
                        else
                                UASM_i_LW(p, 1, scratchpad_offset(0), 0);
@@ -1301,7 +1301,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
        memset(relocs, 0, sizeof(relocs));
        memset(final_handler, 0, sizeof(final_handler));
 
-       if ((scratch_reg > 0 || scratchpad_available()) && use_bbit_insns()) {
+       if ((scratch_reg >= 0 || scratchpad_available()) && use_bbit_insns()) {
                htlb_info = build_fast_tlb_refill_handler(&p, &l, &r, K0, K1,
                                                          scratch_reg);
                vmalloc_mode = refill_scratch;
-- 
1.7.9.5



<Prev in Thread] Current Thread [Next in Thread>