2008-10-23 05:26:29 +00:00
|
|
|
#ifndef _ASM_X86_PGTABLE_32_H
|
|
|
|
#define _ASM_X86_PGTABLE_32_H
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2009-02-09 02:49:05 +00:00
|
|
|
#include <asm/pgtable_32_types.h>
|
2005-04-16 22:20:36 +00: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 01:14:08 +00:00
|
|
|
#include <asm/paravirt.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-10-19 06:40:25 +00:00
|
|
|
#include <linux/bitops.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
|
2005-11-07 08:59:43 +00:00
|
|
|
struct mm_struct;
|
|
|
|
struct vm_area_struct;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
extern pgd_t swapper_pg_dir[1024];
|
2010-08-28 13:58:33 +00:00
|
|
|
extern pgd_t initial_page_table[1024];
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-03-09 12:14:37 +00:00
|
|
|
static inline void pgtable_cache_init(void) { }
|
|
|
|
static inline void check_pgt_cache(void) { }
|
2005-04-16 22:20:36 +00:00
|
|
|
void paging_init(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 15:59:08 +00:00
|
|
|
* done without a 'access_ok(VERIFY_WRITE,..)'
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2005-05-01 15:59:08 +00:00
|
|
|
#undef TEST_ACCESS_OK
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_X86_PAE
|
|
|
|
# include <asm/pgtable-3level.h>
|
|
|
|
#else
|
|
|
|
# include <asm/pgtable-2level.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(CONFIG_HIGHPTE)
|
2008-03-23 08:03:09 +00:00
|
|
|
#define pte_offset_map(dir, address) \
|
2010-10-26 21:21:52 +00:00
|
|
|
((pte_t *)kmap_atomic(pmd_page(*(dir))) + \
|
2008-03-23 08:03:09 +00:00
|
|
|
pte_index((address)))
|
2010-10-26 21:21:52 +00:00
|
|
|
#define pte_unmap(pte) kunmap_atomic((pte))
|
2005-04-16 22:20:36 +00:00
|
|
|
#else
|
2008-03-23 08:03:09 +00:00
|
|
|
#define pte_offset_map(dir, address) \
|
|
|
|
((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address)))
|
2005-04-16 22:20:36 +00:00
|
|
|
#define pte_unmap(pte) do { } while (0)
|
|
|
|
#endif
|
|
|
|
|
2006-10-01 06:29:35 +00:00
|
|
|
/* Clear a kernel PTE and flush it from the TLB */
|
2008-03-23 08:03:09 +00:00
|
|
|
#define kpte_clear_flush(ptep, vaddr) \
|
|
|
|
do { \
|
|
|
|
pte_clear(&init_mm, (vaddr), (ptep)); \
|
|
|
|
__flush_tlb_one((vaddr)); \
|
2006-10-01 06:29:35 +00:00
|
|
|
} while (0)
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
|
2008-01-30 12:30:37 +00:00
|
|
|
/*
|
|
|
|
* kern_addr_valid() is (1) for FLATMEM and (0) for
|
|
|
|
* SPARSEMEM and DISCONTIGMEM
|
|
|
|
*/
|
2005-06-23 07:07:57 +00:00
|
|
|
#ifdef CONFIG_FLATMEM
|
2005-04-16 22:20:36 +00:00
|
|
|
#define kern_addr_valid(addr) (1)
|
2008-01-30 12:30:37 +00:00
|
|
|
#else
|
|
|
|
#define kern_addr_valid(kaddr) (0)
|
|
|
|
#endif
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-10-23 05:26:29 +00:00
|
|
|
#endif /* _ASM_X86_PGTABLE_32_H */
|