Skip to content

Commit 1802289

Browse files
James Hoganralfbaechle
authored andcommitted
MIPS: traps: 64bit kernels should read CP0_EBase 64bit
When reading the CP0_EBase register containing the WG (write gate) bit, the ebase variable should be set to the full value of the register, i.e. on a 64-bit kernel the full 64-bit width of the register via read_cp0_ebase_64(), and on a 32-bit kernel the full 32-bit width including bits 31:30 which may be writeable. Signed-off-by: James Hogan <[email protected]> Signed-off-by: Matt Redfearn <[email protected]> Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/14148/ Signed-off-by: Ralf Baechle <[email protected]>
1 parent 72bc8c7 commit 1802289

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

arch/mips/kernel/traps.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,8 +2215,17 @@ void __init trap_init(void)
22152215
} else {
22162216
ebase = CAC_BASE;
22172217

2218-
if (cpu_has_mips_r2_r6)
2219-
ebase += (read_c0_ebase() & 0x3ffff000);
2218+
if (cpu_has_mips_r2_r6) {
2219+
if (cpu_has_ebase_wg) {
2220+
#ifdef CONFIG_64BIT
2221+
ebase = (read_c0_ebase_64() & ~0xfff);
2222+
#else
2223+
ebase = (read_c0_ebase() & ~0xfff);
2224+
#endif
2225+
} else {
2226+
ebase += (read_c0_ebase() & 0x3ffff000);
2227+
}
2228+
}
22202229
}
22212230

22222231
if (cpu_has_mmips) {

0 commit comments

Comments
 (0)