2008-10-23 13:26:29 +08:00
|
|
|
#ifndef _ASM_X86_PGTABLE_32_H
|
|
|
|
#define _ASM_X86_PGTABLE_32_H
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-02-09 10:49:05 +08:00
|
|
|
#include <asm/pgtable_32_types.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The Linux memory management assumes a three-level page table setup. On
|
|
|
|
* the i386, we use that, but "fold" the mid level into the top-level page
|
|
|
|
* table, so that we physically have the same two-level page table as the
|
|
|
|
* i386 mmu expects.
|
|
|
|
*
|
|
|
|
* This file contains the functions and defines necessary to modify and use
|
|
|
|
* the i386 page table tree.
|
|
|
|
*/
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/fixmap.h>
|
|
|
|
#include <linux/threads.h>
|
2006-12-07 09:14:08 +08:00
|
|
|
#include <asm/paravirt.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-10-19 14:40:25 +08:00
|
|
|
#include <linux/bitops.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
|
2005-11-07 16:59:43 +08:00
|
|
|
struct mm_struct;
|
|
|
|
struct vm_area_struct;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
extern pgd_t swapper_pg_dir[1024];
|
2010-08-28 21:58:33 +08:00
|
|
|
extern pgd_t initial_page_table[1024];
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-03-09 20:14:37 +08:00
|
|
|
static inline void pgtable_cache_init(void) { }
|
|
|
|
static inline void check_pgt_cache(void) { }
|
2005-04-17 06:20:36 +08:00
|
|
|
void paging_init(void);
|
|
|
|
|
2008-07-23 20:11:59 +08:00
|
|
|
extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t);
|
2007-05-13 02:15:24 +08:00
|
|
|
|
2008-08-21 07:43:03 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Define this if things work differently on an i386 and an i486:
|
|
|
|
* it will (on an i486) warn about kernel memory accesses that are
|
2005-05-01 23:59:08 +08:00
|
|
|
* done without a 'access_ok(VERIFY_WRITE,..)'
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2005-05-01 23:59:08 +08:00
|
|
|
#undef TEST_ACCESS_OK
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_X86_PAE
|
|
|
|
# include <asm/pgtable-3level.h>
|
|
|
|
#else
|
|
|
|
# include <asm/pgtable-2level.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(CONFIG_HIGHPTE)
|
2008-03-23 16:03:09 +08:00
|
|
|
#define pte_offset_map(dir, address) \
|
2010-10-27 05:21:52 +08:00
|
|
|
((pte_t *)kmap_atomic(pmd_page(*(dir))) + \
|
2008-03-23 16:03:09 +08:00
|
|
|
pte_index((address)))
|
2010-10-27 05:21:52 +08:00
|
|
|
#define pte_unmap(pte) kunmap_atomic((pte))
|
2005-04-17 06:20:36 +08:00
|
|
|
#else
|
2008-03-23 16:03:09 +08:00
|
|
|
#define pte_offset_map(dir, address) \
|
|
|
|
((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address)))
|
2005-04-17 06:20:36 +08:00
|
|
|
#define pte_unmap(pte) do { } while (0)
|
|
|
|
#endif
|
|
|
|
|
2006-10-01 14:29:35 +08:00
|
|
|
/* Clear a kernel PTE and flush it from the TLB */
|
2008-03-23 16:03:09 +08:00
|
|
|
#define kpte_clear_flush(ptep, vaddr) \
|
|
|
|
do { \
|
|
|
|
pte_clear(&init_mm, (vaddr), (ptep)); \
|
|
|
|
__flush_tlb_one((vaddr)); \
|
2006-10-01 14:29:35 +08:00
|
|
|
} while (0)
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
|
2008-01-30 20:30:37 +08:00
|
|
|
/*
|
|
|
|
* kern_addr_valid() is (1) for FLATMEM and (0) for
|
|
|
|
* SPARSEMEM and DISCONTIGMEM
|
|
|
|
*/
|
2005-06-23 15:07:57 +08:00
|
|
|
#ifdef CONFIG_FLATMEM
|
2005-04-17 06:20:36 +08:00
|
|
|
#define kern_addr_valid(addr) (1)
|
2008-01-30 20:30:37 +08:00
|
|
|
#else
|
|
|
|
#define kern_addr_valid(kaddr) (0)
|
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-10-23 13:26:29 +08:00
|
|
|
#endif /* _ASM_X86_PGTABLE_32_H */
|