Update of /cvsroot/linux-vax/kernel-2.5/include/asm-vax/mm
In directory sc8-pr-cvs1:/tmp/cvs-serv25284
Modified Files:
pagelet_pte.h
Log Message:
Add arch-dependent macros for non-linear file mappings, and small
clean-ups (including removing unused PAGELET_SET/CLEAR_BIT macros)
Index: pagelet_pte.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.5/include/asm-vax/mm/pagelet_pte.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- pagelet_pte.h 28 Dec 2002 02:12:01 -0000 1.5
+++ pagelet_pte.h 26 Aug 2003 23:20:39 -0000 1.6
@@ -33,7 +33,6 @@
* Note that the first hwpte is the one that linux sees.
* The first hwpte is used for all tests except
* the dirty test, which has to be applied to all */
-/*typedef unsigned long hwpte_t;*/
typedef struct pagelet_pagecluster {
unsigned long pte;
@@ -70,7 +69,7 @@
/* to find an entry in a page-table */
#define PAGE_PTR(address) \
-((unsigned long)(((address)>>PAGE_SHIFT)<<SIZEOF_PTE_LOG2)&PTE_MASK&~PAGE_MASK)
+ ((unsigned long)(((address)>>PAGE_SHIFT)<<SIZEOF_PTE_LOG2)&PTE_MASK&~PAGE_MASK)
/* Certain architectures need to do special things when PTEs
@@ -174,26 +173,6 @@
}
-#define PAGELET_SET_BIT(x, y) \
- (x).pte |= y; \
- (x).pte1 |= y; \
- (x).pte2 |= y; \
- (x).pte3 |= y; \
- (x).pte4 |= y; \
- (x).pte5 |= y; \
- (x).pte6 |= y; \
- (x).pte7 |= y
-
-#define PAGELET_CLEAR_BIT(x, y) \
- (x).pte &= ~(y); \
- (x).pte1 &= ~(y); \
- (x).pte2 &= ~(y); \
- (x).pte3 &= ~(y); \
- (x).pte4 &= ~(y); \
- (x).pte5 &= ~(y); \
- (x).pte6 &= ~(y); \
- (x).pte7 &= ~(y)
-
/* who needs that
* extern inline int pte_read(pte_t pte) { return !(pte_val(pte) & _PAGE_INVALID); }
@@ -305,5 +284,36 @@
return pte;
}
+/* Support for non-linear page mappings. Linux implements this by using
+ one bit in a non-VALID PTE to distinguish a page in swap from a page
+ in a file mapping. All remaining PTE bits that are not used by the
+ hardware (for non-VALID PTEs, i.e. non-resident pages) are used to
+ encode the file offset. VAX has bits 25-23, 21-0 available. We'll
+ use bit 25 as the SWAP-vs-mappedfile selector and bits 23, 21-0 as
+ file offset bits. */
+
+#define _PAGE_FILE 0x02000000
+#define PTE_FILE_MAX_BITS 23
+
+#define pte_to_pgoffX(p) \
+ (((pte >> 1) & 0x00800000) + ((p).pte & 0x003fffff))
+
+static inline unsigned long pte_to_pgoff(pte_t pte) {
+ return ((pte_val(pte) & 0x00800000) >> 1) + (pte_val(pte) & 0x003fffff);
+}
+
+static inline pte_t pgoff_to_pte(unsigned long pgoff) {
+ pte_t pte;
+
+ /* This only sets the first hwpte in the resulting PTE structure,
+ but that's OK, since set_pte() will be used to actually store
+ this in a real hardware-visible page table entry */
+ pte_val(pte) = ((pgoff << 1) & 0x00800000) + (pgoff & 0x003fffff);
+ return pte;
+}
+
+static inline int pte_file(pte_t pte) {
+ return (pte_val(pte) & _PAGE_FILE);
+}
#endif
|