From: NIIBE Y. <gn...@ch...> - 2000-05-18 07:58:14
|
I tried swap, and soon found problem. The implementation was quite buggy. Here is the fix. I'll commit this change and the fix of handle_vmalloc_fault. 2000-05-18 NIIBE Yutaka <gn...@m1...> * include/asm-sh/pgtable.h (mk_pte_phys): Bug fix. Added __MEMORY_START. Bug fixes for swap entry encoding and pte encoding. (_PAGE_FLAGS_HARDWARE_MASK): Mask V-bit. (_PAGE_FLAGS_HARDWARE_DEFAULT): Enable V-bit. Make _PAGE_PRESENT as software flag, and let it be the b0-bit. Index: include/asm-sh/pgtable.h =================================================================== RCS file: /cvsroot/linuxsh/kernel/include/asm-sh/pgtable.h,v retrieving revision 1.2 diff -u -r1.2 pgtable.h --- include/asm-sh/pgtable.h 2000/04/30 00:50:23 1.2 +++ include/asm-sh/pgtable.h 2000/05/18 07:52:35 @@ -89,26 +89,26 @@ #define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END P4SEG -#define _PAGE_READ 0x001 /* software: read access allowed */ +#define _PAGE_PRESENT 0x001 /* software: page is present */ #define _PAGE_ACCESSED 0x002 /* software: page referenced */ #define _PAGE_DIRTY 0x004 /* D-bit : page changed */ #define _PAGE_CACHABLE 0x008 /* C-bit : cachable */ -/* 0x010 */ +/* 0x010 SZ-bit : size of page */ #define _PAGE_RW 0x020 /* PR0-bit : write access allowed */ #define _PAGE_USER 0x040 /* PR1-bit : user space access allowed */ #define _PAGE_PROTNONE 0x080 /* software: if not present */ -#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */ +/* 0x100 V-bit : page is valid */ #if defined(__sh3__) /* Mask which drop software flags */ -#define _PAGE_FLAGS_HARDWARE_MASK 0x1ffff16c +#define _PAGE_FLAGS_HARDWARE_MASK 0x1ffff06c /* Flags defalult: SZ=1 (4k-byte), C=0 (non-cachable), SH=0 (not shared) */ -#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x00000010 +#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x00000110 #elif defined(__SH4__) /* Mask which drops software flags */ -#define _PAGE_FLAGS_HARDWARE_MASK 0x1ffff16c +#define _PAGE_FLAGS_HARDWARE_MASK 0x1ffff06c /* Flags defalult: SZ=01 (4k-byte), C=0 (non-cachable), SH=0 (not shared), WT=0 */ -#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x00000010 +#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x00000110 #endif #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) @@ -208,7 +208,7 @@ /* This takes a physical page address that is used by the remapping functions */ #define mk_pte_phys(physpage, pgprot) \ -({ pte_t __pte; set_pte(&__pte, __pte(physpage + pgprot_val(pgprot))); __pte; }) +({ pte_t __pte; set_pte(&__pte, __pte(physpage + pgprot_val(pgprot) + __MEMORY_START)); __pte; }) extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; } |