diff options
| author | Jeff Dike <jdike@uml.karaya.com> | 2002-09-23 13:43:15 -0400 |
|---|---|---|
| committer | Jeff Dike <jdike@uml.karaya.com> | 2002-09-23 13:43:15 -0400 |
| commit | fc72f34545efbe18cd46c446e3368ce50913eff4 (patch) | |
| tree | 2ec1afebec04d263784e4f044784c2a471ee8df8 /include/asm-um | |
| parent | f20bf018befffbf30dbab2653586b437c358d26b (diff) | |
Added highmem support.
The UML initialization code marks memory that doesn't fit in the
kernel's address space as highmem, and later sets up the UML data
structures for it, and frees that memory to the mm system as highmem.
Diffstat (limited to 'include/asm-um')
| -rw-r--r-- | include/asm-um/fixmap.h | 89 | ||||
| -rw-r--r-- | include/asm-um/highmem.h | 6 | ||||
| -rw-r--r-- | include/asm-um/pgalloc.h | 1 | ||||
| -rw-r--r-- | include/asm-um/pgtable.h | 12 | ||||
| -rw-r--r-- | include/asm-um/tlbflush.h | 1 |
5 files changed, 107 insertions, 2 deletions
diff --git a/include/asm-um/fixmap.h b/include/asm-um/fixmap.h new file mode 100644 index 000000000000..6ae492a9e52e --- /dev/null +++ b/include/asm-um/fixmap.h @@ -0,0 +1,89 @@ +#ifndef __UM_FIXMAP_H +#define __UM_FIXMAP_H + +#include <linux/config.h> +#include <asm/kmap_types.h> + +/* + * Here we define all the compile-time 'special' virtual + * addresses. The point is to have a constant address at + * compile time, but to set the physical address only + * in the boot process. We allocate these special addresses + * from the end of virtual memory (0xfffff000) backwards. + * Also this lets us do fail-safe vmalloc(), we + * can guarantee that these special addresses and + * vmalloc()-ed addresses never overlap. + * + * these 'compile-time allocated' memory buffers are + * fixed-size 4k pages. (or larger if used with an increment + * highger than 1) use fixmap_set(idx,phys) to associate + * physical memory with fixmap indices. + * + * TLB entries of such buffers will not be flushed across + * task switches. + */ + +/* + * on UP currently we will have no trace of the fixmap mechanizm, + * no page table allocations, etc. This might change in the + * future, say framebuffers for the console driver(s) could be + * fix-mapped? + */ +enum fixed_addresses { +#ifdef CONFIG_HIGHMEM + FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ + FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, +#endif + __end_of_fixed_addresses +}; + +extern void __set_fixmap (enum fixed_addresses idx, + unsigned long phys, pgprot_t flags); + +#define set_fixmap(idx, phys) \ + __set_fixmap(idx, phys, PAGE_KERNEL) +/* + * Some hardware wants to get fixmapped without caching. + */ +#define set_fixmap_nocache(idx, phys) \ + __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) +/* + * used by vmalloc.c. + * + * Leave one empty page between vmalloc'ed areas and + * the start of the fixmap, and leave one page empty + * at the top of mem.. + */ +extern unsigned long get_kmem_end(void); + +#define FIXADDR_TOP (get_kmem_end() - 0x2000) +#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) +#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) + +#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) + +extern void __this_fixmap_does_not_exist(void); + +/* + * 'index to address' translation. If anyone tries to use the idx + * directly without tranlation, we catch the bug with a NULL-deference + * kernel oops. Illegal ranges of incoming indices are caught too. + */ +static inline unsigned long fix_to_virt(const unsigned int idx) +{ + /* + * this branch gets completely eliminated after inlining, + * except when someone tries to use fixaddr indices in an + * illegal way. (such as mixing up address types or using + * out-of-range indices). + * + * If it doesn't get removed, the linker will complain + * loudly with a reasonably clear error message.. + */ + if (idx >= __end_of_fixed_addresses) + __this_fixmap_does_not_exist(); + + return __fix_to_virt(idx); +} + +#endif diff --git a/include/asm-um/highmem.h b/include/asm-um/highmem.h index 6713fb2a4896..36974cb8abc7 100644 --- a/include/asm-um/highmem.h +++ b/include/asm-um/highmem.h @@ -1,6 +1,12 @@ #ifndef __UM_HIGHMEM_H #define __UM_HIGHMEM_H +#include "asm/page.h" +#include "asm/fixmap.h" #include "asm/arch/highmem.h" +#undef PKMAP_BASE + +#define PKMAP_BASE ((FIXADDR_START - LAST_PKMAP * PAGE_SIZE) & PMD_MASK) + #endif diff --git a/include/asm-um/pgalloc.h b/include/asm-um/pgalloc.h index 4620297e2cc7..4ffc0f9c5a3e 100644 --- a/include/asm-um/pgalloc.h +++ b/include/asm-um/pgalloc.h @@ -8,6 +8,7 @@ #define __UM_PGALLOC_H #include "linux/mm.h" +#include "asm/fixmap.h" #define pmd_populate_kernel(mm, pmd, pte) \ set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte))) diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h index 85b366b643a3..17fd515545da 100644 --- a/include/asm-um/pgtable.h +++ b/include/asm-um/pgtable.h @@ -62,12 +62,16 @@ extern unsigned long *empty_zero_page; */ extern unsigned long high_physmem; -extern unsigned long end_vm; #define VMALLOC_OFFSET (__va_space) #define VMALLOC_START (((unsigned long) high_physmem + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_VMADDR(x) ((unsigned long)(x)) -#define VMALLOC_END (end_vm) + +#if CONFIG_HIGHMEM +# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) +#else +# define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE) +#endif #define _PAGE_PRESENT 0x001 #define _PAGE_NEWPAGE 0x002 @@ -333,6 +337,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) /* to find an entry in a page-table-directory. */ #define pgd_index(address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) +#define __pgd_offset(address) pgd_index(address) /* to find an entry in a page-table-directory */ #define pgd_offset(mm, address) \ @@ -341,6 +346,9 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) /* to find an entry in a kernel page-table-directory */ #define pgd_offset_k(address) pgd_offset(&init_mm, address) +#define __pmd_offset(address) \ + (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) + /* Find an entry in the second-level page table.. */ static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) { diff --git a/include/asm-um/tlbflush.h b/include/asm-um/tlbflush.h index fd55c6efb4d3..522aa30f7eaa 100644 --- a/include/asm-um/tlbflush.h +++ b/include/asm-um/tlbflush.h @@ -27,6 +27,7 @@ extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); extern void flush_tlb_kernel_vm(void); extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); +extern void __flush_tlb_one(unsigned long addr); static inline void flush_tlb_pgtables(struct mm_struct *mm, unsigned long start, unsigned long end) |
