linux-mips
[Top] [All Lists]

Re: [PATCH urgent] MIPS: fix micro-assembly overflow in set_except_vecto

To: Florian Fainelli <florian@openwrt.org>
Subject: Re: [PATCH urgent] MIPS: fix micro-assembly overflow in set_except_vector
From: David Daney <ddaney@caviumnetworks.com>
Date: Mon, 01 Feb 2010 09:13:36 -0800
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
In-reply-to: <201002011027.37521.florian@openwrt.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <201002011027.37521.florian@openwrt.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 2.0.0.21 (X11/20090320)
Florian Fainelli wrote:
Commit 24a6d9866c5f15ba7e5b14dc17be4b6edba21d0e broke
the installation of handlers for boards which have their
handlers above a 1 << 26 address. Fix this by making sure that
jump_mask does not excess 0xfc000000 and add the missing ~ operator
to jump_mask when jumping to the handler address.

Reported-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Florian Fainelli <florian@openwrt.org>

Acked-by: David Daney <ddaney@caviumnetworks.com>

---
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 7693929..40d94c3 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1279,11 +1279,11 @@ void __init *set_except_vector(int n, void *addr)
exception_handlers[n] = handler;
        if (n == 0 && cpu_has_divec) {
-               unsigned long jump_mask = ~((1 << 28) - 1);
+               unsigned long jump_mask = ~((1 << 26) - 1);
                u32 *buf = (u32 *)(ebase + 0x200);
                unsigned int k0 = 26;
                if ((handler & jump_mask) == ((ebase + 0x200) & jump_mask)) {
-                       uasm_i_j(&buf, handler & jump_mask);
+                       uasm_i_j(&buf, handler & ~jump_mask);
                        uasm_i_nop(&buf);
                } else {
                        UASM_i_LA(&buf, k0, handler);





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