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

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

 



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@xxxxxxxxxx>
Signed-off-by: Florian Fainelli <florian@xxxxxxxxxxx>
---
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);



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux