diff options
Diffstat (limited to 'include/asm-arm/proc-armo')
-rw-r--r-- | include/asm-arm/proc-armo/mm-init-flat.h | 82 | ||||
-rw-r--r-- | include/asm-arm/proc-armo/mm-init.h | 19 | ||||
-rw-r--r-- | include/asm-arm/proc-armo/page.h | 1 | ||||
-rw-r--r-- | include/asm-arm/proc-armo/pgtable-flat.h | 307 | ||||
-rw-r--r-- | include/asm-arm/proc-armo/pgtable.h | 55 | ||||
-rw-r--r-- | include/asm-arm/proc-armo/processor.h | 55 | ||||
-rw-r--r-- | include/asm-arm/proc-armo/ptrace.h | 9 | ||||
-rw-r--r-- | include/asm-arm/proc-armo/semaphore.h | 83 |
8 files changed, 125 insertions, 486 deletions
diff --git a/include/asm-arm/proc-armo/mm-init-flat.h b/include/asm-arm/proc-armo/mm-init-flat.h deleted file mode 100644 index 919ef59a4..000000000 --- a/include/asm-arm/proc-armo/mm-init-flat.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * linux/include/asm-arm/proc-armo/mmap.h - * - * Copyright (C) 1996 Russell King - * - * This contains the code to setup the memory map on an ARM2/ARM250/ARM3 - * machine. This is both processor & architecture specific, and requires - * some more work to get it to fit into our separate processor and - * architecture structure. - */ - -static unsigned long phys_screen_end; -int page_nr; - -#define setup_processor_functions() - -/* - * This routine needs more work to make it dynamically release/allocate mem! - */ -unsigned long map_screen_mem(unsigned long log_start, unsigned long kmem, int update) -{ - static int updated = 0; - unsigned long address = SCREEN_START, i; - pgd_t *pg_dir; - pmd_t *pm_dir; - pte_t *pt_entry; - - if (updated) - return 0; - updated = update; - - pg_dir = swapper_pg_dir + (SCREEN1_BASE >> PGDIR_SHIFT); - pm_dir = pmd_offset(pg_dir, SCREEN1_BASE); - pt_entry = pte_offset(pm_dir, SCREEN1_BASE); - - for (i = SCREEN1_BASE; i < SCREEN1_END; i += PAGE_SIZE) { - if (i >= log_start) { - *pt_entry = mk_pte(address, __pgprot(_PAGE_PRESENT)); - address += PAGE_SIZE; - } else - *pt_entry = mk_pte(0, __pgprot(0)); - pt_entry++; - } - phys_screen_end = address; - if (update) - flush_tlb_all (); - return kmem; -} - -static inline unsigned long setup_pagetables(unsigned long start_mem, unsigned long end_mem) -{ - unsigned long address; - unsigned int spi; - - page_nr = MAP_NR(end_mem); - - /* Allocate zero page */ - address = PAGE_OFFSET + 480*1024; - for (spi = 0; spi < 32768 >> PAGE_SHIFT; spi++) { - pgd_val(swapper_pg_dir[spi]) = pte_val(mk_pte(address, PAGE_READONLY)); - address += PAGE_SIZE; - } - - while (spi < (PAGE_OFFSET >> PGDIR_SHIFT)) - pgd_val(swapper_pg_dir[spi++]) = 0; - - map_screen_mem (SCREEN1_END - 480*1024, 0, 0); - return start_mem; -} - -static inline void mark_usable_memory_areas(unsigned long *start_mem, unsigned long end_mem) -{ - unsigned long smem = PAGE_ALIGN(*start_mem); - - while (smem < end_mem) { - clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags); - smem += PAGE_SIZE; - } - - for (smem = phys_screen_end; smem < SCREEN2_END; smem += PAGE_SIZE) - clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags); -} diff --git a/include/asm-arm/proc-armo/mm-init.h b/include/asm-arm/proc-armo/mm-init.h index ba4db9e82..ce0fd84e6 100644 --- a/include/asm-arm/proc-armo/mm-init.h +++ b/include/asm-arm/proc-armo/mm-init.h @@ -8,8 +8,8 @@ * some more work to get it to fit into our separate processor and * architecture structure. */ -extern unsigned long phys_screen_end; -extern unsigned long map_screen_mem(unsigned long log_start, unsigned long kmem, int update); +#include <asm/arch/memory.h> + int page_nr; #define setup_processor_functions() @@ -20,10 +20,11 @@ static inline void setup_swapper_dir (int index, pte_t *ptep) set_pmd (pmd_offset (swapper_pg_dir + index, 0), mk_pmd (ptep)); } -static inline unsigned long setup_pagetables(unsigned long start_mem, unsigned long end_mem) +static inline unsigned long +setup_pagetables(unsigned long start_mem, unsigned long end_mem) { unsigned int i; - union {unsigned long l; pte_t *pte; } u; + union { unsigned long l; pte_t *pte; } u; page_nr = MAP_NR(end_mem); @@ -37,14 +38,11 @@ static inline unsigned long setup_pagetables(unsigned long start_mem, unsigned l for (i = 1; i < PTRS_PER_PGD; i++) pgd_val(swapper_pg_dir[i]) = 0; - /* now map screen mem in */ - phys_screen_end = SCREEN2_END; - map_screen_mem (SCREEN1_END - 480*1024, 0, 0); - return start_mem; } -static inline void mark_usable_memory_areas(unsigned long *start_mem, unsigned long end_mem) +static inline void +mark_usable_memory_areas(unsigned long *start_mem, unsigned long end_mem) { unsigned long smem; @@ -54,7 +52,4 @@ static inline void mark_usable_memory_areas(unsigned long *start_mem, unsigned l clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags); smem += PAGE_SIZE; } - - for (smem = phys_screen_end; smem < SCREEN2_END; smem += PAGE_SIZE) - clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags); } diff --git a/include/asm-arm/proc-armo/page.h b/include/asm-arm/proc-armo/page.h index 0e2b4501c..3768284a2 100644 --- a/include/asm-arm/proc-armo/page.h +++ b/include/asm-arm/proc-armo/page.h @@ -68,7 +68,6 @@ typedef unsigned long pgprot_t; #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) /* This handles the memory map.. */ -#define PAGE_OFFSET 0x02000000 #define MAP_NR(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> PAGE_SHIFT) #endif /* __KERNEL__ */ diff --git a/include/asm-arm/proc-armo/pgtable-flat.h b/include/asm-arm/proc-armo/pgtable-flat.h deleted file mode 100644 index 994fa9f21..000000000 --- a/include/asm-arm/proc-armo/pgtable-flat.h +++ /dev/null @@ -1,307 +0,0 @@ -/* - * linux/include/asm-arm/proc-armo/pgtable.h - * - * Copyright (C) 1995, 1996 Russell King - */ -#ifndef __ASM_PROC_PGTABLE_H -#define __ASM_PROC_PGTABLE_H - -#include <asm/arch/mmu.h> - -#define LIBRARY_TEXT_START 0x0c000000 - -/* - * Cache flushing... - */ -#define flush_cache_all() do { } while (0) -#define flush_cache_mm(mm) do { } while (0) -#define flush_cache_range(mm,start,end) do { } while (0) -#define flush_cache_page(vma,vmaddr) do { } while (0) -#define flush_page_to_ram(page) do { } while (0) - -/* - * TLB flushing: - * - * - flush_tlb() flushes the current mm struct TLBs - * - flush_tlb_all() flushes all processes TLBs - * - flush_tlb_mm(mm) flushes the specified mm context TLB's - * - flush_tlb_page(vma, vmaddr) flushes one page - * - flush_tlb_range(mm, start, end) flushes a range of pages - */ - -#define flush_tlb() flush_tlb_mm(current->mm) - -extern __inline__ void flush_tlb_all(void) -{ - struct task_struct *p; - - p = &init_task; - do { - processor.u.armv2._update_map(p); - p = p->next_task; - } while (p != &init_task); - - processor.u.armv2._remap_memc (current); -} - -extern __inline__ void flush_tlb_mm(struct mm_struct *mm) -{ - struct task_struct *p; - - p = &init_task; - do { - if (p->mm == mm) - processor.u.armv2._update_map(p); - p = p->next_task; - } while (p != &init_task); - - if (current->mm == mm) - processor.u.armv2._remap_memc (current); -} - -#define flush_tlb_range(mm, start, end) flush_tlb_mm(mm) -#define flush_tlb_page(vma, vmaddr) flush_tlb_mm(vma->vm_mm) - -#define __flush_entry_to_ram(entry) - -/* Certain architectures need to do special things when pte's - * within a page table are directly modified. Thus, the following - * hook is made available. - */ -#define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval)) - -/* PMD_SHIFT determines the size of the area a second-level page table can map */ -#define PMD_SHIFT PAGE_SHIFT -#define PMD_SIZE (1UL << PMD_SHIFT) -#define PMD_MASK (~(PMD_SIZE-1)) - -/* PGDIR_SHIFT determines what a third-level page table entry can map */ -#define PGDIR_SHIFT PAGE_SHIFT -#define PGDIR_SIZE (1UL << PGDIR_SHIFT) -#define PGDIR_MASK (~(PGDIR_SIZE-1)) - -/* - * entries per page directory level: the arm3 is one-level, so - * we don't really have any PMD or PTE directory physically. - */ -#define PTRS_PER_PTE 1 -#define PTRS_PER_PMD 1 -#define PTRS_PER_PGD 1024 - -/* Just any arbitrary offset to the start of the vmalloc VM area: the - * current 8MB value just means that there will be a 8MB "hole" after the - * physical memory until the kernel virtual memory starts. That means that - * any out-of-bounds memory accesses will hopefully be caught. - * The vmalloc() routines leaves a hole of 4kB between each vmalloced - * area for the same reason. ;) - */ -#define VMALLOC_START 0x01a00000 -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) - -#define _PAGE_PRESENT 0x001 -#define _PAGE_RW 0x002 -#define _PAGE_USER 0x004 -#define _PAGE_PCD 0x010 -#define _PAGE_ACCESSED 0x020 -#define _PAGE_DIRTY 0x040 - -#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) -#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) - -#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) -#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED) -#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) -#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) -#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED) - -/* - * The arm can't do page protection for execute, and considers that the same are read. - * Also, write permissions imply read permissions. This is the closest we can get.. - */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_READONLY -#define __P101 PAGE_READONLY -#define __P110 PAGE_COPY -#define __P111 PAGE_COPY - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY -#define __S101 PAGE_READONLY -#define __S110 PAGE_SHARED -#define __S111 PAGE_SHARED - -#undef TEST_VERIFY_AREA - -/* - * BAD_PAGE is used for a bogus page. - * - * ZERO_PAGE is a global shared page that is always zero: used - * for zero-mapped memory areas etc.. - */ -extern pte_t __bad_page(void); -extern unsigned long *empty_zero_page; - -#define BAD_PAGE __bad_page() -#define ZERO_PAGE ((unsigned long) empty_zero_page) - -/* number of bits that fit into a memory pointer */ -#define BYTES_PER_PTR (sizeof(unsigned long)) -#define BITS_PER_PTR (8*BYTES_PER_PTR) - -/* to align the pointer to a pointer address */ -#define PTR_MASK (~(sizeof(void*)-1)) - -/* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */ -#define SIZEOF_PTR_LOG2 2 - -/* to find an entry in a page-table */ -#define PAGE_PTR(address) \ -((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK) - -/* to set the page-dir */ -#define SET_PAGE_DIR(tsk,pgdir) \ -do { \ - tsk->tss.memmap = (unsigned long)pgdir; \ - processor.u.armv2._update_map(tsk); \ - if ((tsk) == current) \ - processor.u.armv2._remap_memc (current); \ -} while (0) - -extern unsigned long physical_start; -extern unsigned long physical_end; - -extern inline int pte_none(pte_t pte) { return !pte_val(pte); } -extern inline int pte_present(pte_t pte) { return pte_val(pte) & _PAGE_PRESENT; } -extern inline void pte_clear(pte_t *ptep) { pte_val(*ptep) = 0; } - -extern inline int pmd_none(pmd_t pmd) { return 0; } -extern inline int pmd_bad(pmd_t pmd) { return 0; } -extern inline int pmd_present(pmd_t pmd) { return 1; } -extern inline void pmd_clear(pmd_t * pmdp) { } - -/* - * The "pgd_xxx()" functions here are trivial for a folded two-level - * setup: the pgd is never bad, and a pmd always exists (as it's folded - * into the pgd entry) - */ -extern inline int pgd_none(pgd_t pgd) { return 0; } -extern inline int pgd_bad(pgd_t pgd) { return 0; } -extern inline int pgd_present(pgd_t pgd) { return 1; } -extern inline void pgd_clear(pgd_t * pgdp) { } - -/* - * The following only work if pte_present() is true. - * Undefined behaviour if not.. - */ -extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } -extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } -extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } -extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } -extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } -#define pte_cacheable(pte) 1 - -extern inline pte_t pte_nocache(pte_t pte) { return pte; } -extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_RW; return pte; } -extern inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_USER; return pte; } -extern inline pte_t pte_exprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_USER; return pte; } -extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } -extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } -extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; } -extern inline pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; } -extern inline pte_t pte_mkexec(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; } -extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } -extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } - -/* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. - */ -extern inline pte_t mk_pte(unsigned long page, pgprot_t pgprot) -{ pte_t pte; pte_val(pte) = virt_to_phys(page) | pgprot_val(pgprot); return pte; } - -extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) -{ pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; } - -extern inline unsigned long pte_page(pte_t pte) -{ return phys_to_virt(pte_val(pte) & PAGE_MASK); } - -extern inline unsigned long pmd_page(pmd_t pmd) -{ return phys_to_virt(pmd_val(pmd) & PAGE_MASK); } - -/* to find an entry in a page-table-directory */ -extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) -{ - return mm->pgd + (address >> PGDIR_SHIFT); -} - -/* Find an entry in the second-level page table.. */ -#define pmd_offset(dir, address) ((pmd_t *)(dir)) - -/* Find an entry in the third-level page table.. */ -#define pte_offset(dir, address) ((pte_t *)(dir)) - -/* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. - */ -extern inline void pte_free_kernel(pte_t * pte) -{ - pte_val(*pte) = 0; -} - -extern inline pte_t * pte_alloc_kernel(pmd_t *pmd, unsigned long address) -{ - return (pte_t *) pmd; -} - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -#define pmd_free_kernel(pmdp) -#define pmd_alloc_kernel(pgd,address) ((pmd_t *)(pgd)) - -#define pte_free(ptep) -#define pte_alloc(pmd,address) ((pte_t *)(pmd)) - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -#define pmd_free(pmd) -#define pmd_alloc(pgd,address) ((pmd_t *)(pgd)) - -extern inline void pgd_free(pgd_t * pgd) -{ - extern void kfree(void *); - kfree((void *)pgd); -} - -extern inline pgd_t * pgd_alloc(void) -{ - pgd_t *pgd; - extern void *kmalloc(unsigned int, int); - - pgd = (pgd_t *) kmalloc(PTRS_PER_PGD * BYTES_PER_PTR, GFP_KERNEL); - if (pgd) - memset(pgd, 0, PTRS_PER_PGD * BYTES_PER_PTR); - return pgd; -} - -extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; - -#define update_mmu_cache(vma,address,pte) processor.u.armv2._update_mmu_cache(vma,address,pte) - -#define SWP_TYPE(entry) (((entry) >> 1) & 0x7f) -#define SWP_OFFSET(entry) ((entry) >> 8) -#define SWP_ENTRY(type,offset) (((type) << 1) | ((offset) << 8)) - -#endif /* __ASM_PROC_PAGE_H */ - diff --git a/include/asm-arm/proc-armo/pgtable.h b/include/asm-arm/proc-armo/pgtable.h index 934902052..04516e729 100644 --- a/include/asm-arm/proc-armo/pgtable.h +++ b/include/asm-arm/proc-armo/pgtable.h @@ -7,9 +7,9 @@ #ifndef __ASM_PROC_PGTABLE_H #define __ASM_PROC_PGTABLE_H -#include <asm/arch/mmu.h> +#include <linux/config.h> #include <linux/slab.h> -#include <asm/arch/processor.h> /* For TASK_SIZE */ +#include <asm/arch/memory.h> /* For TASK_SIZE */ #define LIBRARY_TEXT_START 0x0c000000 @@ -280,13 +280,17 @@ extern __inline__ unsigned long pte_page(pte_t pte) return __phys_to_virt(pte_val(pte) & PAGE_MASK); } -extern __inline__ pmd_t mk_pmd (pte_t *ptep) +extern __inline__ pmd_t mk_pmd(pte_t *ptep) { pmd_t pmd; pmd_val(pmd) = __virt_to_phys((unsigned long)ptep) | _PAGE_TABLE; return pmd; } +/* these are aliases for the above function */ +#define mk_user_pmd(ptep) mk_pmd(ptep) +#define mk_kernel_pmd(ptep) mk_pmd(ptep) + #define set_pmd(pmdp,pmd) ((*(pmdp)) = (pmd)) extern __inline__ unsigned long pmd_page(pmd_t pmd) @@ -319,6 +323,7 @@ extern __inline__ pte_t * pte_offset(pmd_t *dir, unsigned long address) */ #ifndef __SMP__ +#ifndef CONFIG_NO_PGT_CACHE extern struct pgtable_cache_struct { unsigned long *pgd_cache; unsigned long *pte_cache; @@ -329,13 +334,16 @@ extern struct pgtable_cache_struct { #define pte_quicklist (quicklists.pte_cache) #define pgd_quicklist (quicklists.pgd_cache) #define pgtable_cache_size (quicklists.pgtable_cache_sz) +#endif #else #error Pgtable caches have to be per-CPU, so that no locking is needed. #endif extern pgd_t *get_pgd_slow(void); +extern void free_table(void *table); +#ifndef CONFIG_NO_PGT_CACHE extern __inline__ pgd_t *get_pgd_fast(void) { unsigned long *ret; @@ -355,14 +363,17 @@ extern __inline__ void free_pgd_fast(pgd_t *pgd) pgd_quicklist = (unsigned long *) pgd; pgtable_cache_size++; } +#endif +/* keep this as an inline so we get type checking */ extern __inline__ void free_pgd_slow(pgd_t *pgd) { - kfree(pgd); + free_table((void *)pgd); } extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); +#ifndef CONFIG_NO_PGT_CACHE extern __inline__ pte_t *get_pte_fast(void) { unsigned long *ret; @@ -381,10 +392,12 @@ extern __inline__ void free_pte_fast(pte_t *pte) pte_quicklist = (unsigned long *) pte; pgtable_cache_size++; } +#endif +/* keep this as an inline so we get type checking */ extern __inline__ void free_pte_slow(pte_t *pte) { - kfree(pte); + free_table((void *)pte); } /* We don't use pmd cache, so this is a dummy routine */ @@ -404,6 +417,26 @@ extern __inline__ void free_pmd_slow(pmd_t *pmd) extern void __bad_pmd(pmd_t *pmd); extern void __bad_pmd_kernel(pmd_t *pmd); +#ifdef CONFIG_NO_PGT_CACHE +#define pte_free_kernel(pte) free_pte_slow(pte) +#define pte_free(pte) free_pte_slow(pte) +#define pgd_free(pgd) free_pgd_slow(pgd) +#define pgd_alloc() get_pgd_slow() + +extern __inline__ pte_t *pte_alloc(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + + if (pmd_none (*pmd)) { + return get_pte_slow(pmd, address); + } + if (pmd_bad (*pmd)) { + __bad_pmd(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} +#else #define pte_free_kernel(pte) free_pte_fast(pte) #define pte_free(pte) free_pte_fast(pte) #define pgd_free(pgd) free_pgd_fast(pgd) @@ -427,6 +460,7 @@ extern __inline__ pte_t *pte_alloc(pmd_t * pmd, unsigned long address) } return (pte_t *) pmd_page(*pmd) + address; } +#endif /* * allocating and freeing a pmd is trivial: the 1-entry pmd is @@ -448,7 +482,6 @@ extern __inline__ pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address) extern __inline__ void set_pgdir(unsigned long address, pgd_t entry) { struct task_struct * p; - pgd_t *pgd; read_lock(&tasklist_lock); for_each_task(p) { @@ -457,8 +490,14 @@ extern __inline__ void set_pgdir(unsigned long address, pgd_t entry) *pgd_offset(p->mm,address) = entry; } read_unlock(&tasklist_lock); - for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; +#ifndef CONFIG_NO_PGT_CACHE + { + pgd_t *pgd; + for (pgd = (pgd_t *)pgd_quicklist; pgd; + pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; + } +#endif } extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; diff --git a/include/asm-arm/proc-armo/processor.h b/include/asm-arm/proc-armo/processor.h index 4a8b60d10..4cfd77955 100644 --- a/include/asm-arm/proc-armo/processor.h +++ b/include/asm-arm/proc-armo/processor.h @@ -14,8 +14,6 @@ #ifndef __ASM_PROC_PROCESSOR_H #define __ASM_PROC_PROCESSOR_H -#ifdef __KERNEL__ - #include <asm/assembler.h> #include <linux/string.h> @@ -32,6 +30,8 @@ struct context_save_struct { unsigned long pc; }; +#define INIT_CSS (struct context_save_struct){ 0, 0, 0, 0, 0, 0, 0, SVC26_MODE } + typedef struct { void (*put_byte)(void); /* Special calling convention */ void (*get_byte)(void); /* Special calling convention */ @@ -50,50 +50,13 @@ extern uaccess_t uaccess_user, uaccess_kernel; #define EXTRA_THREAD_STRUCT \ uaccess_t *uaccess; /* User access functions*/ \ - struct context_save_struct *save; \ - unsigned long memmap; \ unsigned long memcmap[256]; #define EXTRA_THREAD_STRUCT_INIT \ - &uaccess_kernel, \ - 0, \ - (unsigned long) swapper_pg_dir, \ + ,&uaccess_kernel, \ { 0, } -DECLARE_THREAD_STRUCT; - -/* - * Return saved PC of a blocked thread. - */ -extern __inline__ unsigned long thread_saved_pc (struct thread_struct *t) -{ - if (t->save) - return t->save->pc & ~PCMASK; - else - return 0; -} - -extern __inline__ unsigned long get_css_fp (struct thread_struct *t) -{ - if (t->save) - return t->save->fp; - else - return 0; -} - -asmlinkage void ret_from_sys_call(void) __asm__("ret_from_sys_call"); - -extern __inline__ void copy_thread_css (struct context_save_struct *save) -{ - save->r4 = - save->r5 = - save->r6 = - save->r7 = - save->r8 = - save->r9 = - save->fp = 0; - save->pc = ((unsigned long)ret_from_sys_call) | SVC26_MODE; -} +#define SWAPPER_PG_DIR ((unsigned long)swapper_pg_dir) #define start_thread(regs,pc,sp) \ ({ \ @@ -105,18 +68,16 @@ extern __inline__ void copy_thread_css (struct context_save_struct *save) regs->ARM_r2 = stack[2]; /* r2 (envp) */ \ regs->ARM_r1 = stack[1]; /* r1 (argv) */ \ regs->ARM_r0 = stack[0]; /* r0 (argc) */ \ - flush_tlb_mm(current->mm); \ }) /* Allocation and freeing of basic task resources. */ /* * NOTE! The task struct and the stack go together */ -#define alloc_task_struct() \ - ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) -#define free_task_struct(p) free_pages((unsigned long)(p),1) +extern unsigned long get_page_8k(int priority); +extern void free_page_8k(unsigned long page); - -#endif +#define ll_alloc_task_struct() ((struct task_struct *)get_page_8k(GFP_KERNEL)) +#define ll_free_task_struct(p) free_page_8k((unsigned long)(p)) #endif diff --git a/include/asm-arm/proc-armo/ptrace.h b/include/asm-arm/proc-armo/ptrace.h index 30a05ecdc..f53aa229d 100644 --- a/include/asm-arm/proc-armo/ptrace.h +++ b/include/asm-arm/proc-armo/ptrace.h @@ -68,8 +68,13 @@ struct pt_regs { /* Are the current registers suitable for user mode? * (used to maintain security in signal handlers) */ -#define valid_user_regs(regs) \ - (user_mode(regs) && ((regs)->ARM_sp & 3) == 0) +static inline int valid_user_regs(struct pt_regs *regs) +{ + if (!user_mode(regs) || regs->ARM_pc & (F_BIT | I_BIT)) + return 1; + + return 0; +} #endif diff --git a/include/asm-arm/proc-armo/semaphore.h b/include/asm-arm/proc-armo/semaphore.h index 483803217..9cd99cf50 100644 --- a/include/asm-arm/proc-armo/semaphore.h +++ b/include/asm-arm/proc-armo/semaphore.h @@ -13,17 +13,19 @@ extern inline void down(struct semaphore * sem) __asm__ __volatile__ (" @ atomic down operation mov r0, pc - orr r1, r0, #0x08000000 + orr lr, r0, #0x08000000 and r0, r0, #0x0c000003 - teqp r1, #0 - ldr r1, [%0] - subs r1, r1, #1 - str r1, [%0] - mov r1, pc, lsr #28 - teqp r0, r1, lsl #28 + teqp lr, #0 + ldr lr, [%0] + subs lr, lr, #1 + str lr, [%0] + mov lr, pc, lsr #28 + teqp r0, lr, lsl #28 movmi r0, %0 - blmi " SYMBOL_NAME_STR(__down) - : : "r" (sem) : "r0", "r1", "r2", "r3", "ip", "lr", "cc"); + blmi " SYMBOL_NAME_STR(__down_failed) + : + : "r" (sem) + : "r0", "lr", "cc"); } /* @@ -36,22 +38,47 @@ extern inline int down_interruptible (struct semaphore * sem) __asm__ __volatile__ (" @ atomic down operation mov r0, pc - orr r1, r0, #0x08000000 + orr lr, r0, #0x08000000 and r0, r0, #0x0c000003 - teqp r1, #0 - ldr r1, [%1] - subs r1, r1, #1 - str r1, [%1] - mov r1, pc, lsr #28 + teqp lr, #0 + ldr lr, [%1] + subs lr, lr, #1 + str lr, [%1] + mov lr, pc, lsr #28 orrmi r0, r0, #0x80000000 @ set N - teqp r0, r1, lsl #28 + teqp r0, lr, lsl #28 movmi r0, %1 movpl r0, #0 - blmi " SYMBOL_NAME_STR(__down_interruptible) " + blmi " SYMBOL_NAME_STR(__down_interruptible_failed) " mov %0, r0" : "=r" (result) : "r" (sem) - : "r0", "r1", "r2", "r3", "ip", "lr", "cc"); + : "r0", "lr", "cc"); + return result; +} + +extern inline int down_trylock(struct semaphore * sem) +{ + int result; + __asm__ __volatile__ (" + @ atomic down operation + mov r0, pc + orr lr, r0, #0x08000000 + and r0, r0, #0x0c000003 + teqp lr, #0 + ldr lr, [%1] + subs lr, lr, #1 + str lr, [%1] + mov lr, pc, lsr #28 + orrmi r0, r0, #0x80000000 @ set N + teqp r0, lr, lsl #28 + movmi r0, %1 + movpl r0, #0 + blmi " SYMBOL_NAME_STR(__down_trylock_failed) " + mov %0, r0" + : "=r" (result) + : "r" (sem) + : "r0", "lr", "cc"); return result; } @@ -66,18 +93,20 @@ extern inline void up(struct semaphore * sem) __asm__ __volatile__ (" @ atomic up operation mov r0, pc - orr r1, r0, #0x08000000 + orr lr, r0, #0x08000000 and r0, r0, #0x0c000003 - teqp r1, #0 - ldr r1, [%0] - adds r1, r1, #1 - str r1, [%0] - mov r1, pc, lsr #28 + teqp lr, #0 + ldr lr, [%0] + adds lr, lr, #1 + str lr, [%0] + mov lr, pc, lsr #28 orrls r0, r0, #0x80000000 @ set N - teqp r0, r1, lsl #28 + teqp r0, lr, lsl #28 movmi r0, %0 - blmi " SYMBOL_NAME_STR(__up) - : : "r" (sem) : "r0", "r1", "r2", "r3", "ip", "lr", "cc"); + blmi " SYMBOL_NAME_STR(__up_wakeup) + : + : "r" (sem) + : "r0", "lr", "cc"); } #endif |