linux-mips
[Top] [All Lists]

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

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH urgent] MIPS: fix micro-assembly overflow in set_except_vector
From: Florian Fainelli <florian@openwrt.org>
Date: Mon, 1 Feb 2010 10:27:37 +0100
Cc: linux-mips@linux-mips.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:date:subject :mime-version:x-uid:x-length:organization:to:cc:content-type :content-transfer-encoding:message-id; bh=5TKzJZl21hUDpkOFhz206kqhzn2qGGreMr/Xg/3Ki0M=; b=aKmb5pTcq2Pw8XU3WWPQkchjFHpVQjdkkcGnTk3FzAPQ1kb8hefdLwhMSEWPsnCMGJ /pFOW2oGbnvZjRjDeioRep4iUpZWkSOraIE/O+zw8dJlJYapwOGhLuKMnP8SmQl3QujY 7ri69UggtPJ8mWkEqWh/7jGTsaxNxcd+NkCD8=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:date:subject:mime-version:x-uid:x-length:organization :to:cc:content-type:content-transfer-encoding:message-id; b=fO3VBh6txjCRm+i7hg3ntdD3awcqn/ktstXRmPIFOu2vgo9reRxQAj4g5Lj6U7BRaU z/OPTR4hc72+l7QQC6rDUtfpiDu8aZoG7fwGX0rUlmxSeIfqdFCgmw8K5p1hMYaVYoNF oUtrvZvx52IRVBAiBoi/sBYGh7zAwSu7VnwV8=
Organization: OpenWrt
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
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>
---
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>