Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 27132
b: refs/heads/master
c: 7cb710c
h: refs/heads/master
v: v3
  • Loading branch information
Sergei Shtylyov authored and Ralf Baechle committed Jun 5, 2006
1 parent 1a5f666 commit 5b85ec6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aa32374aaa2e516a9b0719477efae0782a62a79e
refs/heads/master: 7cb710c9a617384cd0ed30638f3acc00125690fc
45 changes: 26 additions & 19 deletions trunk/include/asm-mips/pgtable-32.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,18 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
((swp_entry_t) { ((type) << 10) | ((offset) << 15) })

/*
* Bits 0, 1, 2, 9 and 10 are taken, split up the 27 bits of offset
* into this range:
* Bits 0, 4, 8, and 9 are taken, split up 28 bits of offset into this range:
*/
#define PTE_FILE_MAX_BITS 27
#define PTE_FILE_MAX_BITS 28

#define pte_to_pgoff(_pte) \
((((_pte).pte >> 3) & 0x3f ) + (((_pte).pte >> 11) << 8 ))
#define pte_to_pgoff(_pte) ((((_pte).pte >> 1 ) & 0x07) | \
(((_pte).pte >> 2 ) & 0x38) | \
(((_pte).pte >> 10) << 6 ))

#define pgoff_to_pte(off) \
((pte_t) { (((off) & 0x3f) << 3) + (((off) >> 8) << 11) + _PAGE_FILE })
#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x07) << 1 ) | \
(((off) & 0x38) << 2 ) | \
(((off) >> 6 ) << 10) | \
_PAGE_FILE })

#else

Expand All @@ -203,24 +205,29 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
((swp_entry_t) { ((type) << 8) | ((offset) << 13) })
#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */

#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
/*
* Bits 0, 1, 2, 7 and 8 are taken, split up the 27 bits of offset
* into this range:
* Bits 0 and 1 of pte_high are taken, use the rest for the page offset...
*/
#define PTE_FILE_MAX_BITS 27
#define PTE_FILE_MAX_BITS 30

#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
/* fixme */
#define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f))
#define pgoff_to_pte(off) \
((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)})
#define pte_to_pgoff(_pte) ((_pte).pte_high >> 2)
#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) << 2 })

#else
#define pte_to_pgoff(_pte) \
((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 ))
/*
* Bits 0, 4, 6, and 7 are taken, split up 28 bits of offset into this range:
*/
#define PTE_FILE_MAX_BITS 28

#define pte_to_pgoff(_pte) ((((_pte).pte >> 1) & 0x7) | \
(((_pte).pte >> 2) & 0x8) | \
(((_pte).pte >> 8) << 4))

#define pgoff_to_pte(off) \
((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE })
#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x7) << 1) | \
(((off) & 0x8) << 2) | \
(((off) >> 4) << 8) | \
_PAGE_FILE })
#endif

#endif
Expand Down
13 changes: 5 additions & 8 deletions trunk/include/asm-mips/pgtable-64.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,12 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })

/*
* Bits 0, 1, 2, 7 and 8 are taken, split up the 32 bits of offset
* into this range:
* Bits 0, 4, 6, and 7 are taken. Let's leave bits 1, 2, 3, and 5 alone to
* make things easier, and only use the upper 56 bits for the page offset...
*/
#define PTE_FILE_MAX_BITS 32
#define PTE_FILE_MAX_BITS 56

#define pte_to_pgoff(_pte) \
((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 ))

#define pgoff_to_pte(off) \
((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE })
#define pte_to_pgoff(_pte) ((_pte).pte >> 8)
#define pgoff_to_pte(off) ((pte_t) { ((off) << 8) | _PAGE_FILE })

#endif /* _ASM_PGTABLE_64_H */

0 comments on commit 5b85ec6

Please sign in to comment.