diff -urNp x-ref/arch/um/kernel/mem.c x/arch/um/kernel/mem.c --- x-ref/arch/um/kernel/mem.c 2003-02-14 05:20:35.000000000 +0100 +++ x/arch/um/kernel/mem.c 2003-02-14 05:20:37.000000000 +0100 @@ -410,8 +410,8 @@ int do_check_pgt_cache(int low, int high pmd_free_slow(pmd_alloc_one_fast(NULL, 0)); freed++; } - if (pte_quicklist) { - pte_free_slow(pte_alloc_one_fast(NULL, 0)); + if (!list_empty(&pte_quicklist)) { + pte_free_slow(pte_alloc_one_fast_lifo(0, 0)); freed++; } } while(pgtable_cache_size > low); diff -urNp x-ref/arch/um/kernel/trap_kern.c x/arch/um/kernel/trap_kern.c --- x-ref/arch/um/kernel/trap_kern.c 2003-02-14 05:20:35.000000000 +0100 +++ x/arch/um/kernel/trap_kern.c 2003-02-14 05:20:37.000000000 +0100 @@ -158,6 +158,8 @@ void trap_init(void) { } +void show_stack(unsigned long * esp) { } + spinlock_t trap_lock = SPIN_LOCK_UNLOCKED; static int trap_index = 0; diff -urNp x-ref/include/asm-um/pgalloc.h x/include/asm-um/pgalloc.h --- x-ref/include/asm-um/pgalloc.h 2003-02-14 05:20:35.000000000 +0100 +++ x/include/asm-um/pgalloc.h 2003-02-14 05:21:16.000000000 +0100 @@ -11,13 +11,14 @@ #include "linux/mm.h" #include "asm/fixmap.h" #include "choose-mode.h" +#include "linux/list.h" #define pgd_quicklist (current_cpu_data.pgd_quick) #define pmd_quicklist (current_cpu_data.pmd_quick) #define pte_quicklist (current_cpu_data.pte_quick) #define pgtable_cache_size (current_cpu_data.pgtable_cache_sz) -#define pmd_populate(mm, pmd, pte) set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) +#define pmd_populate(mm, pmd, page) set_pmd(pmd, mk_pmd(page, __pgprot(_PAGE_TABLE))) /* * Allocate and free page tables. @@ -75,38 +76,48 @@ static inline void free_pgd_slow(pgd_t * free_page((unsigned long)pgd); } -static inline pte_t *pte_alloc_one(struct mm_struct *mm, unsigned long address) +static inline struct page * pte_alloc_one_fast(struct mm_struct *mm, + unsigned long address) { - pte_t *pte; + struct list_head * entry = pte_quicklist.next; /* FIFO */ + struct page * page = NULL; - pte = (pte_t *) __get_free_page(GFP_KERNEL); - if (pte) - clear_page(pte); - return pte; + if (entry != &pte_quicklist) { + list_del(entry); + page = list_entry(entry, struct page, list); + pgtable_cache_size--; + } + return page; } -static inline pte_t *pte_alloc_one_fast(struct mm_struct *mm, unsigned long address) +static inline struct page * pte_alloc_one_fast_lifo(struct mm_struct *mm, + unsigned long address) { - unsigned long *ret; + struct list_head * entry = pte_quicklist.prev; /* LIFO */ + struct page * page = NULL; - if ((ret = (unsigned long *)pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; + if (entry != &pte_quicklist) { + list_del(entry); + page = list_entry(entry, struct page, list); pgtable_cache_size--; } - return (pte_t *)ret; + return page; } -static inline void pte_free_fast(pte_t *pte) +static inline void pte_free_fast(struct page * page) { - *(unsigned long *)pte = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pte; + list_add(&page->list, &pte_quicklist); pgtable_cache_size++; } -static inline void pte_free_slow(pte_t *pte) +static __inline__ void pte_free_slow(struct page * page) +{ + __free_page(page); +} + +static inline void pte_free_via_pmd(pmd_t pmd) { - free_page((unsigned long)pte); + pte_free_fast(virt_to_page(pte_offset(&pmd, 0))); } #define pte_free(pte) pte_free_fast(pte) diff -urNp x-ref/include/asm-um/pgtable.h x/include/asm-um/pgtable.h --- x-ref/include/asm-um/pgtable.h 2003-02-14 05:20:35.000000000 +0100 +++ x/include/asm-um/pgtable.h 2003-02-14 05:20:37.000000000 +0100 @@ -358,6 +358,13 @@ extern unsigned long page_to_phys(struct if(pte_present(__pte)) pte_mknewprot(pte_mknewpage(__pte)); \ __pte; \ }) +#define mk_pmd(page, pgprot) \ +({ \ + pmd_t __pmd; \ + \ + pmd_val(__pmd) = ((unsigned long) __va((page-mem_map)*(unsigned long)PAGE_SIZE + pgprot_val(pgprot))); \ + __pmd; \ +}) /* This takes a physical page address that is used by the remapping functions */ #define mk_pte_phys(physpage, pgprot) \ @@ -396,6 +403,16 @@ static inline pmd_t * pmd_offset(pgd_t * #define pte_offset(pmd, address) \ ((pte_t *) (pmd_page(*pmd) + ((address>>10) & ((PTRS_PER_PTE-1)<<2)))) +#define pte_offset2(dir, address) pte_offset(dir, address) +#define pte_offset_atomic(dir, address) pte_offset(dir, address) +#define pte_offset_atomic2(dir, address) pte_offset(dir, address) +#define pte_offset_under_lock(dir, address, mm) pte_offset(dir, address) +#define pte_offset2_under_lock(dir, address, mm) pte_offset(dir, address) +#define pte_kunmap(ptep) do { } while(0) +#define pte_kunmap2(ptep) do { } while(0) +#define pte_kunmap_atomic2(ptep) do { } while(0) +#define pte_alloc_atomic(mm, pmd, address) pte_alloc(mm, pmd, address) + #define update_mmu_cache(vma,address,pte) do ; while (0) /* Encode and de-code a swap entry */ diff -urNp x-ref/include/asm-um/prefetch.h x/include/asm-um/prefetch.h --- x-ref/include/asm-um/prefetch.h 1970-01-01 01:00:00.000000000 +0100 +++ x/include/asm-um/prefetch.h 2003-02-14 05:20:37.000000000 +0100 @@ -0,0 +1,4 @@ +#ifndef __UM_PREFETCH_H +#define __UM_PREFETCH_H + +#endif diff -urNp x-ref/include/asm-um/processor-generic.h x/include/asm-um/processor-generic.h --- x-ref/include/asm-um/processor-generic.h 2003-02-14 05:20:35.000000000 +0100 +++ x/include/asm-um/processor-generic.h 2003-02-14 05:20:37.000000000 +0100 @@ -10,6 +10,7 @@ struct pt_regs; struct task_struct; +#include "linux/list.h" #include "linux/config.h" #include "linux/signal.h" #include "asm/ptrace.h" @@ -147,7 +148,7 @@ struct cpuinfo_um { unsigned long loops_per_jiffy; unsigned long *pgd_quick; unsigned long *pmd_quick; - unsigned long *pte_quick; + struct list_head pte_quick; unsigned long pgtable_cache_sz; int ipi_pipe[2]; };