Peter Horton wrote this patch up several weeks ago for Cobalt, but it's applicable for all MIPS machines I've seen thus far (atleast SGI and Cobalt). It fixes the kernel panic resulting from trying to activate swap on a system running 2.6.5 and up. It's been in Gentoo's mips-sources for quite some time, and I've had no problems with it on my O2 or Cobalt.
--Kumba
--
"Such is oft the course of deeds that move the wheels of the world: small hands do them because they must, while the eyes of the great are elsewhere." --Elrond
diff -urN include/asm-mips/pgtable-32.h include/asm-mips/pgtable-32.h --- include/asm-mips/pgtable-32.h 2004-03-11 16:46:57.000000000 +0000 +++ include/asm-mips/pgtable-32.h 2004-04-17 09:06:02.000000000 +0100 @@ -203,14 +203,18 @@ /* Swap entries must have VALID and GLOBAL bits cleared. */ #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) -#define __swp_type(x) (((x).val >> 1) & 0x7f) -#define __swp_offset(x) ((x).val >> 10) -#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 10) }) +/* offset is limited to 17 bits (512MB @ 4K page) */ +/* VALID & GLOBAL are bits 9 & 8 */ +#define __swp_type(x) (((x).val >> 10) & 0x1f) +#define __swp_offset(x) ((x).val >> 15) +#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 10) | ((offset) << 15) }) #else -#define __swp_type(x) (((x).val >> 1) & 0x1f) -#define __swp_offset(x) ((x).val >> 8) -#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 8) }) +/* offset is limited to 19 bits (2GB @ 4K page) */ +/* VALID & GLOBAL are bits 7 & 6 */ +#define __swp_type(x) (((x).val >> 8) & 0x1f) +#define __swp_offset(x) ((x).val >> 13) +#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 8) | ((offset) << 13) }) #endif #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })