Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu: (22 commits)
m68knommu: Use generic show_interrupts()
coldfire_qspi compile fix
m68k: merge the mmu and non-mmu versions of sys_m68k.c
m68knommu: use asm-generic/bitops/ext2-atomic.h
m68knommu: Remove obsolete #include <linux/sys.h>
m68k: merge mmu and non-mmu versions of asm-offsets.c
m68k: merge non-mmu and mmu versions of m68k_ksyms.c
m68knommu: remove un-needed exporting of COLDFIRE symbols
m68knommu: move EXPORT of kernel_thread to function definition
m68knommu: move EXPORT of local checksumming functions to definitions
m68knommu: move EXPORT of dump_fpu to function definition
m68knommu: clean up mm/init_no.c
m68k: merge the mmu and non-mmu mm/Makefile
m68k: mv kmap_mm.c to kmap.c
m68knommu: remove stubs for __ioremap() and iounmap()
m68knommu: remove unused kernel_set_cachemode()
m68k: let Makefile sort out compiling mmu and non-mmu lib/checksum.c
m68k: remove duplicate memcpy() implementation
m68k: remove duplicate memset() implementation
m68k: remove duplicate memmove() implementation
...

+1369 -1960
+1
arch/m68k/Kconfig
··· 5 5 select HAVE_AOUT if MMU 6 6 select GENERIC_ATOMIC64 if MMU 7 7 select HAVE_GENERIC_HARDIRQS if !MMU 8 + select GENERIC_IRQ_SHOW if !MMU 8 9 9 10 config RWSEM_GENERIC_SPINLOCK 10 11 bool
+1 -17
arch/m68k/include/asm/bitops_no.h
··· 246 246 return retval; 247 247 } 248 248 249 - #define ext2_set_bit_atomic(lock, nr, addr) \ 250 - ({ \ 251 - int ret; \ 252 - spin_lock(lock); \ 253 - ret = __test_and_set_bit_le((nr), (addr)); \ 254 - spin_unlock(lock); \ 255 - ret; \ 256 - }) 257 - 258 - #define ext2_clear_bit_atomic(lock, nr, addr) \ 259 - ({ \ 260 - int ret; \ 261 - spin_lock(lock); \ 262 - ret = __test_and_clear_bit_le((nr), (addr)); \ 263 - spin_unlock(lock); \ 264 - ret; \ 265 - }) 249 + #include <asm-generic/bitops/ext2-atomic.h> 266 250 267 251 static inline int test_bit_le(int nr, const volatile void *addr) 268 252 {
+5 -3
arch/m68k/include/asm/io_no.h
··· 144 144 #define IOMAP_NOCACHE_NONSER 2 145 145 #define IOMAP_WRITETHROUGH 3 146 146 147 - extern void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag); 148 - 147 + static inline void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) 148 + { 149 + return (void *) physaddr; 150 + } 149 151 static inline void *ioremap(unsigned long physaddr, unsigned long size) 150 152 { 151 153 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); ··· 165 163 return __ioremap(physaddr, size, IOMAP_FULL_CACHING); 166 164 } 167 165 168 - extern void iounmap(void *addr); 166 + #define iounmap(addr) do { } while(0) 169 167 170 168 /* 171 169 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
+103 -3
arch/m68k/kernel/asm-offsets.c
··· 1 - #ifdef CONFIG_MMU 2 - #include "asm-offsets_mm.c" 1 + /* 2 + * This program is used to generate definitions needed by 3 + * assembly language modules. 4 + * 5 + * We use the technique used in the OSF Mach kernel code: 6 + * generate asm statements containing #defines, 7 + * compile this file to assembler, and then extract the 8 + * #defines from the assembly-language output. 9 + */ 10 + 11 + #define ASM_OFFSETS_C 12 + 13 + #include <linux/stddef.h> 14 + #include <linux/sched.h> 15 + #include <linux/kernel_stat.h> 16 + #include <linux/kbuild.h> 17 + #include <asm/bootinfo.h> 18 + #include <asm/irq.h> 19 + #include <asm/amigahw.h> 20 + #include <linux/font.h> 21 + 22 + int main(void) 23 + { 24 + /* offsets into the task struct */ 25 + DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); 26 + DEFINE(TASK_MM, offsetof(struct task_struct, mm)); 27 + DEFINE(TASK_INFO, offsetof(struct task_struct, thread.info)); 28 + DEFINE(TASK_TINFO, offsetof(struct task_struct, thread.info)); 29 + 30 + /* offsets into the thread struct */ 31 + DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); 32 + DEFINE(THREAD_USP, offsetof(struct thread_struct, usp)); 33 + DEFINE(THREAD_SR, offsetof(struct thread_struct, sr)); 34 + DEFINE(THREAD_FS, offsetof(struct thread_struct, fs)); 35 + DEFINE(THREAD_CRP, offsetof(struct thread_struct, crp)); 36 + DEFINE(THREAD_ESP0, offsetof(struct thread_struct, esp0)); 37 + DEFINE(THREAD_FPREG, offsetof(struct thread_struct, fp)); 38 + DEFINE(THREAD_FPCNTL, offsetof(struct thread_struct, fpcntl)); 39 + DEFINE(THREAD_FPSTATE, offsetof(struct thread_struct, fpstate)); 40 + 41 + /* offsets into the thread_info struct */ 42 + DEFINE(TINFO_PREEMPT, offsetof(struct thread_info, preempt_count)); 43 + DEFINE(TINFO_FLAGS, offsetof(struct thread_info, flags)); 44 + 45 + /* offsets into the pt_regs */ 46 + DEFINE(PT_OFF_D0, offsetof(struct pt_regs, d0)); 47 + DEFINE(PT_OFF_ORIG_D0, offsetof(struct pt_regs, orig_d0)); 48 + DEFINE(PT_OFF_D1, offsetof(struct pt_regs, d1)); 49 + DEFINE(PT_OFF_D2, offsetof(struct pt_regs, d2)); 50 + DEFINE(PT_OFF_D3, offsetof(struct pt_regs, d3)); 51 + DEFINE(PT_OFF_D4, offsetof(struct pt_regs, d4)); 52 + DEFINE(PT_OFF_D5, offsetof(struct pt_regs, d5)); 53 + DEFINE(PT_OFF_A0, offsetof(struct pt_regs, a0)); 54 + DEFINE(PT_OFF_A1, offsetof(struct pt_regs, a1)); 55 + DEFINE(PT_OFF_A2, offsetof(struct pt_regs, a2)); 56 + DEFINE(PT_OFF_PC, offsetof(struct pt_regs, pc)); 57 + DEFINE(PT_OFF_SR, offsetof(struct pt_regs, sr)); 58 + 59 + /* bitfields are a bit difficult */ 60 + #ifdef CONFIG_COLDFIRE 61 + DEFINE(PT_OFF_FORMATVEC, offsetof(struct pt_regs, sr) - 2); 3 62 #else 4 - #include "asm-offsets_no.c" 63 + DEFINE(PT_OFF_FORMATVEC, offsetof(struct pt_regs, pc) + 4); 5 64 #endif 65 + 66 + /* offsets into the irq_cpustat_t struct */ 67 + DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending)); 68 + 69 + /* signal defines */ 70 + DEFINE(LSIGSEGV, SIGSEGV); 71 + DEFINE(LSEGV_MAPERR, SEGV_MAPERR); 72 + DEFINE(LSIGTRAP, SIGTRAP); 73 + DEFINE(LTRAP_TRACE, TRAP_TRACE); 74 + 75 + #ifdef CONFIG_MMU 76 + /* offsets into the bi_record struct */ 77 + DEFINE(BIR_TAG, offsetof(struct bi_record, tag)); 78 + DEFINE(BIR_SIZE, offsetof(struct bi_record, size)); 79 + DEFINE(BIR_DATA, offsetof(struct bi_record, data)); 80 + 81 + /* offsets into font_desc (drivers/video/console/font.h) */ 82 + DEFINE(FONT_DESC_IDX, offsetof(struct font_desc, idx)); 83 + DEFINE(FONT_DESC_NAME, offsetof(struct font_desc, name)); 84 + DEFINE(FONT_DESC_WIDTH, offsetof(struct font_desc, width)); 85 + DEFINE(FONT_DESC_HEIGHT, offsetof(struct font_desc, height)); 86 + DEFINE(FONT_DESC_DATA, offsetof(struct font_desc, data)); 87 + DEFINE(FONT_DESC_PREF, offsetof(struct font_desc, pref)); 88 + 89 + /* offsets into the custom struct */ 90 + DEFINE(CUSTOMBASE, &amiga_custom); 91 + DEFINE(C_INTENAR, offsetof(struct CUSTOM, intenar)); 92 + DEFINE(C_INTREQR, offsetof(struct CUSTOM, intreqr)); 93 + DEFINE(C_INTENA, offsetof(struct CUSTOM, intena)); 94 + DEFINE(C_INTREQ, offsetof(struct CUSTOM, intreq)); 95 + DEFINE(C_SERDATR, offsetof(struct CUSTOM, serdatr)); 96 + DEFINE(C_SERDAT, offsetof(struct CUSTOM, serdat)); 97 + DEFINE(C_SERPER, offsetof(struct CUSTOM, serper)); 98 + DEFINE(CIAABASE, &ciaa); 99 + DEFINE(CIABBASE, &ciab); 100 + DEFINE(C_PRA, offsetof(struct CIA, pra)); 101 + DEFINE(ZTWOBASE, zTwoBase); 102 + #endif 103 + 104 + return 0; 105 + }
-100
arch/m68k/kernel/asm-offsets_mm.c
··· 1 - /* 2 - * This program is used to generate definitions needed by 3 - * assembly language modules. 4 - * 5 - * We use the technique used in the OSF Mach kernel code: 6 - * generate asm statements containing #defines, 7 - * compile this file to assembler, and then extract the 8 - * #defines from the assembly-language output. 9 - */ 10 - 11 - #define ASM_OFFSETS_C 12 - 13 - #include <linux/stddef.h> 14 - #include <linux/sched.h> 15 - #include <linux/kernel_stat.h> 16 - #include <linux/kbuild.h> 17 - #include <asm/bootinfo.h> 18 - #include <asm/irq.h> 19 - #include <asm/amigahw.h> 20 - #include <linux/font.h> 21 - 22 - int main(void) 23 - { 24 - /* offsets into the task struct */ 25 - DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); 26 - DEFINE(TASK_INFO, offsetof(struct task_struct, thread.info)); 27 - DEFINE(TASK_MM, offsetof(struct task_struct, mm)); 28 - #ifdef CONFIG_MMU 29 - DEFINE(TASK_TINFO, offsetof(struct task_struct, thread.info)); 30 - #endif 31 - 32 - /* offsets into the thread struct */ 33 - DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); 34 - DEFINE(THREAD_USP, offsetof(struct thread_struct, usp)); 35 - DEFINE(THREAD_SR, offsetof(struct thread_struct, sr)); 36 - DEFINE(THREAD_FS, offsetof(struct thread_struct, fs)); 37 - DEFINE(THREAD_CRP, offsetof(struct thread_struct, crp)); 38 - DEFINE(THREAD_ESP0, offsetof(struct thread_struct, esp0)); 39 - DEFINE(THREAD_FPREG, offsetof(struct thread_struct, fp)); 40 - DEFINE(THREAD_FPCNTL, offsetof(struct thread_struct, fpcntl)); 41 - DEFINE(THREAD_FPSTATE, offsetof(struct thread_struct, fpstate)); 42 - 43 - /* offsets into the thread_info struct */ 44 - DEFINE(TINFO_PREEMPT, offsetof(struct thread_info, preempt_count)); 45 - DEFINE(TINFO_FLAGS, offsetof(struct thread_info, flags)); 46 - 47 - /* offsets into the pt_regs */ 48 - DEFINE(PT_OFF_D0, offsetof(struct pt_regs, d0)); 49 - DEFINE(PT_OFF_ORIG_D0, offsetof(struct pt_regs, orig_d0)); 50 - DEFINE(PT_OFF_D1, offsetof(struct pt_regs, d1)); 51 - DEFINE(PT_OFF_D2, offsetof(struct pt_regs, d2)); 52 - DEFINE(PT_OFF_D3, offsetof(struct pt_regs, d3)); 53 - DEFINE(PT_OFF_D4, offsetof(struct pt_regs, d4)); 54 - DEFINE(PT_OFF_D5, offsetof(struct pt_regs, d5)); 55 - DEFINE(PT_OFF_A0, offsetof(struct pt_regs, a0)); 56 - DEFINE(PT_OFF_A1, offsetof(struct pt_regs, a1)); 57 - DEFINE(PT_OFF_A2, offsetof(struct pt_regs, a2)); 58 - DEFINE(PT_OFF_PC, offsetof(struct pt_regs, pc)); 59 - DEFINE(PT_OFF_SR, offsetof(struct pt_regs, sr)); 60 - /* bitfields are a bit difficult */ 61 - DEFINE(PT_OFF_FORMATVEC, offsetof(struct pt_regs, pc) + 4); 62 - 63 - /* offsets into the irq_cpustat_t struct */ 64 - DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending)); 65 - 66 - /* offsets into the bi_record struct */ 67 - DEFINE(BIR_TAG, offsetof(struct bi_record, tag)); 68 - DEFINE(BIR_SIZE, offsetof(struct bi_record, size)); 69 - DEFINE(BIR_DATA, offsetof(struct bi_record, data)); 70 - 71 - /* offsets into font_desc (drivers/video/console/font.h) */ 72 - DEFINE(FONT_DESC_IDX, offsetof(struct font_desc, idx)); 73 - DEFINE(FONT_DESC_NAME, offsetof(struct font_desc, name)); 74 - DEFINE(FONT_DESC_WIDTH, offsetof(struct font_desc, width)); 75 - DEFINE(FONT_DESC_HEIGHT, offsetof(struct font_desc, height)); 76 - DEFINE(FONT_DESC_DATA, offsetof(struct font_desc, data)); 77 - DEFINE(FONT_DESC_PREF, offsetof(struct font_desc, pref)); 78 - 79 - /* signal defines */ 80 - DEFINE(LSIGSEGV, SIGSEGV); 81 - DEFINE(LSEGV_MAPERR, SEGV_MAPERR); 82 - DEFINE(LSIGTRAP, SIGTRAP); 83 - DEFINE(LTRAP_TRACE, TRAP_TRACE); 84 - 85 - /* offsets into the custom struct */ 86 - DEFINE(CUSTOMBASE, &amiga_custom); 87 - DEFINE(C_INTENAR, offsetof(struct CUSTOM, intenar)); 88 - DEFINE(C_INTREQR, offsetof(struct CUSTOM, intreqr)); 89 - DEFINE(C_INTENA, offsetof(struct CUSTOM, intena)); 90 - DEFINE(C_INTREQ, offsetof(struct CUSTOM, intreq)); 91 - DEFINE(C_SERDATR, offsetof(struct CUSTOM, serdatr)); 92 - DEFINE(C_SERDAT, offsetof(struct CUSTOM, serdat)); 93 - DEFINE(C_SERPER, offsetof(struct CUSTOM, serper)); 94 - DEFINE(CIAABASE, &ciaa); 95 - DEFINE(CIABBASE, &ciab); 96 - DEFINE(C_PRA, offsetof(struct CIA, pra)); 97 - DEFINE(ZTWOBASE, zTwoBase); 98 - 99 - return 0; 100 - }
-76
arch/m68k/kernel/asm-offsets_no.c
··· 1 - /* 2 - * This program is used to generate definitions needed by 3 - * assembly language modules. 4 - * 5 - * We use the technique used in the OSF Mach kernel code: 6 - * generate asm statements containing #defines, 7 - * compile this file to assembler, and then extract the 8 - * #defines from the assembly-language output. 9 - */ 10 - 11 - #include <linux/stddef.h> 12 - #include <linux/sched.h> 13 - #include <linux/kernel_stat.h> 14 - #include <linux/ptrace.h> 15 - #include <linux/hardirq.h> 16 - #include <linux/kbuild.h> 17 - #include <asm/bootinfo.h> 18 - #include <asm/irq.h> 19 - #include <asm/thread_info.h> 20 - 21 - int main(void) 22 - { 23 - /* offsets into the task struct */ 24 - DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); 25 - DEFINE(TASK_MM, offsetof(struct task_struct, mm)); 26 - 27 - /* offsets into the irq_cpustat_t struct */ 28 - DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending)); 29 - 30 - /* offsets into the thread struct */ 31 - DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); 32 - DEFINE(THREAD_USP, offsetof(struct thread_struct, usp)); 33 - DEFINE(THREAD_SR, offsetof(struct thread_struct, sr)); 34 - DEFINE(THREAD_FS, offsetof(struct thread_struct, fs)); 35 - DEFINE(THREAD_CRP, offsetof(struct thread_struct, crp)); 36 - DEFINE(THREAD_ESP0, offsetof(struct thread_struct, esp0)); 37 - DEFINE(THREAD_FPREG, offsetof(struct thread_struct, fp)); 38 - DEFINE(THREAD_FPCNTL, offsetof(struct thread_struct, fpcntl)); 39 - DEFINE(THREAD_FPSTATE, offsetof(struct thread_struct, fpstate)); 40 - 41 - /* offsets into the pt_regs */ 42 - DEFINE(PT_OFF_D0, offsetof(struct pt_regs, d0)); 43 - DEFINE(PT_OFF_ORIG_D0, offsetof(struct pt_regs, orig_d0)); 44 - DEFINE(PT_OFF_D1, offsetof(struct pt_regs, d1)); 45 - DEFINE(PT_OFF_D2, offsetof(struct pt_regs, d2)); 46 - DEFINE(PT_OFF_D3, offsetof(struct pt_regs, d3)); 47 - DEFINE(PT_OFF_D4, offsetof(struct pt_regs, d4)); 48 - DEFINE(PT_OFF_D5, offsetof(struct pt_regs, d5)); 49 - DEFINE(PT_OFF_A0, offsetof(struct pt_regs, a0)); 50 - DEFINE(PT_OFF_A1, offsetof(struct pt_regs, a1)); 51 - DEFINE(PT_OFF_A2, offsetof(struct pt_regs, a2)); 52 - DEFINE(PT_OFF_PC, offsetof(struct pt_regs, pc)); 53 - DEFINE(PT_OFF_SR, offsetof(struct pt_regs, sr)); 54 - 55 - #ifdef CONFIG_COLDFIRE 56 - /* bitfields are a bit difficult */ 57 - DEFINE(PT_OFF_FORMATVEC, offsetof(struct pt_regs, sr) - 2); 58 - #else 59 - /* bitfields are a bit difficult */ 60 - DEFINE(PT_OFF_FORMATVEC, offsetof(struct pt_regs, pc) + 4); 61 - #endif 62 - 63 - /* signal defines */ 64 - DEFINE(SIGSEGV, SIGSEGV); 65 - DEFINE(SEGV_MAPERR, SEGV_MAPERR); 66 - DEFINE(SIGTRAP, SIGTRAP); 67 - DEFINE(TRAP_TRACE, TRAP_TRACE); 68 - 69 - DEFINE(PT_PTRACED, PT_PTRACED); 70 - 71 - /* Offsets in thread_info structure */ 72 - DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 73 - DEFINE(TI_PREEMPTCOUNT, offsetof(struct thread_info, preempt_count)); 74 - 75 - return 0; 76 - }
-1
arch/m68k/kernel/entry_no.S
··· 24 24 * linux 2.4 support David McCullough <davidm@snapgear.com> 25 25 */ 26 26 27 - #include <linux/sys.h> 28 27 #include <linux/linkage.h> 29 28 #include <asm/errno.h> 30 29 #include <asm/setup.h>
-28
arch/m68k/kernel/irq.c
··· 28 28 29 29 set_irq_regs(oldregs); 30 30 } 31 - 32 - int show_interrupts(struct seq_file *p, void *v) 33 - { 34 - struct irqaction *ap; 35 - int irq = *((loff_t *) v); 36 - 37 - if (irq == 0) 38 - seq_puts(p, " CPU0\n"); 39 - 40 - if (irq < NR_IRQS) { 41 - struct irq_desc *desc = irq_to_desc(irq); 42 - 43 - ap = desc->action; 44 - if (ap) { 45 - seq_printf(p, "%3d: ", irq); 46 - seq_printf(p, "%10u ", kstat_irqs(irq)); 47 - seq_printf(p, "%14s ", irq_desc_get_chip(desc)->name); 48 - 49 - seq_printf(p, "%s", ap->name); 50 - for (ap = ap->next; ap; ap = ap->next) 51 - seq_printf(p, ", %s", ap->name); 52 - seq_putc(p, '\n'); 53 - } 54 - } 55 - 56 - return 0; 57 - } 58 -
+32 -4
arch/m68k/kernel/m68k_ksyms.c
··· 1 - #ifdef CONFIG_MMU 2 - #include "m68k_ksyms_mm.c" 3 - #else 4 - #include "m68k_ksyms_no.c" 1 + #include <linux/module.h> 2 + 3 + asmlinkage long long __ashldi3 (long long, int); 4 + asmlinkage long long __ashrdi3 (long long, int); 5 + asmlinkage long long __lshrdi3 (long long, int); 6 + asmlinkage long long __muldi3 (long long, long long); 7 + 8 + /* The following are special because they're not called 9 + explicitly (the C compiler generates them). Fortunately, 10 + their interface isn't gonna change any time soon now, so 11 + it's OK to leave it out of version control. */ 12 + EXPORT_SYMBOL(__ashldi3); 13 + EXPORT_SYMBOL(__ashrdi3); 14 + EXPORT_SYMBOL(__lshrdi3); 15 + EXPORT_SYMBOL(__muldi3); 16 + 17 + #if !defined(__mc68020__) && !defined(__mc68030__) && \ 18 + !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcpu32__) 19 + /* 20 + * Simpler 68k and ColdFire parts also need a few other gcc functions. 21 + */ 22 + extern long long __divsi3(long long, long long); 23 + extern long long __modsi3(long long, long long); 24 + extern long long __mulsi3(long long, long long); 25 + extern long long __udivsi3(long long, long long); 26 + extern long long __umodsi3(long long, long long); 27 + 28 + EXPORT_SYMBOL(__divsi3); 29 + EXPORT_SYMBOL(__modsi3); 30 + EXPORT_SYMBOL(__mulsi3); 31 + EXPORT_SYMBOL(__udivsi3); 32 + EXPORT_SYMBOL(__umodsi3); 5 33 #endif
-16
arch/m68k/kernel/m68k_ksyms_mm.c
··· 1 - #include <linux/module.h> 2 - 3 - asmlinkage long long __ashldi3 (long long, int); 4 - asmlinkage long long __ashrdi3 (long long, int); 5 - asmlinkage long long __lshrdi3 (long long, int); 6 - asmlinkage long long __muldi3 (long long, long long); 7 - 8 - /* The following are special because they're not called 9 - explicitly (the C compiler generates them). Fortunately, 10 - their interface isn't gonna change any time soon now, so 11 - it's OK to leave it out of version control. */ 12 - EXPORT_SYMBOL(__ashldi3); 13 - EXPORT_SYMBOL(__ashrdi3); 14 - EXPORT_SYMBOL(__lshrdi3); 15 - EXPORT_SYMBOL(__muldi3); 16 -
-78
arch/m68k/kernel/m68k_ksyms_no.c
··· 1 - #include <linux/module.h> 2 - #include <linux/linkage.h> 3 - #include <linux/sched.h> 4 - #include <linux/string.h> 5 - #include <linux/mm.h> 6 - #include <linux/user.h> 7 - #include <linux/elfcore.h> 8 - #include <linux/in6.h> 9 - #include <linux/interrupt.h> 10 - 11 - #include <asm/setup.h> 12 - #include <asm/machdep.h> 13 - #include <asm/pgalloc.h> 14 - #include <asm/irq.h> 15 - #include <asm/io.h> 16 - #include <asm/checksum.h> 17 - #include <asm/current.h> 18 - 19 - extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); 20 - 21 - /* platform dependent support */ 22 - 23 - EXPORT_SYMBOL(__ioremap); 24 - EXPORT_SYMBOL(iounmap); 25 - EXPORT_SYMBOL(dump_fpu); 26 - 27 - EXPORT_SYMBOL(ip_fast_csum); 28 - 29 - EXPORT_SYMBOL(kernel_thread); 30 - 31 - /* Networking helper routines. */ 32 - EXPORT_SYMBOL(csum_partial_copy_nocheck); 33 - 34 - /* The following are special because they're not called 35 - explicitly (the C compiler generates them). Fortunately, 36 - their interface isn't gonna change any time soon now, so 37 - it's OK to leave it out of version control. */ 38 - EXPORT_SYMBOL(memcpy); 39 - EXPORT_SYMBOL(memset); 40 - 41 - /* 42 - * libgcc functions - functions that are used internally by the 43 - * compiler... (prototypes are not correct though, but that 44 - * doesn't really matter since they're not versioned). 45 - */ 46 - extern void __ashldi3(void); 47 - extern void __ashrdi3(void); 48 - extern void __divsi3(void); 49 - extern void __lshrdi3(void); 50 - extern void __modsi3(void); 51 - extern void __muldi3(void); 52 - extern void __mulsi3(void); 53 - extern void __udivsi3(void); 54 - extern void __umodsi3(void); 55 - 56 - /* gcc lib functions */ 57 - EXPORT_SYMBOL(__ashldi3); 58 - EXPORT_SYMBOL(__ashrdi3); 59 - EXPORT_SYMBOL(__divsi3); 60 - EXPORT_SYMBOL(__lshrdi3); 61 - EXPORT_SYMBOL(__modsi3); 62 - EXPORT_SYMBOL(__muldi3); 63 - EXPORT_SYMBOL(__mulsi3); 64 - EXPORT_SYMBOL(__udivsi3); 65 - EXPORT_SYMBOL(__umodsi3); 66 - 67 - #ifdef CONFIG_COLDFIRE 68 - extern unsigned int *dma_device_address; 69 - extern unsigned long dma_base_addr, _ramend; 70 - EXPORT_SYMBOL(dma_base_addr); 71 - EXPORT_SYMBOL(dma_device_address); 72 - EXPORT_SYMBOL(_ramend); 73 - 74 - extern asmlinkage void trap(void); 75 - extern void *_ramvec; 76 - EXPORT_SYMBOL(trap); 77 - EXPORT_SYMBOL(_ramvec); 78 - #endif /* CONFIG_COLDFIRE */
+2
arch/m68k/kernel/process_no.c
··· 151 151 set_fs(fs); 152 152 return retval; 153 153 } 154 + EXPORT_SYMBOL(kernel_thread); 154 155 155 156 void flush_thread(void) 156 157 { ··· 284 283 #endif 285 284 return 1; 286 285 } 286 + EXPORT_SYMBOL(dump_fpu); 287 287 288 288 /* 289 289 * Generic dumping code. Used for panic and debug.
+578 -3
arch/m68k/kernel/sys_m68k.c
··· 1 + /* 2 + * linux/arch/m68k/kernel/sys_m68k.c 3 + * 4 + * This file contains various random system calls that 5 + * have a non-standard calling sequence on the Linux/m68k 6 + * platform. 7 + */ 8 + 9 + #include <linux/capability.h> 10 + #include <linux/errno.h> 11 + #include <linux/sched.h> 12 + #include <linux/mm.h> 13 + #include <linux/fs.h> 14 + #include <linux/smp.h> 15 + #include <linux/sem.h> 16 + #include <linux/msg.h> 17 + #include <linux/shm.h> 18 + #include <linux/stat.h> 19 + #include <linux/syscalls.h> 20 + #include <linux/mman.h> 21 + #include <linux/file.h> 22 + #include <linux/ipc.h> 23 + 24 + #include <asm/setup.h> 25 + #include <asm/uaccess.h> 26 + #include <asm/cachectl.h> 27 + #include <asm/traps.h> 28 + #include <asm/page.h> 29 + #include <asm/unistd.h> 30 + #include <asm/cacheflush.h> 31 + 1 32 #ifdef CONFIG_MMU 2 - #include "sys_m68k_mm.c" 33 + 34 + #include <asm/tlb.h> 35 + 36 + asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address, 37 + unsigned long error_code); 38 + 39 + asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 40 + unsigned long prot, unsigned long flags, 41 + unsigned long fd, unsigned long pgoff) 42 + { 43 + /* 44 + * This is wrong for sun3 - there PAGE_SIZE is 8Kb, 45 + * so we need to shift the argument down by 1; m68k mmap64(3) 46 + * (in libc) expects the last argument of mmap2 in 4Kb units. 47 + */ 48 + return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); 49 + } 50 + 51 + /* Convert virtual (user) address VADDR to physical address PADDR */ 52 + #define virt_to_phys_040(vaddr) \ 53 + ({ \ 54 + unsigned long _mmusr, _paddr; \ 55 + \ 56 + __asm__ __volatile__ (".chip 68040\n\t" \ 57 + "ptestr (%1)\n\t" \ 58 + "movec %%mmusr,%0\n\t" \ 59 + ".chip 68k" \ 60 + : "=r" (_mmusr) \ 61 + : "a" (vaddr)); \ 62 + _paddr = (_mmusr & MMU_R_040) ? (_mmusr & PAGE_MASK) : 0; \ 63 + _paddr; \ 64 + }) 65 + 66 + static inline int 67 + cache_flush_040 (unsigned long addr, int scope, int cache, unsigned long len) 68 + { 69 + unsigned long paddr, i; 70 + 71 + switch (scope) 72 + { 73 + case FLUSH_SCOPE_ALL: 74 + switch (cache) 75 + { 76 + case FLUSH_CACHE_DATA: 77 + /* This nop is needed for some broken versions of the 68040. */ 78 + __asm__ __volatile__ ("nop\n\t" 79 + ".chip 68040\n\t" 80 + "cpusha %dc\n\t" 81 + ".chip 68k"); 82 + break; 83 + case FLUSH_CACHE_INSN: 84 + __asm__ __volatile__ ("nop\n\t" 85 + ".chip 68040\n\t" 86 + "cpusha %ic\n\t" 87 + ".chip 68k"); 88 + break; 89 + default: 90 + case FLUSH_CACHE_BOTH: 91 + __asm__ __volatile__ ("nop\n\t" 92 + ".chip 68040\n\t" 93 + "cpusha %bc\n\t" 94 + ".chip 68k"); 95 + break; 96 + } 97 + break; 98 + 99 + case FLUSH_SCOPE_LINE: 100 + /* Find the physical address of the first mapped page in the 101 + address range. */ 102 + if ((paddr = virt_to_phys_040(addr))) { 103 + paddr += addr & ~(PAGE_MASK | 15); 104 + len = (len + (addr & 15) + 15) >> 4; 105 + } else { 106 + unsigned long tmp = PAGE_SIZE - (addr & ~PAGE_MASK); 107 + 108 + if (len <= tmp) 109 + return 0; 110 + addr += tmp; 111 + len -= tmp; 112 + tmp = PAGE_SIZE; 113 + for (;;) 114 + { 115 + if ((paddr = virt_to_phys_040(addr))) 116 + break; 117 + if (len <= tmp) 118 + return 0; 119 + addr += tmp; 120 + len -= tmp; 121 + } 122 + len = (len + 15) >> 4; 123 + } 124 + i = (PAGE_SIZE - (paddr & ~PAGE_MASK)) >> 4; 125 + while (len--) 126 + { 127 + switch (cache) 128 + { 129 + case FLUSH_CACHE_DATA: 130 + __asm__ __volatile__ ("nop\n\t" 131 + ".chip 68040\n\t" 132 + "cpushl %%dc,(%0)\n\t" 133 + ".chip 68k" 134 + : : "a" (paddr)); 135 + break; 136 + case FLUSH_CACHE_INSN: 137 + __asm__ __volatile__ ("nop\n\t" 138 + ".chip 68040\n\t" 139 + "cpushl %%ic,(%0)\n\t" 140 + ".chip 68k" 141 + : : "a" (paddr)); 142 + break; 143 + default: 144 + case FLUSH_CACHE_BOTH: 145 + __asm__ __volatile__ ("nop\n\t" 146 + ".chip 68040\n\t" 147 + "cpushl %%bc,(%0)\n\t" 148 + ".chip 68k" 149 + : : "a" (paddr)); 150 + break; 151 + } 152 + if (!--i && len) 153 + { 154 + /* 155 + * No need to page align here since it is done by 156 + * virt_to_phys_040(). 157 + */ 158 + addr += PAGE_SIZE; 159 + i = PAGE_SIZE / 16; 160 + /* Recompute physical address when crossing a page 161 + boundary. */ 162 + for (;;) 163 + { 164 + if ((paddr = virt_to_phys_040(addr))) 165 + break; 166 + if (len <= i) 167 + return 0; 168 + len -= i; 169 + addr += PAGE_SIZE; 170 + } 171 + } 172 + else 173 + paddr += 16; 174 + } 175 + break; 176 + 177 + default: 178 + case FLUSH_SCOPE_PAGE: 179 + len += (addr & ~PAGE_MASK) + (PAGE_SIZE - 1); 180 + for (len >>= PAGE_SHIFT; len--; addr += PAGE_SIZE) 181 + { 182 + if (!(paddr = virt_to_phys_040(addr))) 183 + continue; 184 + switch (cache) 185 + { 186 + case FLUSH_CACHE_DATA: 187 + __asm__ __volatile__ ("nop\n\t" 188 + ".chip 68040\n\t" 189 + "cpushp %%dc,(%0)\n\t" 190 + ".chip 68k" 191 + : : "a" (paddr)); 192 + break; 193 + case FLUSH_CACHE_INSN: 194 + __asm__ __volatile__ ("nop\n\t" 195 + ".chip 68040\n\t" 196 + "cpushp %%ic,(%0)\n\t" 197 + ".chip 68k" 198 + : : "a" (paddr)); 199 + break; 200 + default: 201 + case FLUSH_CACHE_BOTH: 202 + __asm__ __volatile__ ("nop\n\t" 203 + ".chip 68040\n\t" 204 + "cpushp %%bc,(%0)\n\t" 205 + ".chip 68k" 206 + : : "a" (paddr)); 207 + break; 208 + } 209 + } 210 + break; 211 + } 212 + return 0; 213 + } 214 + 215 + #define virt_to_phys_060(vaddr) \ 216 + ({ \ 217 + unsigned long paddr; \ 218 + __asm__ __volatile__ (".chip 68060\n\t" \ 219 + "plpar (%0)\n\t" \ 220 + ".chip 68k" \ 221 + : "=a" (paddr) \ 222 + : "0" (vaddr)); \ 223 + (paddr); /* XXX */ \ 224 + }) 225 + 226 + static inline int 227 + cache_flush_060 (unsigned long addr, int scope, int cache, unsigned long len) 228 + { 229 + unsigned long paddr, i; 230 + 231 + /* 232 + * 68060 manual says: 233 + * cpush %dc : flush DC, remains valid (with our %cacr setup) 234 + * cpush %ic : invalidate IC 235 + * cpush %bc : flush DC + invalidate IC 236 + */ 237 + switch (scope) 238 + { 239 + case FLUSH_SCOPE_ALL: 240 + switch (cache) 241 + { 242 + case FLUSH_CACHE_DATA: 243 + __asm__ __volatile__ (".chip 68060\n\t" 244 + "cpusha %dc\n\t" 245 + ".chip 68k"); 246 + break; 247 + case FLUSH_CACHE_INSN: 248 + __asm__ __volatile__ (".chip 68060\n\t" 249 + "cpusha %ic\n\t" 250 + ".chip 68k"); 251 + break; 252 + default: 253 + case FLUSH_CACHE_BOTH: 254 + __asm__ __volatile__ (".chip 68060\n\t" 255 + "cpusha %bc\n\t" 256 + ".chip 68k"); 257 + break; 258 + } 259 + break; 260 + 261 + case FLUSH_SCOPE_LINE: 262 + /* Find the physical address of the first mapped page in the 263 + address range. */ 264 + len += addr & 15; 265 + addr &= -16; 266 + if (!(paddr = virt_to_phys_060(addr))) { 267 + unsigned long tmp = PAGE_SIZE - (addr & ~PAGE_MASK); 268 + 269 + if (len <= tmp) 270 + return 0; 271 + addr += tmp; 272 + len -= tmp; 273 + tmp = PAGE_SIZE; 274 + for (;;) 275 + { 276 + if ((paddr = virt_to_phys_060(addr))) 277 + break; 278 + if (len <= tmp) 279 + return 0; 280 + addr += tmp; 281 + len -= tmp; 282 + } 283 + } 284 + len = (len + 15) >> 4; 285 + i = (PAGE_SIZE - (paddr & ~PAGE_MASK)) >> 4; 286 + while (len--) 287 + { 288 + switch (cache) 289 + { 290 + case FLUSH_CACHE_DATA: 291 + __asm__ __volatile__ (".chip 68060\n\t" 292 + "cpushl %%dc,(%0)\n\t" 293 + ".chip 68k" 294 + : : "a" (paddr)); 295 + break; 296 + case FLUSH_CACHE_INSN: 297 + __asm__ __volatile__ (".chip 68060\n\t" 298 + "cpushl %%ic,(%0)\n\t" 299 + ".chip 68k" 300 + : : "a" (paddr)); 301 + break; 302 + default: 303 + case FLUSH_CACHE_BOTH: 304 + __asm__ __volatile__ (".chip 68060\n\t" 305 + "cpushl %%bc,(%0)\n\t" 306 + ".chip 68k" 307 + : : "a" (paddr)); 308 + break; 309 + } 310 + if (!--i && len) 311 + { 312 + 313 + /* 314 + * We just want to jump to the first cache line 315 + * in the next page. 316 + */ 317 + addr += PAGE_SIZE; 318 + addr &= PAGE_MASK; 319 + 320 + i = PAGE_SIZE / 16; 321 + /* Recompute physical address when crossing a page 322 + boundary. */ 323 + for (;;) 324 + { 325 + if ((paddr = virt_to_phys_060(addr))) 326 + break; 327 + if (len <= i) 328 + return 0; 329 + len -= i; 330 + addr += PAGE_SIZE; 331 + } 332 + } 333 + else 334 + paddr += 16; 335 + } 336 + break; 337 + 338 + default: 339 + case FLUSH_SCOPE_PAGE: 340 + len += (addr & ~PAGE_MASK) + (PAGE_SIZE - 1); 341 + addr &= PAGE_MASK; /* Workaround for bug in some 342 + revisions of the 68060 */ 343 + for (len >>= PAGE_SHIFT; len--; addr += PAGE_SIZE) 344 + { 345 + if (!(paddr = virt_to_phys_060(addr))) 346 + continue; 347 + switch (cache) 348 + { 349 + case FLUSH_CACHE_DATA: 350 + __asm__ __volatile__ (".chip 68060\n\t" 351 + "cpushp %%dc,(%0)\n\t" 352 + ".chip 68k" 353 + : : "a" (paddr)); 354 + break; 355 + case FLUSH_CACHE_INSN: 356 + __asm__ __volatile__ (".chip 68060\n\t" 357 + "cpushp %%ic,(%0)\n\t" 358 + ".chip 68k" 359 + : : "a" (paddr)); 360 + break; 361 + default: 362 + case FLUSH_CACHE_BOTH: 363 + __asm__ __volatile__ (".chip 68060\n\t" 364 + "cpushp %%bc,(%0)\n\t" 365 + ".chip 68k" 366 + : : "a" (paddr)); 367 + break; 368 + } 369 + } 370 + break; 371 + } 372 + return 0; 373 + } 374 + 375 + /* sys_cacheflush -- flush (part of) the processor cache. */ 376 + asmlinkage int 377 + sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) 378 + { 379 + struct vm_area_struct *vma; 380 + int ret = -EINVAL; 381 + 382 + if (scope < FLUSH_SCOPE_LINE || scope > FLUSH_SCOPE_ALL || 383 + cache & ~FLUSH_CACHE_BOTH) 384 + goto out; 385 + 386 + if (scope == FLUSH_SCOPE_ALL) { 387 + /* Only the superuser may explicitly flush the whole cache. */ 388 + ret = -EPERM; 389 + if (!capable(CAP_SYS_ADMIN)) 390 + goto out; 391 + } else { 392 + /* 393 + * Verify that the specified address region actually belongs 394 + * to this process. 395 + */ 396 + vma = find_vma (current->mm, addr); 397 + ret = -EINVAL; 398 + /* Check for overflow. */ 399 + if (addr + len < addr) 400 + goto out; 401 + if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) 402 + goto out; 403 + } 404 + 405 + if (CPU_IS_020_OR_030) { 406 + if (scope == FLUSH_SCOPE_LINE && len < 256) { 407 + unsigned long cacr; 408 + __asm__ ("movec %%cacr, %0" : "=r" (cacr)); 409 + if (cache & FLUSH_CACHE_INSN) 410 + cacr |= 4; 411 + if (cache & FLUSH_CACHE_DATA) 412 + cacr |= 0x400; 413 + len >>= 2; 414 + while (len--) { 415 + __asm__ __volatile__ ("movec %1, %%caar\n\t" 416 + "movec %0, %%cacr" 417 + : /* no outputs */ 418 + : "r" (cacr), "r" (addr)); 419 + addr += 4; 420 + } 421 + } else { 422 + /* Flush the whole cache, even if page granularity requested. */ 423 + unsigned long cacr; 424 + __asm__ ("movec %%cacr, %0" : "=r" (cacr)); 425 + if (cache & FLUSH_CACHE_INSN) 426 + cacr |= 8; 427 + if (cache & FLUSH_CACHE_DATA) 428 + cacr |= 0x800; 429 + __asm__ __volatile__ ("movec %0, %%cacr" : : "r" (cacr)); 430 + } 431 + ret = 0; 432 + goto out; 433 + } else { 434 + /* 435 + * 040 or 060: don't blindly trust 'scope', someone could 436 + * try to flush a few megs of memory. 437 + */ 438 + 439 + if (len>=3*PAGE_SIZE && scope<FLUSH_SCOPE_PAGE) 440 + scope=FLUSH_SCOPE_PAGE; 441 + if (len>=10*PAGE_SIZE && scope<FLUSH_SCOPE_ALL) 442 + scope=FLUSH_SCOPE_ALL; 443 + if (CPU_IS_040) { 444 + ret = cache_flush_040 (addr, scope, cache, len); 445 + } else if (CPU_IS_060) { 446 + ret = cache_flush_060 (addr, scope, cache, len); 447 + } 448 + } 449 + out: 450 + return ret; 451 + } 452 + 453 + /* This syscall gets its arguments in A0 (mem), D2 (oldval) and 454 + D1 (newval). */ 455 + asmlinkage int 456 + sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5, 457 + unsigned long __user * mem) 458 + { 459 + /* This was borrowed from ARM's implementation. */ 460 + for (;;) { 461 + struct mm_struct *mm = current->mm; 462 + pgd_t *pgd; 463 + pmd_t *pmd; 464 + pte_t *pte; 465 + spinlock_t *ptl; 466 + unsigned long mem_value; 467 + 468 + down_read(&mm->mmap_sem); 469 + pgd = pgd_offset(mm, (unsigned long)mem); 470 + if (!pgd_present(*pgd)) 471 + goto bad_access; 472 + pmd = pmd_offset(pgd, (unsigned long)mem); 473 + if (!pmd_present(*pmd)) 474 + goto bad_access; 475 + pte = pte_offset_map_lock(mm, pmd, (unsigned long)mem, &ptl); 476 + if (!pte_present(*pte) || !pte_dirty(*pte) 477 + || !pte_write(*pte)) { 478 + pte_unmap_unlock(pte, ptl); 479 + goto bad_access; 480 + } 481 + 482 + mem_value = *mem; 483 + if (mem_value == oldval) 484 + *mem = newval; 485 + 486 + pte_unmap_unlock(pte, ptl); 487 + up_read(&mm->mmap_sem); 488 + return mem_value; 489 + 490 + bad_access: 491 + up_read(&mm->mmap_sem); 492 + /* This is not necessarily a bad access, we can get here if 493 + a memory we're trying to write to should be copied-on-write. 494 + Make the kernel do the necessary page stuff, then re-iterate. 495 + Simulate a write access fault to do that. */ 496 + { 497 + /* The first argument of the function corresponds to 498 + D1, which is the first field of struct pt_regs. */ 499 + struct pt_regs *fp = (struct pt_regs *)&newval; 500 + 501 + /* '3' is an RMW flag. */ 502 + if (do_page_fault(fp, (unsigned long)mem, 3)) 503 + /* If the do_page_fault() failed, we don't 504 + have anything meaningful to return. 505 + There should be a SIGSEGV pending for 506 + the process. */ 507 + return 0xdeadbeef; 508 + } 509 + } 510 + } 511 + 3 512 #else 4 - #include "sys_m68k_no.c" 5 - #endif 513 + 514 + /* sys_cacheflush -- flush (part of) the processor cache. */ 515 + asmlinkage int 516 + sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) 517 + { 518 + flush_cache_all(); 519 + return 0; 520 + } 521 + 522 + /* This syscall gets its arguments in A0 (mem), D2 (oldval) and 523 + D1 (newval). */ 524 + asmlinkage int 525 + sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5, 526 + unsigned long __user * mem) 527 + { 528 + struct mm_struct *mm = current->mm; 529 + unsigned long mem_value; 530 + 531 + down_read(&mm->mmap_sem); 532 + 533 + mem_value = *mem; 534 + if (mem_value == oldval) 535 + *mem = newval; 536 + 537 + up_read(&mm->mmap_sem); 538 + return mem_value; 539 + } 540 + 541 + #endif /* CONFIG_MMU */ 542 + 543 + asmlinkage int sys_getpagesize(void) 544 + { 545 + return PAGE_SIZE; 546 + } 547 + 548 + /* 549 + * Do a system call from kernel instead of calling sys_execve so we 550 + * end up with proper pt_regs. 551 + */ 552 + int kernel_execve(const char *filename, 553 + const char *const argv[], 554 + const char *const envp[]) 555 + { 556 + register long __res asm ("%d0") = __NR_execve; 557 + register long __a asm ("%d1") = (long)(filename); 558 + register long __b asm ("%d2") = (long)(argv); 559 + register long __c asm ("%d3") = (long)(envp); 560 + asm volatile ("trap #0" : "+d" (__res) 561 + : "d" (__a), "d" (__b), "d" (__c)); 562 + return __res; 563 + } 564 + 565 + asmlinkage unsigned long sys_get_thread_area(void) 566 + { 567 + return current_thread_info()->tp_value; 568 + } 569 + 570 + asmlinkage int sys_set_thread_area(unsigned long tp) 571 + { 572 + current_thread_info()->tp_value = tp; 573 + return 0; 574 + } 575 + 576 + asmlinkage int sys_atomic_barrier(void) 577 + { 578 + /* no code needed for uniprocs */ 579 + return 0; 580 + }
-546
arch/m68k/kernel/sys_m68k_mm.c
··· 1 - /* 2 - * linux/arch/m68k/kernel/sys_m68k.c 3 - * 4 - * This file contains various random system calls that 5 - * have a non-standard calling sequence on the Linux/m68k 6 - * platform. 7 - */ 8 - 9 - #include <linux/capability.h> 10 - #include <linux/errno.h> 11 - #include <linux/sched.h> 12 - #include <linux/mm.h> 13 - #include <linux/fs.h> 14 - #include <linux/smp.h> 15 - #include <linux/sem.h> 16 - #include <linux/msg.h> 17 - #include <linux/shm.h> 18 - #include <linux/stat.h> 19 - #include <linux/syscalls.h> 20 - #include <linux/mman.h> 21 - #include <linux/file.h> 22 - #include <linux/ipc.h> 23 - 24 - #include <asm/setup.h> 25 - #include <asm/uaccess.h> 26 - #include <asm/cachectl.h> 27 - #include <asm/traps.h> 28 - #include <asm/page.h> 29 - #include <asm/unistd.h> 30 - #include <linux/elf.h> 31 - #include <asm/tlb.h> 32 - 33 - asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address, 34 - unsigned long error_code); 35 - 36 - asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 37 - unsigned long prot, unsigned long flags, 38 - unsigned long fd, unsigned long pgoff) 39 - { 40 - /* 41 - * This is wrong for sun3 - there PAGE_SIZE is 8Kb, 42 - * so we need to shift the argument down by 1; m68k mmap64(3) 43 - * (in libc) expects the last argument of mmap2 in 4Kb units. 44 - */ 45 - return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); 46 - } 47 - 48 - /* Convert virtual (user) address VADDR to physical address PADDR */ 49 - #define virt_to_phys_040(vaddr) \ 50 - ({ \ 51 - unsigned long _mmusr, _paddr; \ 52 - \ 53 - __asm__ __volatile__ (".chip 68040\n\t" \ 54 - "ptestr (%1)\n\t" \ 55 - "movec %%mmusr,%0\n\t" \ 56 - ".chip 68k" \ 57 - : "=r" (_mmusr) \ 58 - : "a" (vaddr)); \ 59 - _paddr = (_mmusr & MMU_R_040) ? (_mmusr & PAGE_MASK) : 0; \ 60 - _paddr; \ 61 - }) 62 - 63 - static inline int 64 - cache_flush_040 (unsigned long addr, int scope, int cache, unsigned long len) 65 - { 66 - unsigned long paddr, i; 67 - 68 - switch (scope) 69 - { 70 - case FLUSH_SCOPE_ALL: 71 - switch (cache) 72 - { 73 - case FLUSH_CACHE_DATA: 74 - /* This nop is needed for some broken versions of the 68040. */ 75 - __asm__ __volatile__ ("nop\n\t" 76 - ".chip 68040\n\t" 77 - "cpusha %dc\n\t" 78 - ".chip 68k"); 79 - break; 80 - case FLUSH_CACHE_INSN: 81 - __asm__ __volatile__ ("nop\n\t" 82 - ".chip 68040\n\t" 83 - "cpusha %ic\n\t" 84 - ".chip 68k"); 85 - break; 86 - default: 87 - case FLUSH_CACHE_BOTH: 88 - __asm__ __volatile__ ("nop\n\t" 89 - ".chip 68040\n\t" 90 - "cpusha %bc\n\t" 91 - ".chip 68k"); 92 - break; 93 - } 94 - break; 95 - 96 - case FLUSH_SCOPE_LINE: 97 - /* Find the physical address of the first mapped page in the 98 - address range. */ 99 - if ((paddr = virt_to_phys_040(addr))) { 100 - paddr += addr & ~(PAGE_MASK | 15); 101 - len = (len + (addr & 15) + 15) >> 4; 102 - } else { 103 - unsigned long tmp = PAGE_SIZE - (addr & ~PAGE_MASK); 104 - 105 - if (len <= tmp) 106 - return 0; 107 - addr += tmp; 108 - len -= tmp; 109 - tmp = PAGE_SIZE; 110 - for (;;) 111 - { 112 - if ((paddr = virt_to_phys_040(addr))) 113 - break; 114 - if (len <= tmp) 115 - return 0; 116 - addr += tmp; 117 - len -= tmp; 118 - } 119 - len = (len + 15) >> 4; 120 - } 121 - i = (PAGE_SIZE - (paddr & ~PAGE_MASK)) >> 4; 122 - while (len--) 123 - { 124 - switch (cache) 125 - { 126 - case FLUSH_CACHE_DATA: 127 - __asm__ __volatile__ ("nop\n\t" 128 - ".chip 68040\n\t" 129 - "cpushl %%dc,(%0)\n\t" 130 - ".chip 68k" 131 - : : "a" (paddr)); 132 - break; 133 - case FLUSH_CACHE_INSN: 134 - __asm__ __volatile__ ("nop\n\t" 135 - ".chip 68040\n\t" 136 - "cpushl %%ic,(%0)\n\t" 137 - ".chip 68k" 138 - : : "a" (paddr)); 139 - break; 140 - default: 141 - case FLUSH_CACHE_BOTH: 142 - __asm__ __volatile__ ("nop\n\t" 143 - ".chip 68040\n\t" 144 - "cpushl %%bc,(%0)\n\t" 145 - ".chip 68k" 146 - : : "a" (paddr)); 147 - break; 148 - } 149 - if (!--i && len) 150 - { 151 - /* 152 - * No need to page align here since it is done by 153 - * virt_to_phys_040(). 154 - */ 155 - addr += PAGE_SIZE; 156 - i = PAGE_SIZE / 16; 157 - /* Recompute physical address when crossing a page 158 - boundary. */ 159 - for (;;) 160 - { 161 - if ((paddr = virt_to_phys_040(addr))) 162 - break; 163 - if (len <= i) 164 - return 0; 165 - len -= i; 166 - addr += PAGE_SIZE; 167 - } 168 - } 169 - else 170 - paddr += 16; 171 - } 172 - break; 173 - 174 - default: 175 - case FLUSH_SCOPE_PAGE: 176 - len += (addr & ~PAGE_MASK) + (PAGE_SIZE - 1); 177 - for (len >>= PAGE_SHIFT; len--; addr += PAGE_SIZE) 178 - { 179 - if (!(paddr = virt_to_phys_040(addr))) 180 - continue; 181 - switch (cache) 182 - { 183 - case FLUSH_CACHE_DATA: 184 - __asm__ __volatile__ ("nop\n\t" 185 - ".chip 68040\n\t" 186 - "cpushp %%dc,(%0)\n\t" 187 - ".chip 68k" 188 - : : "a" (paddr)); 189 - break; 190 - case FLUSH_CACHE_INSN: 191 - __asm__ __volatile__ ("nop\n\t" 192 - ".chip 68040\n\t" 193 - "cpushp %%ic,(%0)\n\t" 194 - ".chip 68k" 195 - : : "a" (paddr)); 196 - break; 197 - default: 198 - case FLUSH_CACHE_BOTH: 199 - __asm__ __volatile__ ("nop\n\t" 200 - ".chip 68040\n\t" 201 - "cpushp %%bc,(%0)\n\t" 202 - ".chip 68k" 203 - : : "a" (paddr)); 204 - break; 205 - } 206 - } 207 - break; 208 - } 209 - return 0; 210 - } 211 - 212 - #define virt_to_phys_060(vaddr) \ 213 - ({ \ 214 - unsigned long paddr; \ 215 - __asm__ __volatile__ (".chip 68060\n\t" \ 216 - "plpar (%0)\n\t" \ 217 - ".chip 68k" \ 218 - : "=a" (paddr) \ 219 - : "0" (vaddr)); \ 220 - (paddr); /* XXX */ \ 221 - }) 222 - 223 - static inline int 224 - cache_flush_060 (unsigned long addr, int scope, int cache, unsigned long len) 225 - { 226 - unsigned long paddr, i; 227 - 228 - /* 229 - * 68060 manual says: 230 - * cpush %dc : flush DC, remains valid (with our %cacr setup) 231 - * cpush %ic : invalidate IC 232 - * cpush %bc : flush DC + invalidate IC 233 - */ 234 - switch (scope) 235 - { 236 - case FLUSH_SCOPE_ALL: 237 - switch (cache) 238 - { 239 - case FLUSH_CACHE_DATA: 240 - __asm__ __volatile__ (".chip 68060\n\t" 241 - "cpusha %dc\n\t" 242 - ".chip 68k"); 243 - break; 244 - case FLUSH_CACHE_INSN: 245 - __asm__ __volatile__ (".chip 68060\n\t" 246 - "cpusha %ic\n\t" 247 - ".chip 68k"); 248 - break; 249 - default: 250 - case FLUSH_CACHE_BOTH: 251 - __asm__ __volatile__ (".chip 68060\n\t" 252 - "cpusha %bc\n\t" 253 - ".chip 68k"); 254 - break; 255 - } 256 - break; 257 - 258 - case FLUSH_SCOPE_LINE: 259 - /* Find the physical address of the first mapped page in the 260 - address range. */ 261 - len += addr & 15; 262 - addr &= -16; 263 - if (!(paddr = virt_to_phys_060(addr))) { 264 - unsigned long tmp = PAGE_SIZE - (addr & ~PAGE_MASK); 265 - 266 - if (len <= tmp) 267 - return 0; 268 - addr += tmp; 269 - len -= tmp; 270 - tmp = PAGE_SIZE; 271 - for (;;) 272 - { 273 - if ((paddr = virt_to_phys_060(addr))) 274 - break; 275 - if (len <= tmp) 276 - return 0; 277 - addr += tmp; 278 - len -= tmp; 279 - } 280 - } 281 - len = (len + 15) >> 4; 282 - i = (PAGE_SIZE - (paddr & ~PAGE_MASK)) >> 4; 283 - while (len--) 284 - { 285 - switch (cache) 286 - { 287 - case FLUSH_CACHE_DATA: 288 - __asm__ __volatile__ (".chip 68060\n\t" 289 - "cpushl %%dc,(%0)\n\t" 290 - ".chip 68k" 291 - : : "a" (paddr)); 292 - break; 293 - case FLUSH_CACHE_INSN: 294 - __asm__ __volatile__ (".chip 68060\n\t" 295 - "cpushl %%ic,(%0)\n\t" 296 - ".chip 68k" 297 - : : "a" (paddr)); 298 - break; 299 - default: 300 - case FLUSH_CACHE_BOTH: 301 - __asm__ __volatile__ (".chip 68060\n\t" 302 - "cpushl %%bc,(%0)\n\t" 303 - ".chip 68k" 304 - : : "a" (paddr)); 305 - break; 306 - } 307 - if (!--i && len) 308 - { 309 - 310 - /* 311 - * We just want to jump to the first cache line 312 - * in the next page. 313 - */ 314 - addr += PAGE_SIZE; 315 - addr &= PAGE_MASK; 316 - 317 - i = PAGE_SIZE / 16; 318 - /* Recompute physical address when crossing a page 319 - boundary. */ 320 - for (;;) 321 - { 322 - if ((paddr = virt_to_phys_060(addr))) 323 - break; 324 - if (len <= i) 325 - return 0; 326 - len -= i; 327 - addr += PAGE_SIZE; 328 - } 329 - } 330 - else 331 - paddr += 16; 332 - } 333 - break; 334 - 335 - default: 336 - case FLUSH_SCOPE_PAGE: 337 - len += (addr & ~PAGE_MASK) + (PAGE_SIZE - 1); 338 - addr &= PAGE_MASK; /* Workaround for bug in some 339 - revisions of the 68060 */ 340 - for (len >>= PAGE_SHIFT; len--; addr += PAGE_SIZE) 341 - { 342 - if (!(paddr = virt_to_phys_060(addr))) 343 - continue; 344 - switch (cache) 345 - { 346 - case FLUSH_CACHE_DATA: 347 - __asm__ __volatile__ (".chip 68060\n\t" 348 - "cpushp %%dc,(%0)\n\t" 349 - ".chip 68k" 350 - : : "a" (paddr)); 351 - break; 352 - case FLUSH_CACHE_INSN: 353 - __asm__ __volatile__ (".chip 68060\n\t" 354 - "cpushp %%ic,(%0)\n\t" 355 - ".chip 68k" 356 - : : "a" (paddr)); 357 - break; 358 - default: 359 - case FLUSH_CACHE_BOTH: 360 - __asm__ __volatile__ (".chip 68060\n\t" 361 - "cpushp %%bc,(%0)\n\t" 362 - ".chip 68k" 363 - : : "a" (paddr)); 364 - break; 365 - } 366 - } 367 - break; 368 - } 369 - return 0; 370 - } 371 - 372 - /* sys_cacheflush -- flush (part of) the processor cache. */ 373 - asmlinkage int 374 - sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) 375 - { 376 - struct vm_area_struct *vma; 377 - int ret = -EINVAL; 378 - 379 - if (scope < FLUSH_SCOPE_LINE || scope > FLUSH_SCOPE_ALL || 380 - cache & ~FLUSH_CACHE_BOTH) 381 - goto out; 382 - 383 - if (scope == FLUSH_SCOPE_ALL) { 384 - /* Only the superuser may explicitly flush the whole cache. */ 385 - ret = -EPERM; 386 - if (!capable(CAP_SYS_ADMIN)) 387 - goto out; 388 - } else { 389 - /* 390 - * Verify that the specified address region actually belongs 391 - * to this process. 392 - */ 393 - vma = find_vma (current->mm, addr); 394 - ret = -EINVAL; 395 - /* Check for overflow. */ 396 - if (addr + len < addr) 397 - goto out; 398 - if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) 399 - goto out; 400 - } 401 - 402 - if (CPU_IS_020_OR_030) { 403 - if (scope == FLUSH_SCOPE_LINE && len < 256) { 404 - unsigned long cacr; 405 - __asm__ ("movec %%cacr, %0" : "=r" (cacr)); 406 - if (cache & FLUSH_CACHE_INSN) 407 - cacr |= 4; 408 - if (cache & FLUSH_CACHE_DATA) 409 - cacr |= 0x400; 410 - len >>= 2; 411 - while (len--) { 412 - __asm__ __volatile__ ("movec %1, %%caar\n\t" 413 - "movec %0, %%cacr" 414 - : /* no outputs */ 415 - : "r" (cacr), "r" (addr)); 416 - addr += 4; 417 - } 418 - } else { 419 - /* Flush the whole cache, even if page granularity requested. */ 420 - unsigned long cacr; 421 - __asm__ ("movec %%cacr, %0" : "=r" (cacr)); 422 - if (cache & FLUSH_CACHE_INSN) 423 - cacr |= 8; 424 - if (cache & FLUSH_CACHE_DATA) 425 - cacr |= 0x800; 426 - __asm__ __volatile__ ("movec %0, %%cacr" : : "r" (cacr)); 427 - } 428 - ret = 0; 429 - goto out; 430 - } else { 431 - /* 432 - * 040 or 060: don't blindly trust 'scope', someone could 433 - * try to flush a few megs of memory. 434 - */ 435 - 436 - if (len>=3*PAGE_SIZE && scope<FLUSH_SCOPE_PAGE) 437 - scope=FLUSH_SCOPE_PAGE; 438 - if (len>=10*PAGE_SIZE && scope<FLUSH_SCOPE_ALL) 439 - scope=FLUSH_SCOPE_ALL; 440 - if (CPU_IS_040) { 441 - ret = cache_flush_040 (addr, scope, cache, len); 442 - } else if (CPU_IS_060) { 443 - ret = cache_flush_060 (addr, scope, cache, len); 444 - } 445 - } 446 - out: 447 - return ret; 448 - } 449 - 450 - asmlinkage int sys_getpagesize(void) 451 - { 452 - return PAGE_SIZE; 453 - } 454 - 455 - /* 456 - * Do a system call from kernel instead of calling sys_execve so we 457 - * end up with proper pt_regs. 458 - */ 459 - int kernel_execve(const char *filename, 460 - const char *const argv[], 461 - const char *const envp[]) 462 - { 463 - register long __res asm ("%d0") = __NR_execve; 464 - register long __a asm ("%d1") = (long)(filename); 465 - register long __b asm ("%d2") = (long)(argv); 466 - register long __c asm ("%d3") = (long)(envp); 467 - asm volatile ("trap #0" : "+d" (__res) 468 - : "d" (__a), "d" (__b), "d" (__c)); 469 - return __res; 470 - } 471 - 472 - asmlinkage unsigned long sys_get_thread_area(void) 473 - { 474 - return current_thread_info()->tp_value; 475 - } 476 - 477 - asmlinkage int sys_set_thread_area(unsigned long tp) 478 - { 479 - current_thread_info()->tp_value = tp; 480 - return 0; 481 - } 482 - 483 - /* This syscall gets its arguments in A0 (mem), D2 (oldval) and 484 - D1 (newval). */ 485 - asmlinkage int 486 - sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5, 487 - unsigned long __user * mem) 488 - { 489 - /* This was borrowed from ARM's implementation. */ 490 - for (;;) { 491 - struct mm_struct *mm = current->mm; 492 - pgd_t *pgd; 493 - pmd_t *pmd; 494 - pte_t *pte; 495 - spinlock_t *ptl; 496 - unsigned long mem_value; 497 - 498 - down_read(&mm->mmap_sem); 499 - pgd = pgd_offset(mm, (unsigned long)mem); 500 - if (!pgd_present(*pgd)) 501 - goto bad_access; 502 - pmd = pmd_offset(pgd, (unsigned long)mem); 503 - if (!pmd_present(*pmd)) 504 - goto bad_access; 505 - pte = pte_offset_map_lock(mm, pmd, (unsigned long)mem, &ptl); 506 - if (!pte_present(*pte) || !pte_dirty(*pte) 507 - || !pte_write(*pte)) { 508 - pte_unmap_unlock(pte, ptl); 509 - goto bad_access; 510 - } 511 - 512 - mem_value = *mem; 513 - if (mem_value == oldval) 514 - *mem = newval; 515 - 516 - pte_unmap_unlock(pte, ptl); 517 - up_read(&mm->mmap_sem); 518 - return mem_value; 519 - 520 - bad_access: 521 - up_read(&mm->mmap_sem); 522 - /* This is not necessarily a bad access, we can get here if 523 - a memory we're trying to write to should be copied-on-write. 524 - Make the kernel do the necessary page stuff, then re-iterate. 525 - Simulate a write access fault to do that. */ 526 - { 527 - /* The first argument of the function corresponds to 528 - D1, which is the first field of struct pt_regs. */ 529 - struct pt_regs *fp = (struct pt_regs *)&newval; 530 - 531 - /* '3' is an RMW flag. */ 532 - if (do_page_fault(fp, (unsigned long)mem, 3)) 533 - /* If the do_page_fault() failed, we don't 534 - have anything meaningful to return. 535 - There should be a SIGSEGV pending for 536 - the process. */ 537 - return 0xdeadbeef; 538 - } 539 - } 540 - } 541 - 542 - asmlinkage int sys_atomic_barrier(void) 543 - { 544 - /* no code needed for uniprocs */ 545 - return 0; 546 - }
-94
arch/m68k/kernel/sys_m68k_no.c
··· 1 - /* 2 - * linux/arch/m68knommu/kernel/sys_m68k.c 3 - * 4 - * This file contains various random system calls that 5 - * have a non-standard calling sequence on the Linux/m68k 6 - * platform. 7 - */ 8 - 9 - #include <linux/errno.h> 10 - #include <linux/sched.h> 11 - #include <linux/mm.h> 12 - #include <linux/smp.h> 13 - #include <linux/sem.h> 14 - #include <linux/msg.h> 15 - #include <linux/shm.h> 16 - #include <linux/stat.h> 17 - #include <linux/syscalls.h> 18 - #include <linux/mman.h> 19 - #include <linux/file.h> 20 - #include <linux/ipc.h> 21 - #include <linux/fs.h> 22 - 23 - #include <asm/setup.h> 24 - #include <asm/uaccess.h> 25 - #include <asm/cachectl.h> 26 - #include <asm/traps.h> 27 - #include <asm/cacheflush.h> 28 - #include <asm/unistd.h> 29 - 30 - /* sys_cacheflush -- flush (part of) the processor cache. */ 31 - asmlinkage int 32 - sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) 33 - { 34 - flush_cache_all(); 35 - return(0); 36 - } 37 - 38 - asmlinkage int sys_getpagesize(void) 39 - { 40 - return PAGE_SIZE; 41 - } 42 - 43 - /* 44 - * Do a system call from kernel instead of calling sys_execve so we 45 - * end up with proper pt_regs. 46 - */ 47 - int kernel_execve(const char *filename, 48 - const char *const argv[], 49 - const char *const envp[]) 50 - { 51 - register long __res asm ("%d0") = __NR_execve; 52 - register long __a asm ("%d1") = (long)(filename); 53 - register long __b asm ("%d2") = (long)(argv); 54 - register long __c asm ("%d3") = (long)(envp); 55 - asm volatile ("trap #0" : "+d" (__res) 56 - : "d" (__a), "d" (__b), "d" (__c)); 57 - return __res; 58 - } 59 - 60 - asmlinkage unsigned long sys_get_thread_area(void) 61 - { 62 - return current_thread_info()->tp_value; 63 - } 64 - 65 - asmlinkage int sys_set_thread_area(unsigned long tp) 66 - { 67 - current_thread_info()->tp_value = tp; 68 - return 0; 69 - } 70 - 71 - /* This syscall gets its arguments in A0 (mem), D2 (oldval) and 72 - D1 (newval). */ 73 - asmlinkage int 74 - sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5, 75 - unsigned long __user * mem) 76 - { 77 - struct mm_struct *mm = current->mm; 78 - unsigned long mem_value; 79 - 80 - down_read(&mm->mmap_sem); 81 - 82 - mem_value = *mem; 83 - if (mem_value == oldval) 84 - *mem = newval; 85 - 86 - up_read(&mm->mmap_sem); 87 - return mem_value; 88 - } 89 - 90 - asmlinkage int sys_atomic_barrier(void) 91 - { 92 - /* no code needed for uniprocs */ 93 - return 0; 94 - }
-1
arch/m68k/kernel/syscalltable.S
··· 11 11 * Linux/m68k support by Hamish Macdonald 12 12 */ 13 13 14 - #include <linux/sys.h> 15 14 #include <linux/linkage.h> 16 15 17 16 #ifndef CONFIG_MMU
+11 -2
arch/m68k/lib/Makefile
··· 1 + 2 + # 3 + # Makefile for m68k-specific library files.. 4 + # 5 + 6 + lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ 7 + memcpy.o memset.o memmove.o 8 + 1 9 ifdef CONFIG_MMU 2 - include arch/m68k/lib/Makefile_mm 10 + lib-y += string.o uaccess.o checksum_mm.o 3 11 else 4 - include arch/m68k/lib/Makefile_no 12 + lib-y += mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o delay.o checksum_no.o 5 13 endif 14 +
-6
arch/m68k/lib/Makefile_mm
··· 1 - # 2 - # Makefile for m68k-specific library files.. 3 - # 4 - 5 - lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ 6 - checksum.o string.o uaccess.o
-7
arch/m68k/lib/Makefile_no
··· 1 - # 2 - # Makefile for m68knommu specific library files.. 3 - # 4 - 5 - lib-y := ashldi3.o ashrdi3.o lshrdi3.o \ 6 - muldi3.o mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \ 7 - checksum.o memcpy.o memmove.o memset.o delay.o
-5
arch/m68k/lib/checksum.c
··· 1 - #ifdef CONFIG_MMU 2 - #include "checksum_mm.c" 3 - #else 4 - #include "checksum_no.c" 5 - #endif
+3
arch/m68k/lib/checksum_no.c
··· 101 101 { 102 102 return (__force __sum16)~do_csum(iph,ihl*4); 103 103 } 104 + EXPORT_SYMBOL(ip_fast_csum); 104 105 #endif 105 106 106 107 /* ··· 141 140 memcpy(dst, (__force const void *)src, len); 142 141 return csum_partial(dst, len, sum); 143 142 } 143 + EXPORT_SYMBOL(csum_partial_copy_from_user); 144 144 145 145 /* 146 146 * copy from ds while checksumming, otherwise like csum_partial ··· 153 151 memcpy(dst, src, len); 154 152 return csum_partial(dst, len, sum); 155 153 } 154 + EXPORT_SYMBOL(csum_partial_copy_nocheck);
+73 -55
arch/m68k/lib/memcpy.c
··· 1 + /* 2 + * This file is subject to the terms and conditions of the GNU General Public 3 + * License. See the file COPYING in the main directory of this archive 4 + * for more details. 5 + */ 1 6 2 - #include <linux/types.h> 7 + #include <linux/module.h> 8 + #include <linux/string.h> 3 9 4 - void * memcpy(void * to, const void * from, size_t n) 10 + void *memcpy(void *to, const void *from, size_t n) 5 11 { 6 - #ifdef CONFIG_COLDFIRE 7 - void *xto = to; 8 - size_t temp; 12 + void *xto = to; 13 + size_t temp, temp1; 9 14 10 - if (!n) 11 - return xto; 12 - if ((long) to & 1) 13 - { 14 - char *cto = to; 15 - const char *cfrom = from; 16 - *cto++ = *cfrom++; 17 - to = cto; 18 - from = cfrom; 19 - n--; 20 - } 21 - if (n > 2 && (long) to & 2) 22 - { 23 - short *sto = to; 24 - const short *sfrom = from; 25 - *sto++ = *sfrom++; 26 - to = sto; 27 - from = sfrom; 28 - n -= 2; 29 - } 30 - temp = n >> 2; 31 - if (temp) 32 - { 33 - long *lto = to; 34 - const long *lfrom = from; 35 - for (; temp; temp--) 36 - *lto++ = *lfrom++; 37 - to = lto; 38 - from = lfrom; 39 - } 40 - if (n & 2) 41 - { 42 - short *sto = to; 43 - const short *sfrom = from; 44 - *sto++ = *sfrom++; 45 - to = sto; 46 - from = sfrom; 47 - } 48 - if (n & 1) 49 - { 50 - char *cto = to; 51 - const char *cfrom = from; 52 - *cto = *cfrom; 53 - } 54 - return xto; 15 + if (!n) 16 + return xto; 17 + if ((long)to & 1) { 18 + char *cto = to; 19 + const char *cfrom = from; 20 + *cto++ = *cfrom++; 21 + to = cto; 22 + from = cfrom; 23 + n--; 24 + } 25 + if (n > 2 && (long)to & 2) { 26 + short *sto = to; 27 + const short *sfrom = from; 28 + *sto++ = *sfrom++; 29 + to = sto; 30 + from = sfrom; 31 + n -= 2; 32 + } 33 + temp = n >> 2; 34 + if (temp) { 35 + long *lto = to; 36 + const long *lfrom = from; 37 + #if defined(__mc68020__) || defined(__mc68030__) || \ 38 + defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__) 39 + asm volatile ( 40 + " movel %2,%3\n" 41 + " andw #7,%3\n" 42 + " lsrl #3,%2\n" 43 + " negw %3\n" 44 + " jmp %%pc@(1f,%3:w:2)\n" 45 + "4: movel %0@+,%1@+\n" 46 + " movel %0@+,%1@+\n" 47 + " movel %0@+,%1@+\n" 48 + " movel %0@+,%1@+\n" 49 + " movel %0@+,%1@+\n" 50 + " movel %0@+,%1@+\n" 51 + " movel %0@+,%1@+\n" 52 + " movel %0@+,%1@+\n" 53 + "1: dbra %2,4b\n" 54 + " clrw %2\n" 55 + " subql #1,%2\n" 56 + " jpl 4b" 57 + : "=a" (lfrom), "=a" (lto), "=d" (temp), "=&d" (temp1) 58 + : "0" (lfrom), "1" (lto), "2" (temp)); 55 59 #else 56 - const char *c_from = from; 57 - char *c_to = to; 58 - while (n-- > 0) 59 - *c_to++ = *c_from++; 60 - return((void *) to); 60 + for (; temp; temp--) 61 + *lto++ = *lfrom++; 61 62 #endif 63 + to = lto; 64 + from = lfrom; 65 + } 66 + if (n & 2) { 67 + short *sto = to; 68 + const short *sfrom = from; 69 + *sto++ = *sfrom++; 70 + to = sto; 71 + from = sfrom; 72 + } 73 + if (n & 1) { 74 + char *cto = to; 75 + const char *cfrom = from; 76 + *cto = *cfrom; 77 + } 78 + return xto; 62 79 } 80 + EXPORT_SYMBOL(memcpy);
-2
arch/m68k/lib/memmove.c
··· 4 4 * for more details. 5 5 */ 6 6 7 - #define __IN_STRING_C 8 - 9 7 #include <linux/module.h> 10 8 #include <linux/string.h> 11 9
+71 -43
arch/m68k/lib/memset.c
··· 1 - #include <linux/types.h> 1 + /* 2 + * This file is subject to the terms and conditions of the GNU General Public 3 + * License. See the file COPYING in the main directory of this archive 4 + * for more details. 5 + */ 2 6 3 - void * memset(void * s, int c, size_t count) 7 + #include <linux/module.h> 8 + #include <linux/string.h> 9 + 10 + void *memset(void *s, int c, size_t count) 4 11 { 5 - void *xs = s; 6 - size_t temp; 12 + void *xs = s; 13 + size_t temp; 7 14 8 - if (!count) 9 - return xs; 10 - c &= 0xff; 11 - c |= c << 8; 12 - c |= c << 16; 13 - if ((long) s & 1) 14 - { 15 - char *cs = s; 16 - *cs++ = c; 17 - s = cs; 18 - count--; 19 - } 20 - if (count > 2 && (long) s & 2) 21 - { 22 - short *ss = s; 23 - *ss++ = c; 24 - s = ss; 25 - count -= 2; 26 - } 27 - temp = count >> 2; 28 - if (temp) 29 - { 30 - long *ls = s; 31 - for (; temp; temp--) 32 - *ls++ = c; 33 - s = ls; 34 - } 35 - if (count & 2) 36 - { 37 - short *ss = s; 38 - *ss++ = c; 39 - s = ss; 40 - } 41 - if (count & 1) 42 - { 43 - char *cs = s; 44 - *cs = c; 45 - } 46 - return xs; 15 + if (!count) 16 + return xs; 17 + c &= 0xff; 18 + c |= c << 8; 19 + c |= c << 16; 20 + if ((long)s & 1) { 21 + char *cs = s; 22 + *cs++ = c; 23 + s = cs; 24 + count--; 25 + } 26 + if (count > 2 && (long)s & 2) { 27 + short *ss = s; 28 + *ss++ = c; 29 + s = ss; 30 + count -= 2; 31 + } 32 + temp = count >> 2; 33 + if (temp) { 34 + long *ls = s; 35 + #if defined(__mc68020__) || defined(__mc68030__) || \ 36 + defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__) 37 + size_t temp1; 38 + asm volatile ( 39 + " movel %1,%2\n" 40 + " andw #7,%2\n" 41 + " lsrl #3,%1\n" 42 + " negw %2\n" 43 + " jmp %%pc@(2f,%2:w:2)\n" 44 + "1: movel %3,%0@+\n" 45 + " movel %3,%0@+\n" 46 + " movel %3,%0@+\n" 47 + " movel %3,%0@+\n" 48 + " movel %3,%0@+\n" 49 + " movel %3,%0@+\n" 50 + " movel %3,%0@+\n" 51 + " movel %3,%0@+\n" 52 + "2: dbra %1,1b\n" 53 + " clrw %1\n" 54 + " subql #1,%1\n" 55 + " jpl 1b" 56 + : "=a" (ls), "=d" (temp), "=&d" (temp1) 57 + : "d" (c), "0" (ls), "1" (temp)); 58 + #else 59 + for (; temp; temp--) 60 + *ls++ = c; 61 + #endif 62 + s = ls; 63 + } 64 + if (count & 2) { 65 + short *ss = s; 66 + *ss++ = c; 67 + s = ss; 68 + } 69 + if (count & 1) { 70 + char *cs = s; 71 + *cs = c; 72 + } 73 + return xs; 47 74 } 75 + EXPORT_SYMBOL(memset);
+96 -3
arch/m68k/lib/muldi3.c
··· 1 - #ifdef CONFIG_MMU 2 - #include "muldi3_mm.c" 1 + /* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and 2 + gcc-2.7.2.3/longlong.h which is: */ 3 + /* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. 4 + 5 + This file is part of GNU CC. 6 + 7 + GNU CC is free software; you can redistribute it and/or modify 8 + it under the terms of the GNU General Public License as published by 9 + the Free Software Foundation; either version 2, or (at your option) 10 + any later version. 11 + 12 + GNU CC is distributed in the hope that it will be useful, 13 + but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + GNU General Public License for more details. 16 + 17 + You should have received a copy of the GNU General Public License 18 + along with GNU CC; see the file COPYING. If not, write to 19 + the Free Software Foundation, 59 Temple Place - Suite 330, 20 + Boston, MA 02111-1307, USA. */ 21 + 22 + #if defined(__mc68020__) || defined(__mc68030__) || \ 23 + defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__) 24 + 25 + #define umul_ppmm(w1, w0, u, v) \ 26 + __asm__ ("mulu%.l %3,%1:%0" \ 27 + : "=d" ((USItype)(w0)), \ 28 + "=d" ((USItype)(w1)) \ 29 + : "%0" ((USItype)(u)), \ 30 + "dmi" ((USItype)(v))) 31 + 3 32 #else 4 - #include "muldi3_no.c" 33 + 34 + #define SI_TYPE_SIZE 32 35 + #define __BITS4 (SI_TYPE_SIZE / 4) 36 + #define __ll_B (1L << (SI_TYPE_SIZE / 2)) 37 + #define __ll_lowpart(t) ((USItype) (t) % __ll_B) 38 + #define __ll_highpart(t) ((USItype) (t) / __ll_B) 39 + 40 + #define umul_ppmm(w1, w0, u, v) \ 41 + do { \ 42 + USItype __x0, __x1, __x2, __x3; \ 43 + USItype __ul, __vl, __uh, __vh; \ 44 + \ 45 + __ul = __ll_lowpart (u); \ 46 + __uh = __ll_highpart (u); \ 47 + __vl = __ll_lowpart (v); \ 48 + __vh = __ll_highpart (v); \ 49 + \ 50 + __x0 = (USItype) __ul * __vl; \ 51 + __x1 = (USItype) __ul * __vh; \ 52 + __x2 = (USItype) __uh * __vl; \ 53 + __x3 = (USItype) __uh * __vh; \ 54 + \ 55 + __x1 += __ll_highpart (__x0);/* this can't give carry */ \ 56 + __x1 += __x2; /* but this indeed can */ \ 57 + if (__x1 < __x2) /* did we get it? */ \ 58 + __x3 += __ll_B; /* yes, add it in the proper pos. */ \ 59 + \ 60 + (w1) = __x3 + __ll_highpart (__x1); \ 61 + (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \ 62 + } while (0) 63 + 5 64 #endif 65 + 66 + #define __umulsidi3(u, v) \ 67 + ({DIunion __w; \ 68 + umul_ppmm (__w.s.high, __w.s.low, u, v); \ 69 + __w.ll; }) 70 + 71 + typedef int SItype __attribute__ ((mode (SI))); 72 + typedef unsigned int USItype __attribute__ ((mode (SI))); 73 + typedef int DItype __attribute__ ((mode (DI))); 74 + typedef int word_type __attribute__ ((mode (__word__))); 75 + 76 + struct DIstruct {SItype high, low;}; 77 + 78 + typedef union 79 + { 80 + struct DIstruct s; 81 + DItype ll; 82 + } DIunion; 83 + 84 + DItype 85 + __muldi3 (DItype u, DItype v) 86 + { 87 + DIunion w; 88 + DIunion uu, vv; 89 + 90 + uu.ll = u, 91 + vv.ll = v; 92 + 93 + w.ll = __umulsidi3 (uu.s.low, vv.s.low); 94 + w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high 95 + + (USItype) uu.s.high * (USItype) vv.s.low); 96 + 97 + return w.ll; 98 + }
-63
arch/m68k/lib/muldi3_mm.c
··· 1 - /* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and 2 - gcc-2.7.2.3/longlong.h which is: */ 3 - /* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. 4 - 5 - This file is part of GNU CC. 6 - 7 - GNU CC is free software; you can redistribute it and/or modify 8 - it under the terms of the GNU General Public License as published by 9 - the Free Software Foundation; either version 2, or (at your option) 10 - any later version. 11 - 12 - GNU CC is distributed in the hope that it will be useful, 13 - but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - GNU General Public License for more details. 16 - 17 - You should have received a copy of the GNU General Public License 18 - along with GNU CC; see the file COPYING. If not, write to 19 - the Free Software Foundation, 59 Temple Place - Suite 330, 20 - Boston, MA 02111-1307, USA. */ 21 - 22 - #define BITS_PER_UNIT 8 23 - 24 - #define umul_ppmm(w1, w0, u, v) \ 25 - __asm__ ("mulu%.l %3,%1:%0" \ 26 - : "=d" ((USItype)(w0)), \ 27 - "=d" ((USItype)(w1)) \ 28 - : "%0" ((USItype)(u)), \ 29 - "dmi" ((USItype)(v))) 30 - 31 - #define __umulsidi3(u, v) \ 32 - ({DIunion __w; \ 33 - umul_ppmm (__w.s.high, __w.s.low, u, v); \ 34 - __w.ll; }) 35 - 36 - typedef int SItype __attribute__ ((mode (SI))); 37 - typedef unsigned int USItype __attribute__ ((mode (SI))); 38 - typedef int DItype __attribute__ ((mode (DI))); 39 - typedef int word_type __attribute__ ((mode (__word__))); 40 - 41 - struct DIstruct {SItype high, low;}; 42 - 43 - typedef union 44 - { 45 - struct DIstruct s; 46 - DItype ll; 47 - } DIunion; 48 - 49 - DItype 50 - __muldi3 (DItype u, DItype v) 51 - { 52 - DIunion w; 53 - DIunion uu, vv; 54 - 55 - uu.ll = u, 56 - vv.ll = v; 57 - 58 - w.ll = __umulsidi3 (uu.s.low, vv.s.low); 59 - w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high 60 - + (USItype) uu.s.high * (USItype) vv.s.low); 61 - 62 - return w.ll; 63 - }
-86
arch/m68k/lib/muldi3_no.c
··· 1 - /* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and 2 - gcc-2.7.2.3/longlong.h which is: */ 3 - /* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. 4 - 5 - This file is part of GNU CC. 6 - 7 - GNU CC is free software; you can redistribute it and/or modify 8 - it under the terms of the GNU General Public License as published by 9 - the Free Software Foundation; either version 2, or (at your option) 10 - any later version. 11 - 12 - GNU CC is distributed in the hope that it will be useful, 13 - but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - GNU General Public License for more details. 16 - 17 - You should have received a copy of the GNU General Public License 18 - along with GNU CC; see the file COPYING. If not, write to 19 - the Free Software Foundation, 59 Temple Place - Suite 330, 20 - Boston, MA 02111-1307, USA. */ 21 - 22 - #define BITS_PER_UNIT 8 23 - #define SI_TYPE_SIZE 32 24 - 25 - #define __BITS4 (SI_TYPE_SIZE / 4) 26 - #define __ll_B (1L << (SI_TYPE_SIZE / 2)) 27 - #define __ll_lowpart(t) ((USItype) (t) % __ll_B) 28 - #define __ll_highpart(t) ((USItype) (t) / __ll_B) 29 - 30 - #define umul_ppmm(w1, w0, u, v) \ 31 - do { \ 32 - USItype __x0, __x1, __x2, __x3; \ 33 - USItype __ul, __vl, __uh, __vh; \ 34 - \ 35 - __ul = __ll_lowpart (u); \ 36 - __uh = __ll_highpart (u); \ 37 - __vl = __ll_lowpart (v); \ 38 - __vh = __ll_highpart (v); \ 39 - \ 40 - __x0 = (USItype) __ul * __vl; \ 41 - __x1 = (USItype) __ul * __vh; \ 42 - __x2 = (USItype) __uh * __vl; \ 43 - __x3 = (USItype) __uh * __vh; \ 44 - \ 45 - __x1 += __ll_highpart (__x0);/* this can't give carry */ \ 46 - __x1 += __x2; /* but this indeed can */ \ 47 - if (__x1 < __x2) /* did we get it? */ \ 48 - __x3 += __ll_B; /* yes, add it in the proper pos. */ \ 49 - \ 50 - (w1) = __x3 + __ll_highpart (__x1); \ 51 - (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \ 52 - } while (0) 53 - 54 - #define __umulsidi3(u, v) \ 55 - ({DIunion __w; \ 56 - umul_ppmm (__w.s.high, __w.s.low, u, v); \ 57 - __w.ll; }) 58 - 59 - typedef int SItype __attribute__ ((mode (SI))); 60 - typedef unsigned int USItype __attribute__ ((mode (SI))); 61 - typedef int DItype __attribute__ ((mode (DI))); 62 - typedef int word_type __attribute__ ((mode (__word__))); 63 - 64 - struct DIstruct {SItype high, low;}; 65 - 66 - typedef union 67 - { 68 - struct DIstruct s; 69 - DItype ll; 70 - } DIunion; 71 - 72 - DItype 73 - __muldi3 (DItype u, DItype v) 74 - { 75 - DIunion w; 76 - DIunion uu, vv; 77 - 78 - uu.ll = u, 79 - vv.ll = v; 80 - 81 - w.ll = __umulsidi3 (uu.s.low, vv.s.low); 82 - w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high 83 - + (USItype) uu.s.high * (USItype) vv.s.low); 84 - 85 - return w.ll; 86 - }
-223
arch/m68k/lib/string.c
··· 20 20 return __kernel_strcpy(dest + __kernel_strlen(dest), src); 21 21 } 22 22 EXPORT_SYMBOL(strcat); 23 - 24 - void *memset(void *s, int c, size_t count) 25 - { 26 - void *xs = s; 27 - size_t temp, temp1; 28 - 29 - if (!count) 30 - return xs; 31 - c &= 0xff; 32 - c |= c << 8; 33 - c |= c << 16; 34 - if ((long)s & 1) { 35 - char *cs = s; 36 - *cs++ = c; 37 - s = cs; 38 - count--; 39 - } 40 - if (count > 2 && (long)s & 2) { 41 - short *ss = s; 42 - *ss++ = c; 43 - s = ss; 44 - count -= 2; 45 - } 46 - temp = count >> 2; 47 - if (temp) { 48 - long *ls = s; 49 - 50 - asm volatile ( 51 - " movel %1,%2\n" 52 - " andw #7,%2\n" 53 - " lsrl #3,%1\n" 54 - " negw %2\n" 55 - " jmp %%pc@(2f,%2:w:2)\n" 56 - "1: movel %3,%0@+\n" 57 - " movel %3,%0@+\n" 58 - " movel %3,%0@+\n" 59 - " movel %3,%0@+\n" 60 - " movel %3,%0@+\n" 61 - " movel %3,%0@+\n" 62 - " movel %3,%0@+\n" 63 - " movel %3,%0@+\n" 64 - "2: dbra %1,1b\n" 65 - " clrw %1\n" 66 - " subql #1,%1\n" 67 - " jpl 1b" 68 - : "=a" (ls), "=d" (temp), "=&d" (temp1) 69 - : "d" (c), "0" (ls), "1" (temp)); 70 - s = ls; 71 - } 72 - if (count & 2) { 73 - short *ss = s; 74 - *ss++ = c; 75 - s = ss; 76 - } 77 - if (count & 1) { 78 - char *cs = s; 79 - *cs = c; 80 - } 81 - return xs; 82 - } 83 - EXPORT_SYMBOL(memset); 84 - 85 - void *memcpy(void *to, const void *from, size_t n) 86 - { 87 - void *xto = to; 88 - size_t temp, temp1; 89 - 90 - if (!n) 91 - return xto; 92 - if ((long)to & 1) { 93 - char *cto = to; 94 - const char *cfrom = from; 95 - *cto++ = *cfrom++; 96 - to = cto; 97 - from = cfrom; 98 - n--; 99 - } 100 - if (n > 2 && (long)to & 2) { 101 - short *sto = to; 102 - const short *sfrom = from; 103 - *sto++ = *sfrom++; 104 - to = sto; 105 - from = sfrom; 106 - n -= 2; 107 - } 108 - temp = n >> 2; 109 - if (temp) { 110 - long *lto = to; 111 - const long *lfrom = from; 112 - 113 - asm volatile ( 114 - " movel %2,%3\n" 115 - " andw #7,%3\n" 116 - " lsrl #3,%2\n" 117 - " negw %3\n" 118 - " jmp %%pc@(1f,%3:w:2)\n" 119 - "4: movel %0@+,%1@+\n" 120 - " movel %0@+,%1@+\n" 121 - " movel %0@+,%1@+\n" 122 - " movel %0@+,%1@+\n" 123 - " movel %0@+,%1@+\n" 124 - " movel %0@+,%1@+\n" 125 - " movel %0@+,%1@+\n" 126 - " movel %0@+,%1@+\n" 127 - "1: dbra %2,4b\n" 128 - " clrw %2\n" 129 - " subql #1,%2\n" 130 - " jpl 4b" 131 - : "=a" (lfrom), "=a" (lto), "=d" (temp), "=&d" (temp1) 132 - : "0" (lfrom), "1" (lto), "2" (temp)); 133 - to = lto; 134 - from = lfrom; 135 - } 136 - if (n & 2) { 137 - short *sto = to; 138 - const short *sfrom = from; 139 - *sto++ = *sfrom++; 140 - to = sto; 141 - from = sfrom; 142 - } 143 - if (n & 1) { 144 - char *cto = to; 145 - const char *cfrom = from; 146 - *cto = *cfrom; 147 - } 148 - return xto; 149 - } 150 - EXPORT_SYMBOL(memcpy); 151 - 152 - void *memmove(void *dest, const void *src, size_t n) 153 - { 154 - void *xdest = dest; 155 - size_t temp; 156 - 157 - if (!n) 158 - return xdest; 159 - 160 - if (dest < src) { 161 - if ((long)dest & 1) { 162 - char *cdest = dest; 163 - const char *csrc = src; 164 - *cdest++ = *csrc++; 165 - dest = cdest; 166 - src = csrc; 167 - n--; 168 - } 169 - if (n > 2 && (long)dest & 2) { 170 - short *sdest = dest; 171 - const short *ssrc = src; 172 - *sdest++ = *ssrc++; 173 - dest = sdest; 174 - src = ssrc; 175 - n -= 2; 176 - } 177 - temp = n >> 2; 178 - if (temp) { 179 - long *ldest = dest; 180 - const long *lsrc = src; 181 - temp--; 182 - do 183 - *ldest++ = *lsrc++; 184 - while (temp--); 185 - dest = ldest; 186 - src = lsrc; 187 - } 188 - if (n & 2) { 189 - short *sdest = dest; 190 - const short *ssrc = src; 191 - *sdest++ = *ssrc++; 192 - dest = sdest; 193 - src = ssrc; 194 - } 195 - if (n & 1) { 196 - char *cdest = dest; 197 - const char *csrc = src; 198 - *cdest = *csrc; 199 - } 200 - } else { 201 - dest = (char *)dest + n; 202 - src = (const char *)src + n; 203 - if ((long)dest & 1) { 204 - char *cdest = dest; 205 - const char *csrc = src; 206 - *--cdest = *--csrc; 207 - dest = cdest; 208 - src = csrc; 209 - n--; 210 - } 211 - if (n > 2 && (long)dest & 2) { 212 - short *sdest = dest; 213 - const short *ssrc = src; 214 - *--sdest = *--ssrc; 215 - dest = sdest; 216 - src = ssrc; 217 - n -= 2; 218 - } 219 - temp = n >> 2; 220 - if (temp) { 221 - long *ldest = dest; 222 - const long *lsrc = src; 223 - temp--; 224 - do 225 - *--ldest = *--lsrc; 226 - while (temp--); 227 - dest = ldest; 228 - src = lsrc; 229 - } 230 - if (n & 2) { 231 - short *sdest = dest; 232 - const short *ssrc = src; 233 - *--sdest = *--ssrc; 234 - dest = sdest; 235 - src = ssrc; 236 - } 237 - if (n & 1) { 238 - char *cdest = dest; 239 - const char *csrc = src; 240 - *--cdest = *--csrc; 241 - } 242 - } 243 - return xdest; 244 - } 245 - EXPORT_SYMBOL(memmove);
+9 -5
arch/m68k/mm/Makefile
··· 1 - ifdef CONFIG_MMU 2 - include arch/m68k/mm/Makefile_mm 3 - else 4 - include arch/m68k/mm/Makefile_no 5 - endif 1 + # 2 + # Makefile for the linux m68k-specific parts of the memory manager. 3 + # 4 + 5 + obj-y := init.o 6 + 7 + obj-$(CONFIG_MMU) += cache.o fault.o hwtest.o 8 + obj-$(CONFIG_MMU_MOTOROLA) += kmap.o memory.o motorola.o 9 + obj-$(CONFIG_MMU_SUN3) += sun3kmap.o sun3mmu.o
-8
arch/m68k/mm/Makefile_mm
··· 1 - # 2 - # Makefile for the linux m68k-specific parts of the memory manager. 3 - # 4 - 5 - obj-y := cache.o init.o fault.o hwtest.o 6 - 7 - obj-$(CONFIG_MMU_MOTOROLA) += kmap.o memory.o motorola.o 8 - obj-$(CONFIG_MMU_SUN3) += sun3kmap.o sun3mmu.o
-5
arch/m68k/mm/Makefile_no
··· 1 - # 2 - # Makefile for the linux m68knommu specific parts of the memory manager. 3 - # 4 - 5 - obj-y += init.o kmap.o
+4 -47
arch/m68k/mm/init_no.c
··· 38 38 #include <asm/system.h> 39 39 #include <asm/machdep.h> 40 40 41 - #undef DEBUG 42 - 43 - extern void die_if_kernel(char *,struct pt_regs *,long); 44 - extern void free_initmem(void); 45 - 46 41 /* 47 - * BAD_PAGE is the page that is used for page faults when linux 48 - * is out-of-memory. Older versions of linux just did a 49 - * do_exit(), but using this instead means there is less risk 50 - * for a process dying in kernel mode, possibly leaving a inode 51 - * unused etc.. 52 - * 53 - * BAD_PAGETABLE is the accompanying page-table: it is initialized 54 - * to point to BAD_PAGE entries. 55 - * 56 42 * ZERO_PAGE is a special page that is used for zero-initialized 57 43 * data and COW. 58 44 */ 59 - static unsigned long empty_bad_page_table; 60 - 61 - static unsigned long empty_bad_page; 62 - 63 45 unsigned long empty_zero_page; 64 46 65 47 extern unsigned long memory_start; ··· 59 77 * Make sure start_mem is page aligned, otherwise bootmem and 60 78 * page_alloc get different views of the world. 61 79 */ 62 - #ifdef DEBUG 63 - unsigned long start_mem = PAGE_ALIGN(memory_start); 64 - #endif 65 80 unsigned long end_mem = memory_end & PAGE_MASK; 81 + unsigned long zones_size[MAX_NR_ZONES] = {0, }; 66 82 67 - #ifdef DEBUG 68 - printk (KERN_DEBUG "start_mem is %#lx\nvirtual_end is %#lx\n", 69 - start_mem, end_mem); 70 - #endif 71 - 72 - /* 73 - * Initialize the bad page table and bad page to point 74 - * to a couple of allocated pages. 75 - */ 76 - empty_bad_page_table = (unsigned long)alloc_bootmem_pages(PAGE_SIZE); 77 - empty_bad_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE); 78 83 empty_zero_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE); 79 84 memset((void *)empty_zero_page, 0, PAGE_SIZE); 80 85 ··· 70 101 */ 71 102 set_fs (USER_DS); 72 103 73 - #ifdef DEBUG 74 - printk (KERN_DEBUG "before free_area_init\n"); 75 - 76 - printk (KERN_DEBUG "free_area_init -> start_mem is %#lx\nvirtual_end is %#lx\n", 77 - start_mem, end_mem); 78 - #endif 79 - 80 - { 81 - unsigned long zones_size[MAX_NR_ZONES] = {0, }; 82 - 83 - zones_size[ZONE_DMA] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT; 84 - free_area_init(zones_size); 85 - } 104 + zones_size[ZONE_DMA] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT; 105 + free_area_init(zones_size); 86 106 } 87 107 88 108 void __init mem_init(void) ··· 124 166 } 125 167 #endif 126 168 127 - void 128 - free_initmem() 169 + void free_initmem(void) 129 170 { 130 171 #ifdef CONFIG_RAMKERNEL 131 172 unsigned long addr;
+365 -3
arch/m68k/mm/kmap.c
··· 1 - #ifdef CONFIG_MMU 2 - #include "kmap_mm.c" 1 + /* 2 + * linux/arch/m68k/mm/kmap.c 3 + * 4 + * Copyright (C) 1997 Roman Hodek 5 + * 6 + * 10/01/99 cleaned up the code and changing to the same interface 7 + * used by other architectures /Roman Zippel 8 + */ 9 + 10 + #include <linux/module.h> 11 + #include <linux/mm.h> 12 + #include <linux/kernel.h> 13 + #include <linux/string.h> 14 + #include <linux/types.h> 15 + #include <linux/slab.h> 16 + #include <linux/vmalloc.h> 17 + 18 + #include <asm/setup.h> 19 + #include <asm/segment.h> 20 + #include <asm/page.h> 21 + #include <asm/pgalloc.h> 22 + #include <asm/io.h> 23 + #include <asm/system.h> 24 + 25 + #undef DEBUG 26 + 27 + #define PTRTREESIZE (256*1024) 28 + 29 + /* 30 + * For 040/060 we can use the virtual memory area like other architectures, 31 + * but for 020/030 we want to use early termination page descriptor and we 32 + * can't mix this with normal page descriptors, so we have to copy that code 33 + * (mm/vmalloc.c) and return appriorate aligned addresses. 34 + */ 35 + 36 + #ifdef CPU_M68040_OR_M68060_ONLY 37 + 38 + #define IO_SIZE PAGE_SIZE 39 + 40 + static inline struct vm_struct *get_io_area(unsigned long size) 41 + { 42 + return get_vm_area(size, VM_IOREMAP); 43 + } 44 + 45 + 46 + static inline void free_io_area(void *addr) 47 + { 48 + vfree((void *)(PAGE_MASK & (unsigned long)addr)); 49 + } 50 + 3 51 #else 4 - #include "kmap_no.c" 52 + 53 + #define IO_SIZE (256*1024) 54 + 55 + static struct vm_struct *iolist; 56 + 57 + static struct vm_struct *get_io_area(unsigned long size) 58 + { 59 + unsigned long addr; 60 + struct vm_struct **p, *tmp, *area; 61 + 62 + area = kmalloc(sizeof(*area), GFP_KERNEL); 63 + if (!area) 64 + return NULL; 65 + addr = KMAP_START; 66 + for (p = &iolist; (tmp = *p) ; p = &tmp->next) { 67 + if (size + addr < (unsigned long)tmp->addr) 68 + break; 69 + if (addr > KMAP_END-size) { 70 + kfree(area); 71 + return NULL; 72 + } 73 + addr = tmp->size + (unsigned long)tmp->addr; 74 + } 75 + area->addr = (void *)addr; 76 + area->size = size + IO_SIZE; 77 + area->next = *p; 78 + *p = area; 79 + return area; 80 + } 81 + 82 + static inline void free_io_area(void *addr) 83 + { 84 + struct vm_struct **p, *tmp; 85 + 86 + if (!addr) 87 + return; 88 + addr = (void *)((unsigned long)addr & -IO_SIZE); 89 + for (p = &iolist ; (tmp = *p) ; p = &tmp->next) { 90 + if (tmp->addr == addr) { 91 + *p = tmp->next; 92 + __iounmap(tmp->addr, tmp->size); 93 + kfree(tmp); 94 + return; 95 + } 96 + } 97 + } 98 + 5 99 #endif 100 + 101 + /* 102 + * Map some physical address range into the kernel address space. 103 + */ 104 + /* Rewritten by Andreas Schwab to remove all races. */ 105 + 106 + void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) 107 + { 108 + struct vm_struct *area; 109 + unsigned long virtaddr, retaddr; 110 + long offset; 111 + pgd_t *pgd_dir; 112 + pmd_t *pmd_dir; 113 + pte_t *pte_dir; 114 + 115 + /* 116 + * Don't allow mappings that wrap.. 117 + */ 118 + if (!size || physaddr > (unsigned long)(-size)) 119 + return NULL; 120 + 121 + #ifdef CONFIG_AMIGA 122 + if (MACH_IS_AMIGA) { 123 + if ((physaddr >= 0x40000000) && (physaddr + size < 0x60000000) 124 + && (cacheflag == IOMAP_NOCACHE_SER)) 125 + return (void __iomem *)physaddr; 126 + } 127 + #endif 128 + 129 + #ifdef DEBUG 130 + printk("ioremap: 0x%lx,0x%lx(%d) - ", physaddr, size, cacheflag); 131 + #endif 132 + /* 133 + * Mappings have to be aligned 134 + */ 135 + offset = physaddr & (IO_SIZE - 1); 136 + physaddr &= -IO_SIZE; 137 + size = (size + offset + IO_SIZE - 1) & -IO_SIZE; 138 + 139 + /* 140 + * Ok, go for it.. 141 + */ 142 + area = get_io_area(size); 143 + if (!area) 144 + return NULL; 145 + 146 + virtaddr = (unsigned long)area->addr; 147 + retaddr = virtaddr + offset; 148 + #ifdef DEBUG 149 + printk("0x%lx,0x%lx,0x%lx", physaddr, virtaddr, retaddr); 150 + #endif 151 + 152 + /* 153 + * add cache and table flags to physical address 154 + */ 155 + if (CPU_IS_040_OR_060) { 156 + physaddr |= (_PAGE_PRESENT | _PAGE_GLOBAL040 | 157 + _PAGE_ACCESSED | _PAGE_DIRTY); 158 + switch (cacheflag) { 159 + case IOMAP_FULL_CACHING: 160 + physaddr |= _PAGE_CACHE040; 161 + break; 162 + case IOMAP_NOCACHE_SER: 163 + default: 164 + physaddr |= _PAGE_NOCACHE_S; 165 + break; 166 + case IOMAP_NOCACHE_NONSER: 167 + physaddr |= _PAGE_NOCACHE; 168 + break; 169 + case IOMAP_WRITETHROUGH: 170 + physaddr |= _PAGE_CACHE040W; 171 + break; 172 + } 173 + } else { 174 + physaddr |= (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY); 175 + switch (cacheflag) { 176 + case IOMAP_NOCACHE_SER: 177 + case IOMAP_NOCACHE_NONSER: 178 + default: 179 + physaddr |= _PAGE_NOCACHE030; 180 + break; 181 + case IOMAP_FULL_CACHING: 182 + case IOMAP_WRITETHROUGH: 183 + break; 184 + } 185 + } 186 + 187 + while ((long)size > 0) { 188 + #ifdef DEBUG 189 + if (!(virtaddr & (PTRTREESIZE-1))) 190 + printk ("\npa=%#lx va=%#lx ", physaddr, virtaddr); 191 + #endif 192 + pgd_dir = pgd_offset_k(virtaddr); 193 + pmd_dir = pmd_alloc(&init_mm, pgd_dir, virtaddr); 194 + if (!pmd_dir) { 195 + printk("ioremap: no mem for pmd_dir\n"); 196 + return NULL; 197 + } 198 + 199 + if (CPU_IS_020_OR_030) { 200 + pmd_dir->pmd[(virtaddr/PTRTREESIZE) & 15] = physaddr; 201 + physaddr += PTRTREESIZE; 202 + virtaddr += PTRTREESIZE; 203 + size -= PTRTREESIZE; 204 + } else { 205 + pte_dir = pte_alloc_kernel(pmd_dir, virtaddr); 206 + if (!pte_dir) { 207 + printk("ioremap: no mem for pte_dir\n"); 208 + return NULL; 209 + } 210 + 211 + pte_val(*pte_dir) = physaddr; 212 + virtaddr += PAGE_SIZE; 213 + physaddr += PAGE_SIZE; 214 + size -= PAGE_SIZE; 215 + } 216 + } 217 + #ifdef DEBUG 218 + printk("\n"); 219 + #endif 220 + flush_tlb_all(); 221 + 222 + return (void __iomem *)retaddr; 223 + } 224 + EXPORT_SYMBOL(__ioremap); 225 + 226 + /* 227 + * Unmap a ioremap()ed region again 228 + */ 229 + void iounmap(void __iomem *addr) 230 + { 231 + #ifdef CONFIG_AMIGA 232 + if ((!MACH_IS_AMIGA) || 233 + (((unsigned long)addr < 0x40000000) || 234 + ((unsigned long)addr > 0x60000000))) 235 + free_io_area((__force void *)addr); 236 + #else 237 + free_io_area((__force void *)addr); 238 + #endif 239 + } 240 + EXPORT_SYMBOL(iounmap); 241 + 242 + /* 243 + * __iounmap unmaps nearly everything, so be careful 244 + * it doesn't free currently pointer/page tables anymore but it 245 + * wans't used anyway and might be added later. 246 + */ 247 + void __iounmap(void *addr, unsigned long size) 248 + { 249 + unsigned long virtaddr = (unsigned long)addr; 250 + pgd_t *pgd_dir; 251 + pmd_t *pmd_dir; 252 + pte_t *pte_dir; 253 + 254 + while ((long)size > 0) { 255 + pgd_dir = pgd_offset_k(virtaddr); 256 + if (pgd_bad(*pgd_dir)) { 257 + printk("iounmap: bad pgd(%08lx)\n", pgd_val(*pgd_dir)); 258 + pgd_clear(pgd_dir); 259 + return; 260 + } 261 + pmd_dir = pmd_offset(pgd_dir, virtaddr); 262 + 263 + if (CPU_IS_020_OR_030) { 264 + int pmd_off = (virtaddr/PTRTREESIZE) & 15; 265 + int pmd_type = pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK; 266 + 267 + if (pmd_type == _PAGE_PRESENT) { 268 + pmd_dir->pmd[pmd_off] = 0; 269 + virtaddr += PTRTREESIZE; 270 + size -= PTRTREESIZE; 271 + continue; 272 + } else if (pmd_type == 0) 273 + continue; 274 + } 275 + 276 + if (pmd_bad(*pmd_dir)) { 277 + printk("iounmap: bad pmd (%08lx)\n", pmd_val(*pmd_dir)); 278 + pmd_clear(pmd_dir); 279 + return; 280 + } 281 + pte_dir = pte_offset_kernel(pmd_dir, virtaddr); 282 + 283 + pte_val(*pte_dir) = 0; 284 + virtaddr += PAGE_SIZE; 285 + size -= PAGE_SIZE; 286 + } 287 + 288 + flush_tlb_all(); 289 + } 290 + 291 + /* 292 + * Set new cache mode for some kernel address space. 293 + * The caller must push data for that range itself, if such data may already 294 + * be in the cache. 295 + */ 296 + void kernel_set_cachemode(void *addr, unsigned long size, int cmode) 297 + { 298 + unsigned long virtaddr = (unsigned long)addr; 299 + pgd_t *pgd_dir; 300 + pmd_t *pmd_dir; 301 + pte_t *pte_dir; 302 + 303 + if (CPU_IS_040_OR_060) { 304 + switch (cmode) { 305 + case IOMAP_FULL_CACHING: 306 + cmode = _PAGE_CACHE040; 307 + break; 308 + case IOMAP_NOCACHE_SER: 309 + default: 310 + cmode = _PAGE_NOCACHE_S; 311 + break; 312 + case IOMAP_NOCACHE_NONSER: 313 + cmode = _PAGE_NOCACHE; 314 + break; 315 + case IOMAP_WRITETHROUGH: 316 + cmode = _PAGE_CACHE040W; 317 + break; 318 + } 319 + } else { 320 + switch (cmode) { 321 + case IOMAP_NOCACHE_SER: 322 + case IOMAP_NOCACHE_NONSER: 323 + default: 324 + cmode = _PAGE_NOCACHE030; 325 + break; 326 + case IOMAP_FULL_CACHING: 327 + case IOMAP_WRITETHROUGH: 328 + cmode = 0; 329 + } 330 + } 331 + 332 + while ((long)size > 0) { 333 + pgd_dir = pgd_offset_k(virtaddr); 334 + if (pgd_bad(*pgd_dir)) { 335 + printk("iocachemode: bad pgd(%08lx)\n", pgd_val(*pgd_dir)); 336 + pgd_clear(pgd_dir); 337 + return; 338 + } 339 + pmd_dir = pmd_offset(pgd_dir, virtaddr); 340 + 341 + if (CPU_IS_020_OR_030) { 342 + int pmd_off = (virtaddr/PTRTREESIZE) & 15; 343 + 344 + if ((pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK) == _PAGE_PRESENT) { 345 + pmd_dir->pmd[pmd_off] = (pmd_dir->pmd[pmd_off] & 346 + _CACHEMASK040) | cmode; 347 + virtaddr += PTRTREESIZE; 348 + size -= PTRTREESIZE; 349 + continue; 350 + } 351 + } 352 + 353 + if (pmd_bad(*pmd_dir)) { 354 + printk("iocachemode: bad pmd (%08lx)\n", pmd_val(*pmd_dir)); 355 + pmd_clear(pmd_dir); 356 + return; 357 + } 358 + pte_dir = pte_offset_kernel(pmd_dir, virtaddr); 359 + 360 + pte_val(*pte_dir) = (pte_val(*pte_dir) & _CACHEMASK040) | cmode; 361 + virtaddr += PAGE_SIZE; 362 + size -= PAGE_SIZE; 363 + } 364 + 365 + flush_tlb_all(); 366 + } 367 + EXPORT_SYMBOL(kernel_set_cachemode);
-367
arch/m68k/mm/kmap_mm.c
··· 1 - /* 2 - * linux/arch/m68k/mm/kmap.c 3 - * 4 - * Copyright (C) 1997 Roman Hodek 5 - * 6 - * 10/01/99 cleaned up the code and changing to the same interface 7 - * used by other architectures /Roman Zippel 8 - */ 9 - 10 - #include <linux/module.h> 11 - #include <linux/mm.h> 12 - #include <linux/kernel.h> 13 - #include <linux/string.h> 14 - #include <linux/types.h> 15 - #include <linux/slab.h> 16 - #include <linux/vmalloc.h> 17 - 18 - #include <asm/setup.h> 19 - #include <asm/segment.h> 20 - #include <asm/page.h> 21 - #include <asm/pgalloc.h> 22 - #include <asm/io.h> 23 - #include <asm/system.h> 24 - 25 - #undef DEBUG 26 - 27 - #define PTRTREESIZE (256*1024) 28 - 29 - /* 30 - * For 040/060 we can use the virtual memory area like other architectures, 31 - * but for 020/030 we want to use early termination page descriptor and we 32 - * can't mix this with normal page descriptors, so we have to copy that code 33 - * (mm/vmalloc.c) and return appriorate aligned addresses. 34 - */ 35 - 36 - #ifdef CPU_M68040_OR_M68060_ONLY 37 - 38 - #define IO_SIZE PAGE_SIZE 39 - 40 - static inline struct vm_struct *get_io_area(unsigned long size) 41 - { 42 - return get_vm_area(size, VM_IOREMAP); 43 - } 44 - 45 - 46 - static inline void free_io_area(void *addr) 47 - { 48 - vfree((void *)(PAGE_MASK & (unsigned long)addr)); 49 - } 50 - 51 - #else 52 - 53 - #define IO_SIZE (256*1024) 54 - 55 - static struct vm_struct *iolist; 56 - 57 - static struct vm_struct *get_io_area(unsigned long size) 58 - { 59 - unsigned long addr; 60 - struct vm_struct **p, *tmp, *area; 61 - 62 - area = kmalloc(sizeof(*area), GFP_KERNEL); 63 - if (!area) 64 - return NULL; 65 - addr = KMAP_START; 66 - for (p = &iolist; (tmp = *p) ; p = &tmp->next) { 67 - if (size + addr < (unsigned long)tmp->addr) 68 - break; 69 - if (addr > KMAP_END-size) { 70 - kfree(area); 71 - return NULL; 72 - } 73 - addr = tmp->size + (unsigned long)tmp->addr; 74 - } 75 - area->addr = (void *)addr; 76 - area->size = size + IO_SIZE; 77 - area->next = *p; 78 - *p = area; 79 - return area; 80 - } 81 - 82 - static inline void free_io_area(void *addr) 83 - { 84 - struct vm_struct **p, *tmp; 85 - 86 - if (!addr) 87 - return; 88 - addr = (void *)((unsigned long)addr & -IO_SIZE); 89 - for (p = &iolist ; (tmp = *p) ; p = &tmp->next) { 90 - if (tmp->addr == addr) { 91 - *p = tmp->next; 92 - __iounmap(tmp->addr, tmp->size); 93 - kfree(tmp); 94 - return; 95 - } 96 - } 97 - } 98 - 99 - #endif 100 - 101 - /* 102 - * Map some physical address range into the kernel address space. 103 - */ 104 - /* Rewritten by Andreas Schwab to remove all races. */ 105 - 106 - void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) 107 - { 108 - struct vm_struct *area; 109 - unsigned long virtaddr, retaddr; 110 - long offset; 111 - pgd_t *pgd_dir; 112 - pmd_t *pmd_dir; 113 - pte_t *pte_dir; 114 - 115 - /* 116 - * Don't allow mappings that wrap.. 117 - */ 118 - if (!size || physaddr > (unsigned long)(-size)) 119 - return NULL; 120 - 121 - #ifdef CONFIG_AMIGA 122 - if (MACH_IS_AMIGA) { 123 - if ((physaddr >= 0x40000000) && (physaddr + size < 0x60000000) 124 - && (cacheflag == IOMAP_NOCACHE_SER)) 125 - return (void __iomem *)physaddr; 126 - } 127 - #endif 128 - 129 - #ifdef DEBUG 130 - printk("ioremap: 0x%lx,0x%lx(%d) - ", physaddr, size, cacheflag); 131 - #endif 132 - /* 133 - * Mappings have to be aligned 134 - */ 135 - offset = physaddr & (IO_SIZE - 1); 136 - physaddr &= -IO_SIZE; 137 - size = (size + offset + IO_SIZE - 1) & -IO_SIZE; 138 - 139 - /* 140 - * Ok, go for it.. 141 - */ 142 - area = get_io_area(size); 143 - if (!area) 144 - return NULL; 145 - 146 - virtaddr = (unsigned long)area->addr; 147 - retaddr = virtaddr + offset; 148 - #ifdef DEBUG 149 - printk("0x%lx,0x%lx,0x%lx", physaddr, virtaddr, retaddr); 150 - #endif 151 - 152 - /* 153 - * add cache and table flags to physical address 154 - */ 155 - if (CPU_IS_040_OR_060) { 156 - physaddr |= (_PAGE_PRESENT | _PAGE_GLOBAL040 | 157 - _PAGE_ACCESSED | _PAGE_DIRTY); 158 - switch (cacheflag) { 159 - case IOMAP_FULL_CACHING: 160 - physaddr |= _PAGE_CACHE040; 161 - break; 162 - case IOMAP_NOCACHE_SER: 163 - default: 164 - physaddr |= _PAGE_NOCACHE_S; 165 - break; 166 - case IOMAP_NOCACHE_NONSER: 167 - physaddr |= _PAGE_NOCACHE; 168 - break; 169 - case IOMAP_WRITETHROUGH: 170 - physaddr |= _PAGE_CACHE040W; 171 - break; 172 - } 173 - } else { 174 - physaddr |= (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY); 175 - switch (cacheflag) { 176 - case IOMAP_NOCACHE_SER: 177 - case IOMAP_NOCACHE_NONSER: 178 - default: 179 - physaddr |= _PAGE_NOCACHE030; 180 - break; 181 - case IOMAP_FULL_CACHING: 182 - case IOMAP_WRITETHROUGH: 183 - break; 184 - } 185 - } 186 - 187 - while ((long)size > 0) { 188 - #ifdef DEBUG 189 - if (!(virtaddr & (PTRTREESIZE-1))) 190 - printk ("\npa=%#lx va=%#lx ", physaddr, virtaddr); 191 - #endif 192 - pgd_dir = pgd_offset_k(virtaddr); 193 - pmd_dir = pmd_alloc(&init_mm, pgd_dir, virtaddr); 194 - if (!pmd_dir) { 195 - printk("ioremap: no mem for pmd_dir\n"); 196 - return NULL; 197 - } 198 - 199 - if (CPU_IS_020_OR_030) { 200 - pmd_dir->pmd[(virtaddr/PTRTREESIZE) & 15] = physaddr; 201 - physaddr += PTRTREESIZE; 202 - virtaddr += PTRTREESIZE; 203 - size -= PTRTREESIZE; 204 - } else { 205 - pte_dir = pte_alloc_kernel(pmd_dir, virtaddr); 206 - if (!pte_dir) { 207 - printk("ioremap: no mem for pte_dir\n"); 208 - return NULL; 209 - } 210 - 211 - pte_val(*pte_dir) = physaddr; 212 - virtaddr += PAGE_SIZE; 213 - physaddr += PAGE_SIZE; 214 - size -= PAGE_SIZE; 215 - } 216 - } 217 - #ifdef DEBUG 218 - printk("\n"); 219 - #endif 220 - flush_tlb_all(); 221 - 222 - return (void __iomem *)retaddr; 223 - } 224 - EXPORT_SYMBOL(__ioremap); 225 - 226 - /* 227 - * Unmap a ioremap()ed region again 228 - */ 229 - void iounmap(void __iomem *addr) 230 - { 231 - #ifdef CONFIG_AMIGA 232 - if ((!MACH_IS_AMIGA) || 233 - (((unsigned long)addr < 0x40000000) || 234 - ((unsigned long)addr > 0x60000000))) 235 - free_io_area((__force void *)addr); 236 - #else 237 - free_io_area((__force void *)addr); 238 - #endif 239 - } 240 - EXPORT_SYMBOL(iounmap); 241 - 242 - /* 243 - * __iounmap unmaps nearly everything, so be careful 244 - * it doesn't free currently pointer/page tables anymore but it 245 - * wans't used anyway and might be added later. 246 - */ 247 - void __iounmap(void *addr, unsigned long size) 248 - { 249 - unsigned long virtaddr = (unsigned long)addr; 250 - pgd_t *pgd_dir; 251 - pmd_t *pmd_dir; 252 - pte_t *pte_dir; 253 - 254 - while ((long)size > 0) { 255 - pgd_dir = pgd_offset_k(virtaddr); 256 - if (pgd_bad(*pgd_dir)) { 257 - printk("iounmap: bad pgd(%08lx)\n", pgd_val(*pgd_dir)); 258 - pgd_clear(pgd_dir); 259 - return; 260 - } 261 - pmd_dir = pmd_offset(pgd_dir, virtaddr); 262 - 263 - if (CPU_IS_020_OR_030) { 264 - int pmd_off = (virtaddr/PTRTREESIZE) & 15; 265 - int pmd_type = pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK; 266 - 267 - if (pmd_type == _PAGE_PRESENT) { 268 - pmd_dir->pmd[pmd_off] = 0; 269 - virtaddr += PTRTREESIZE; 270 - size -= PTRTREESIZE; 271 - continue; 272 - } else if (pmd_type == 0) 273 - continue; 274 - } 275 - 276 - if (pmd_bad(*pmd_dir)) { 277 - printk("iounmap: bad pmd (%08lx)\n", pmd_val(*pmd_dir)); 278 - pmd_clear(pmd_dir); 279 - return; 280 - } 281 - pte_dir = pte_offset_kernel(pmd_dir, virtaddr); 282 - 283 - pte_val(*pte_dir) = 0; 284 - virtaddr += PAGE_SIZE; 285 - size -= PAGE_SIZE; 286 - } 287 - 288 - flush_tlb_all(); 289 - } 290 - 291 - /* 292 - * Set new cache mode for some kernel address space. 293 - * The caller must push data for that range itself, if such data may already 294 - * be in the cache. 295 - */ 296 - void kernel_set_cachemode(void *addr, unsigned long size, int cmode) 297 - { 298 - unsigned long virtaddr = (unsigned long)addr; 299 - pgd_t *pgd_dir; 300 - pmd_t *pmd_dir; 301 - pte_t *pte_dir; 302 - 303 - if (CPU_IS_040_OR_060) { 304 - switch (cmode) { 305 - case IOMAP_FULL_CACHING: 306 - cmode = _PAGE_CACHE040; 307 - break; 308 - case IOMAP_NOCACHE_SER: 309 - default: 310 - cmode = _PAGE_NOCACHE_S; 311 - break; 312 - case IOMAP_NOCACHE_NONSER: 313 - cmode = _PAGE_NOCACHE; 314 - break; 315 - case IOMAP_WRITETHROUGH: 316 - cmode = _PAGE_CACHE040W; 317 - break; 318 - } 319 - } else { 320 - switch (cmode) { 321 - case IOMAP_NOCACHE_SER: 322 - case IOMAP_NOCACHE_NONSER: 323 - default: 324 - cmode = _PAGE_NOCACHE030; 325 - break; 326 - case IOMAP_FULL_CACHING: 327 - case IOMAP_WRITETHROUGH: 328 - cmode = 0; 329 - } 330 - } 331 - 332 - while ((long)size > 0) { 333 - pgd_dir = pgd_offset_k(virtaddr); 334 - if (pgd_bad(*pgd_dir)) { 335 - printk("iocachemode: bad pgd(%08lx)\n", pgd_val(*pgd_dir)); 336 - pgd_clear(pgd_dir); 337 - return; 338 - } 339 - pmd_dir = pmd_offset(pgd_dir, virtaddr); 340 - 341 - if (CPU_IS_020_OR_030) { 342 - int pmd_off = (virtaddr/PTRTREESIZE) & 15; 343 - 344 - if ((pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK) == _PAGE_PRESENT) { 345 - pmd_dir->pmd[pmd_off] = (pmd_dir->pmd[pmd_off] & 346 - _CACHEMASK040) | cmode; 347 - virtaddr += PTRTREESIZE; 348 - size -= PTRTREESIZE; 349 - continue; 350 - } 351 - } 352 - 353 - if (pmd_bad(*pmd_dir)) { 354 - printk("iocachemode: bad pmd (%08lx)\n", pmd_val(*pmd_dir)); 355 - pmd_clear(pmd_dir); 356 - return; 357 - } 358 - pte_dir = pte_offset_kernel(pmd_dir, virtaddr); 359 - 360 - pte_val(*pte_dir) = (pte_val(*pte_dir) & _CACHEMASK040) | cmode; 361 - virtaddr += PAGE_SIZE; 362 - size -= PAGE_SIZE; 363 - } 364 - 365 - flush_tlb_all(); 366 - } 367 - EXPORT_SYMBOL(kernel_set_cachemode);
-45
arch/m68k/mm/kmap_no.c
··· 1 - /* 2 - * linux/arch/m68knommu/mm/kmap.c 3 - * 4 - * Copyright (C) 2000 Lineo, <davidm@snapgear.com> 5 - * Copyright (C) 2000-2002 David McCullough <davidm@snapgear.com> 6 - */ 7 - 8 - #include <linux/mm.h> 9 - #include <linux/kernel.h> 10 - #include <linux/string.h> 11 - #include <linux/types.h> 12 - #include <linux/vmalloc.h> 13 - 14 - #include <asm/setup.h> 15 - #include <asm/segment.h> 16 - #include <asm/page.h> 17 - #include <asm/pgalloc.h> 18 - #include <asm/io.h> 19 - #include <asm/system.h> 20 - 21 - #undef DEBUG 22 - 23 - /* 24 - * Map some physical address range into the kernel address space. 25 - */ 26 - void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) 27 - { 28 - return (void *)physaddr; 29 - } 30 - 31 - /* 32 - * Unmap a ioremap()ed region again. 33 - */ 34 - void iounmap(void *addr) 35 - { 36 - } 37 - 38 - /* 39 - * Set new cache mode for some kernel address space. 40 - * The caller must push data for that range itself, if such data may already 41 - * be in the cache. 42 - */ 43 - void kernel_set_cachemode(void *addr, unsigned long size, int cmode) 44 - { 45 - }
+3 -4
arch/m68k/platform/68328/entry.S
··· 10 10 * Linux/m68k support by Hamish Macdonald 11 11 */ 12 12 13 - #include <linux/sys.h> 14 13 #include <linux/linkage.h> 15 14 #include <asm/thread_info.h> 16 15 #include <asm/unistd.h> ··· 79 80 movel %sp,%d1 /* get thread_info pointer */ 80 81 andl #-THREAD_SIZE,%d1 81 82 movel %d1,%a2 82 - btst #(TIF_SYSCALL_TRACE%8),%a2@(TI_FLAGS+(31-TIF_SYSCALL_TRACE)/8) 83 + btst #(TIF_SYSCALL_TRACE%8),%a2@(TINFO_FLAGS+(31-TIF_SYSCALL_TRACE)/8) 83 84 jne do_trace 84 85 cmpl #NR_syscalls,%d0 85 86 jcc badsys ··· 106 107 andl #-THREAD_SIZE,%d1 107 108 movel %d1,%a2 108 109 1: 109 - move %a2@(TI_FLAGS),%d1 /* thread_info->flags */ 110 + move %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */ 110 111 jne Lwork_to_do 111 112 RESTORE_ALL 112 113 113 114 Lwork_to_do: 114 - movel %a2@(TI_FLAGS),%d1 /* thread_info->flags */ 115 + movel %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */ 115 116 btst #TIF_NEED_RESCHED,%d1 116 117 jne reschedule 117 118
+3 -4
arch/m68k/platform/68360/entry.S
··· 12 12 * M68360 Port by SED Systems, and Lineo. 13 13 */ 14 14 15 - #include <linux/sys.h> 16 15 #include <linux/linkage.h> 17 16 #include <asm/thread_info.h> 18 17 #include <asm/unistd.h> ··· 75 76 movel %sp,%d1 /* get thread_info pointer */ 76 77 andl #-THREAD_SIZE,%d1 77 78 movel %d1,%a2 78 - btst #(TIF_SYSCALL_TRACE%8),%a2@(TI_FLAGS+(31-TIF_SYSCALL_TRACE)/8) 79 + btst #(TIF_SYSCALL_TRACE%8),%a2@(TINFO_FLAGS+(31-TIF_SYSCALL_TRACE)/8) 79 80 jne do_trace 80 81 cmpl #NR_syscalls,%d0 81 82 jcc badsys ··· 102 103 andl #-THREAD_SIZE,%d1 103 104 movel %d1,%a2 104 105 1: 105 - move %a2@(TI_FLAGS),%d1 /* thread_info->flags */ 106 + move %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */ 106 107 jne Lwork_to_do 107 108 RESTORE_ALL 108 109 109 110 Lwork_to_do: 110 - movel %a2@(TI_FLAGS),%d1 /* thread_info->flags */ 111 + movel %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */ 111 112 btst #TIF_NEED_RESCHED,%d1 112 113 jne reschedule 113 114
+3
arch/m68k/platform/coldfire/dma.c
··· 9 9 /***************************************************************************/ 10 10 11 11 #include <linux/kernel.h> 12 + #include <linux/module.h> 12 13 #include <asm/dma.h> 13 14 #include <asm/coldfire.h> 14 15 #include <asm/mcfsim.h> ··· 34 33 MCFDMA_BASE3, 35 34 #endif 36 35 }; 36 + EXPORT_SYMBOL(dma_base_addr); 37 37 38 38 unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; 39 + EXPORT_SYMBOL(dma_device_address); 39 40 40 41 /***************************************************************************/
+5 -6
arch/m68k/platform/coldfire/entry.S
··· 26 26 * Bug, speed and maintainability fixes by Philippe De Muyter <phdm@macqel.be> 27 27 */ 28 28 29 - #include <linux/sys.h> 30 29 #include <linux/linkage.h> 31 30 #include <asm/unistd.h> 32 31 #include <asm/thread_info.h> ··· 77 78 movel %d2,%a0 78 79 movel %a0@,%a1 /* save top of frame */ 79 80 movel %sp,%a1@(TASK_THREAD+THREAD_ESP0) 80 - btst #(TIF_SYSCALL_TRACE%8),%a0@(TI_FLAGS+(31-TIF_SYSCALL_TRACE)/8) 81 + btst #(TIF_SYSCALL_TRACE%8),%a0@(TINFO_FLAGS+(31-TIF_SYSCALL_TRACE)/8) 81 82 bnes 1f 82 83 83 84 movel %d3,%a0 ··· 112 113 movel %sp,%d1 /* get thread_info pointer */ 113 114 andl #-THREAD_SIZE,%d1 /* at base of kernel stack */ 114 115 movel %d1,%a0 115 - movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ 116 + movel %a0@(TINFO_FLAGS),%d1 /* get thread_info->flags */ 116 117 andl #(1<<TIF_NEED_RESCHED),%d1 117 118 jeq Lkernel_return 118 119 119 - movel %a0@(TI_PREEMPTCOUNT),%d1 120 + movel %a0@(TINFO_PREEMPT),%d1 120 121 cmpl #0,%d1 121 122 jne Lkernel_return 122 123 ··· 136 137 movel %sp,%d1 /* get thread_info pointer */ 137 138 andl #-THREAD_SIZE,%d1 /* at base of kernel stack */ 138 139 movel %d1,%a0 139 - movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ 140 + movel %a0@(TINFO_FLAGS),%d1 /* get thread_info->flags */ 140 141 jne Lwork_to_do /* still work to do */ 141 142 142 143 Lreturn: 143 144 RESTORE_USER 144 145 145 146 Lwork_to_do: 146 - movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ 147 + movel %a0@(TINFO_FLAGS),%d1 /* get thread_info->flags */ 147 148 move #0x2000,%sr /* enable intrs again */ 148 149 btst #TIF_NEED_RESCHED,%d1 149 150 jne reschedule
-1
arch/m68k/platform/coldfire/head.S
··· 8 8 9 9 /*****************************************************************************/ 10 10 11 - #include <linux/sys.h> 12 11 #include <linux/linkage.h> 13 12 #include <linux/init.h> 14 13 #include <asm/asm-offsets.h>
+1
drivers/spi/coldfire_qspi.c
··· 33 33 #include <linux/spi/spi.h> 34 34 35 35 #include <asm/coldfire.h> 36 + #include <asm/mcfsim.h> 36 37 #include <asm/mcfqspi.h> 37 38 38 39 #define DRIVER_NAME "mcfqspi"