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