--- arch/m68k/Makefile | 17 ++- arch/m68k/amiga/config.c | 2 arch/m68k/kernel/entry.S | 22 +++ arch/m68k/kernel/setup.c | 33 +++++ arch/m68k/kernel/signal.c | 2 arch/m68k/mm/Makefile | 4 arch/m68k/mm/fault-nommu.c | 57 ++++++++++ arch/m68k/mm/init.c | 10 + arch/m68k/mm/kmap.c | 15 ++ arch/m68k/mm/memory.c | 4 arch/m68k/mm/nommu.c | 226 +++++++++++++++++++++++++++++++++++++++++ include/asm-m68k/amigahw.h | 5 include/asm-m68k/mmu.h | 26 ++++ include/asm-m68k/mmu_context.h | 26 ++++ include/asm-m68k/pgalloc.h | 2 include/asm-m68k/pgtable.h | 45 ++++++++ include/asm-m68k/segment.h | 8 + include/asm-m68k/setup.h | 23 ++++ include/asm-m68k/uaccess.h | 40 +++++++ include/linux/kbd_kern.h | 3 include/linux/mmzone.h | 5 21 files changed, 561 insertions(+), 14 deletions(-) --- linux-m68k-2.6.8.1+uc0/arch/m68k/Makefile 2004-07-12 09:47:52.000000000 +0200 +++ uClinux-amiga-2.6.8.1/arch/m68k/Makefile 2004-10-08 21:16:56.000000000 +0200 @@ -17,11 +17,13 @@ COMPILE_ARCH = $(shell uname -m) # override top level makefile -AS += -m68020 +ifdef CONFIG_NOMMU +CFLAGS += -DUTS_SYSNAME=\"uClinux\" +endif LDFLAGS := -m m68kelf ifneq ($(COMPILE_ARCH),$(ARCH)) # prefix for cross-compiling binaries - CROSS_COMPILE = m68k-linux- + CROSS_COMPILE = /usr/bin/m68k-linux- endif ifdef CONFIG_SUN3 @@ -33,6 +37,15 @@ CHECK := $(CHECK) -D__mc68000__=1 -I$(sh # without -fno-strength-reduce the 53c7xx.c driver fails ;-( CFLAGS += -pipe -fno-strength-reduce -ffixed-a2 +ifdef CONFIG_M68000 +CFLAGS := $(CFLAGS) -m68000 -Wa,-m68000 +AFLAGS := $(AFLAGS) -m68000 -Wa,-m68000 +else +ifdef CONFIG_M68010 +CFLAGS := $(CFLAGS) -m68010 -Wa,-m68010 +AFLAGS := $(AFLAGS) -m68010 -Wa,-m68010 +else # 68020 or higher +AS += -m68020 # enable processor switch if compiled only for a single cpu ifndef CONFIG_M68020 ifndef CONFIG_M68030 @@ -47,6 +59,8 @@ endif endif endif +endif +endif ifdef CONFIG_KGDB # If configured for kgdb support, include debugging infos and keep the --- linux-m68k-2.6.8.1+uc0/arch/m68k/amiga/config.c 2004-05-24 11:13:22.000000000 +0200 +++ uClinux-amiga-2.6.8.1/arch/m68k/amiga/config.c 2004-10-08 21:16:01.000000000 +0200 @@ -726,6 +726,7 @@ static NORET_TYPE void amiga_reset( void static void amiga_reset (void) { +#ifdef CONFIG_MMU unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label); @@ -768,6 +769,7 @@ static void amiga_reset (void) : "d0"); jmp_addr_label: +#endif /* CONFIG_MMU */ /* pickup reset address from AmigaOS ROM, reset devices and jump * to reset address */ --- linux-m68k-2.6.8.1+uc0/arch/m68k/kernel/entry.S 2004-05-24 11:13:22.000000000 +0200 +++ uClinux-amiga-2.6.8.1/arch/m68k/kernel/entry.S 2004-06-26 17:19:20.000000000 +0200 @@ -44,7 +44,17 @@ #include -.globl system_call, buserr, trap +#ifndef CONFIG_MMU +#define sys_mprotect sys_ni_syscall +#define sys_msync sys_ni_syscall +#define sys_mlock sys_ni_syscall +#define sys_munlock sys_ni_syscall +#define sys_mlockall sys_ni_syscall +#define sys_munlockall sys_ni_syscall +#define sys_mremap sys_ni_syscall +#endif /* !CONFIG_MMU */ + +.globl system_call, buserr .globl resume, ret_from_exception .globl ret_from_signal .globl inthandler, sys_call_table @@ -327,6 +434,7 @@ resume: /* save sr */ movew %sr,%a0@(TASK_THREAD+THREAD_SR) +#ifdef CONFIG_MMU /* save fs (sfc,%dfc) (may be pointing to kernel memory) */ movec %sfc,%d0 movew %d0,%a0@(TASK_THREAD+THREAD_FS) @@ -335,6 +443,13 @@ resume: /* it is better to use a movel here instead of a movew 8*) */ movec %usp,%d0 movel %d0,%a0@(TASK_THREAD+THREAD_USP) +#else /* !CONFIG_MMU */ + /* save usp */ + movel %a1,%d0 + movel %usp,%a1 + movel %a1,%a0@(TASK_THREAD+THREAD_USP) + movel %d0,%a1 +#endif /* !CONFIG_MMU */ /* save non-scratch registers on stack */ SAVE_SWITCH_STACK @@ -414,10 +529,12 @@ resume: movel %a1@(TASK_THREAD+THREAD_USP),%a0 movel %a0,%usp +#ifdef CONFIG_MMU /* restore fs (sfc,%dfc) */ movew %a1@(TASK_THREAD+THREAD_FS),%a0 movec %a0,%sfc movec %a0,%dfc +#endif /* restore status register */ movew %a1@(TASK_THREAD+THREAD_SR),%sr --- linux-m68k-2.6.8.1+uc0/arch/m68k/kernel/setup.c 2004-08-14 15:35:13.000000000 +0200 +++ uClinux-amiga-2.6.8.1/arch/m68k/kernel/setup.c 2004-10-08 21:01:07.000000000 +0200 @@ -191,7 +188,7 @@ static void __init m68k_parse_bootinfo(c m68k_realnum_memory = m68k_num_memory; #ifdef CONFIG_SINGLE_MEMORY_CHUNK if (m68k_num_memory > 1) { - printk("Ignoring last %i chunks of physical memory\n", + printk("Ignoring last %i chunk(s) of physical memory\n", (m68k_num_memory - 1)); m68k_num_memory = 1; } @@ -199,12 +196,19 @@ static void __init m68k_parse_bootinfo(c #endif } +#ifndef CONFIG_MMU +unsigned long memory_start, memory_end; +#endif + void __init setup_arch(char **cmdline_p) { extern int _etext, _edata, _end; #ifndef CONFIG_SUN3 unsigned long endmem, startmem; #endif +#ifndef CONFIG_MMU + unsigned long free_start; +#endif int i; char *p, *q; @@ -342,7 +346,10 @@ void __init setup_arch(char **cmdline_p) } #ifndef CONFIG_SUN3 - startmem= m68k_memory[0].addr; + +#ifdef CONFIG_MMU + + startmem = m68k_memory[0].addr; endmem = startmem + m68k_memory[0].size; high_memory = (void *)PAGE_OFFSET; for (i = 0; i < m68k_num_memory; i++) { @@ -362,6 +369,25 @@ void __init setup_arch(char **cmdline_p) reserve_bootmem(m68k_memory[0].addr, availmem - m68k_memory[0].addr); +#else /* !CONFIG_MMU */ + + startmem = m68k_memory[0].addr; + free_start = PAGE_ALIGN((unsigned long)&_end); + endmem = startmem + m68k_memory[0].size; + memory_start = startmem; + memory_end = endmem; + high_memory = (void *)endmem; + + free_start += init_bootmem_node(NODE_DATA(0), free_start >> PAGE_SHIFT, + startmem >> PAGE_SHIFT, + endmem >> PAGE_SHIFT); + + free_bootmem(startmem, endmem-startmem); + + reserve_bootmem(startmem, free_start-startmem); + +#endif /* !CONFIG_MMU */ + #ifdef CONFIG_BLK_DEV_INITRD if (m68k_ramdisk.size) { reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size); --- linux-m68k-2.6.8.1+uc0/arch/m68k/kernel/signal.c 2004-08-04 12:13:35.000000000 +0200 +++ uClinux-amiga-2.6.8.1/arch/m68k/kernel/signal.c 2004-06-26 17:17:37.000000000 +0200 @@ -735,7 +751,7 @@ static inline void push_cache (unsigned ".chip 68k" : : "a" (temp)); } - else { + else if (CPU_IS_020_OR_030) { /* * 68030/68020 have no writeback cache; * still need to clear icache. --- linux-m68k-2.6.8.1+uc0/arch/m68k/mm/Makefile 2004-04-30 17:54:35.000000000 +0200 +++ uClinux-amiga-2.6.8.1/arch/m68k/mm/Makefile 2004-05-04 22:42:38.000000000 +0200 @@ -2,7 +2,9 @@ # Makefile for the linux m68k-specific parts of the memory manager. # -obj-y := cache.o init.o fault.o hwtest.o +obj-y := init.o +obj-$(CONFIG_MMU) += cache.o fault.o hwtest.o obj-$(CONFIG_MMU_MOTOROLA) += kmap.o memory.o motorola.o obj-$(CONFIG_MMU_SUN3) += sun3kmap.o sun3mmu.o +obj-$(CONFIG_NOMMU) += kmap.o nommu.o fault-nommu.o --- linux-m68k-2.6.8.1+uc0/arch/m68k/mm/fault-nommu.c 1970-01-01 01:00:00.000000000 +0100 +++ uClinux-amiga-2.6.8.1/arch/m68k/mm/fault-nommu.c 2004-05-10 21:56:56.000000000 +0200 @@ -0,0 +1,57 @@ +/* + * linux/arch/m68knommu/mm/fault.c + * + * Copyright (C) 1998 D. Jeff Dionne , + * Copyright (C) 2000 Lineo, Inc. (www.lineo.com) + * + * Based on: + * + * linux/arch/m68k/mm/fault.c + * + * Copyright (C) 1995 Hamish Macdonald + */ + +#include +#include +#include +#include + +#include +#include + +extern void die_if_kernel(char *, struct pt_regs *, long); + +/* + * This routine handles page faults. It determines the problem, and + * then passes it off to one of the appropriate routines. + * + * error_code: + * bit 0 == 0 means no page found, 1 means protection fault + * bit 1 == 0 means read, 1 means write + * + * If this routine detects a bad access, it returns 1, otherwise it + * returns 0. + */ +asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address, + unsigned long error_code) +{ +#ifdef DEBUG + printk ("regs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld\n", + regs->sr, regs->pc, address, error_code); +#endif + + /* + * Oops. The kernel tried to access some bad page. We'll have to + * terminate things with extreme prejudice. + */ + if ((unsigned long) address < PAGE_SIZE) { + printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); + } else + printk(KERN_ALERT "Unable to handle kernel access"); + printk(" at virtual address %08lx\n",address); + die_if_kernel("Oops", regs, error_code); + do_exit(SIGKILL); + + return 1; +} + --- linux-m68k-2.6.8.1+uc0/arch/m68k/mm/init.c 2004-05-24 11:13:22.000000000 +0200 +++ uClinux-amiga-2.6.8.1/arch/m68k/mm/init.c 2004-06-26 17:19:40.000000000 +0200 @@ -28,9 +28,13 @@ #ifdef CONFIG_ATARI #include #endif +#ifdef CONFIG_MMU #include +#endif +#ifdef CONFIG_MMU DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); +#endif /* * ZERO_PAGE is a special page that is used for zero-initialized @@ -82,7 +86,7 @@ void __init mem_init(void) int datapages = 0; int initpages = 0; unsigned long tmp; -#ifndef CONFIG_SUN3 +#if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) int i; #endif @@ -110,7 +114,7 @@ void __init mem_init(void) } } -#ifndef CONFIG_SUN3 +#if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) /* insert pointer tables allocated so far into the tablelist */ init_pointer_table((unsigned long)kernel_pg_dir); for (i = 0; i < PTRS_PER_PGD; i++) { @@ -121,7 +125,7 @@ void __init mem_init(void) /* insert also pointer table that we used to unmap the zero page */ if (zero_pgtable) init_pointer_table((unsigned long)zero_pgtable); -#endif +#endif /* CONFIG_MMU && !CONFIG_SUN3 */ printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n", (unsigned long)nr_free_pages() << (PAGE_SHIFT-10), --- linux-m68k-2.6.8.1+uc0/arch/m68k/mm/kmap.c 2004-08-04 12:13:35.000000000 +0200 +++ uClinux-amiga-2.6.8.1/arch/m68k/mm/kmap.c 2004-05-04 22:42:38.000000000 +0200 @@ -26,6 +26,8 @@ #define PTRTREESIZE (256*1024) +#ifdef CONFIG_MMU + /* * For 040/060 we can use the virtual memory area like other architectures, * but for 020/030 we want to use early termination page descriptor and we @@ -96,6 +98,9 @@ static inline void free_io_area(void *ad #endif +#endif /* CONFIG_MMU */ + + /* * Map some physical address range into the kernel address space. The * code is copied and adapted from map_chunk(). @@ -104,6 +109,7 @@ static inline void free_io_area(void *ad void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) { +#ifdef CONFIG_MMU struct vm_struct *area; unsigned long virtaddr, retaddr; long offset; @@ -219,6 +225,10 @@ void *__ioremap(unsigned long physaddr, flush_tlb_all(); return (void *)retaddr; +#else /* !CONFIG_MMU */ + // FIXME inline + return (void *)physaddr; +#endif /* !CONFIG_MMU */ } /* @@ -226,6 +236,7 @@ void *__ioremap(unsigned long physaddr, */ void iounmap(void *addr) { +#ifdef CONFIG_MMU #ifdef CONFIG_AMIGA if ((!MACH_IS_AMIGA) || (((unsigned long)addr < 0x40000000) || @@ -234,8 +245,11 @@ void iounmap(void *addr) #else free_io_area(addr); #endif + // FIXME inline +#endif /* CONFIG_MMU */ } +#ifdef CONFIG_MMU /* * __iounmap unmaps nearly everything, so be careful * it doesn't free currently pointer/page tables anymore but it @@ -359,3 +373,4 @@ void kernel_set_cachemode(void *addr, un flush_tlb_all(); } +#endif /* CONFIG_MMU */ --- linux-m68k-2.6.8.1+uc0/arch/m68k/mm/memory.c 2004-08-14 15:35:36.000000000 +0200 +++ uClinux-amiga-2.6.8.1/arch/m68k/mm/memory.c 2004-06-26 17:20:00.000000000 +0200 @@ -290,7 +290,7 @@ void cache_clear (unsigned long paddr, i /* a page boundary gets crossed at the end */ pushcl040(paddr); } - else /* 68030 or 68020 */ + else if (CPU_IS_020_OR_030) asm volatile ("movec %/cacr,%/d0\n\t" "oriw %0,%/d0\n\t" "movec %/d0,%/cacr" @@ -342,7 +342,7 @@ void cache_push (unsigned long paddr, in * flushing the icache is appropriate; flushing the dcache shouldn't * be required. */ - else /* 68030 or 68020 */ + else if (CPU_IS_020_OR_030) asm volatile ("movec %/cacr,%/d0\n\t" "oriw %0,%/d0\n\t" "movec %/d0,%/cacr" --- linux-m68k-2.6.8.1+uc0/arch/m68k/mm/nommu.c 1970-01-01 01:00:00.000000000 +0100 +++ uClinux-amiga-2.6.8.1/arch/m68k/mm/nommu.c 2004-05-10 21:56:56.000000000 +0200 @@ -0,0 +1,226 @@ +/* + * linux/arch/m68knommu/mm/init.c + * + * Copyright (C) 1998 D. Jeff Dionne , + * Kenneth Albanowski , + * Copyright (C) 2000 Lineo, Inc. (www.lineo.com) + * + * Based on: + * + * linux/arch/m68k/mm/init.c + * + * Copyright (C) 1995 Hamish Macdonald + * + * JAN/1999 -- hacked to support ColdFire (gerg@snapgear.com) + * DEC/2000 -- linux 2.4 support + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#undef DEBUG + +extern void die_if_kernel(char *,struct pt_regs *,long); +extern void free_initmem(void); + +/* + * BAD_PAGE is the page that is used for page faults when linux + * is out-of-memory. Older versions of linux just did a + * do_exit(), but using this instead means there is less risk + * for a process dying in kernel mode, possibly leaving a inode + * unused etc.. + * + * BAD_PAGETABLE is the accompanying page-table: it is initialized + * to point to BAD_PAGE entries. + * + * ZERO_PAGE is a special page that is used for zero-initialized + * data and COW. + */ +static unsigned long empty_bad_page_table; + +static unsigned long empty_bad_page; + +extern unsigned long rom_length; + +#if 0 +void show_mem(void) +{ + unsigned long i; + int free = 0, total = 0, reserved = 0, shared = 0; + int cached = 0; + + printk("\nMem-info:\n"); + show_free_areas(); + i = max_mapnr; + while (i-- > 0) { + total++; + if (PageReserved(mem_map+i)) + reserved++; + else if (PageSwapCache(mem_map+i)) + cached++; + else if (!page_count(mem_map+i)) + free++; + else + shared += page_count(mem_map+i) - 1; + } + printk("%d pages of RAM\n",total); + printk("%d free pages\n",free); + printk("%d reserved pages\n",reserved); + printk("%d pages shared\n",shared); + printk("%d pages swap cached\n",cached); +} +#endif + +extern unsigned long memory_start; +extern unsigned long memory_end; + +/* + * paging_init() continues the virtual memory environment setup which + * was begun by the code in arch/head.S. + * The parameters are pointers to where to stick the starting and ending + * addresses of available kernel virtual memory. + */ +void paging_init(void) +{ + unsigned long end_mem = m68k_memory[0].addr+m68k_memory[0].size; + +#ifdef DEBUG + unsigned long start_mem = m68k_memory[0].addr; + printk ("start_mem is %#lx\nvirtual_end is %#lx\n", + start_mem, end_mem); +#endif + + /* + * Initialize the bad page table and bad page to point + * to a couple of allocated pages. + */ + empty_bad_page_table = (unsigned long)alloc_bootmem_pages(PAGE_SIZE); + empty_bad_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE); + empty_zero_page = alloc_bootmem_pages(PAGE_SIZE); + memset(empty_zero_page, 0, PAGE_SIZE); + + /* + * Set up SFC/DFC registers (user data space). + */ + set_fs (USER_DS); + +#ifdef DEBUG + printk ("before free_area_init\n"); + + printk ("free_area_init -> start_mem is %#lx\nvirtual_end is %#lx\n", + start_mem, end_mem); +#endif + + { + unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; + + zones_size[ZONE_DMA] = 0 >> PAGE_SHIFT; + zones_size[ZONE_NORMAL] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT; +#ifdef CONFIG_HIGHMEM + zones_size[ZONE_HIGHMEM] = 0; +#endif + free_area_init(zones_size); + } +} + +#if 0 +void mem_init(void) +{ + int codek = 0, datak = 0, initk = 0; + unsigned long tmp; + extern char _etext, _stext, _sdata, _ebss, __init_begin, __init_end; + extern unsigned int _ramend, _rambase; + unsigned long len = _ramend - _rambase; + unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */ + unsigned long end_mem = memory_end; /* DAVIDM - this must not include kernel stack at top */ + +#ifdef DEBUG + printk("Mem_init: start=%lx, end=%lx\n", start_mem, end_mem); +#endif + + end_mem &= PAGE_MASK; + high_memory = (void *) end_mem; + + start_mem = PAGE_ALIGN(start_mem); + max_mapnr = num_physpages = MAP_NR(high_memory); + + /* this will put all memory onto the freelists */ + totalram_pages = free_all_bootmem(); + + codek = (&_etext - &_stext) >> 10; + datak = (&_ebss - &_sdata) >> 10; + initk = (&__init_begin - &__init_end) >> 10; + + tmp = nr_free_pages() << PAGE_SHIFT; + printk("Memory available: %luk/%luk RAM, %luk/%luk ROM (%dk kernel code, %dk data)\n", + tmp >> 10, + len >> 10, + (rom_length > 0) ? ((rom_length >> 10) - codek) : 0, + rom_length >> 10, + codek, + datak + ); +} + +#ifdef CONFIG_BLK_DEV_INITRD +void free_initrd_mem(unsigned long start, unsigned long end) +{ + int pages = 0; + for (; start < end; start += PAGE_SIZE) { + ClearPageReserved(virt_to_page(start)); + set_page_count(virt_to_page(start), 1); + free_page(start); + totalram_pages++; + pages++; + } + printk ("Freeing initrd memory: %dk freed\n", pages); +} +#endif +#endif + +void +free_initmem() +{ +#if 1 // FIXME def CONFIG_RAMKERNEL + unsigned long addr; + extern char __init_begin, __init_end; + /* + * The following code should be cool even if these sections + * are not page aligned. + */ + addr = PAGE_ALIGN((unsigned long)(&__init_begin)); + /* next to check that the page we free is not a partial page */ + for (; addr + PAGE_SIZE < (unsigned long)(&__init_end); addr +=PAGE_SIZE) { + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); + free_page(addr); + totalram_pages++; + } + printk("Freeing unused kernel memory: %ldk freed (0x%x - 0x%x)\n", + (addr - PAGE_ALIGN((long) &__init_begin)) >> 10, + (int)(PAGE_ALIGN((unsigned long)(&__init_begin))), + (int)(addr - PAGE_SIZE)); +#endif +} + --- linux-m68k-2.6.8.1+uc0/include/asm-m68k/amigahw.h 2004-05-24 11:13:52.000000000 +0200 +++ uClinux-amiga-2.6.8.1/include/asm-m68k/amigahw.h 2004-06-26 17:17:49.000000000 +0200 @@ -16,6 +16,7 @@ #ifndef _M68K_AMIGAHW_H #define _M68K_AMIGAHW_H +#include #include /* @@ -269,7 +270,11 @@ struct CIA { unsigned char crb; char pade[0xff]; }; +#ifdef CONFIG_MMU #define zTwoBase (0x80000000) +#else +#define zTwoBase (0) +#endif #define ZTWO_PADDR(x) (((unsigned long)(x))-zTwoBase) #define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase) --- linux-m68k-2.6.8.1+uc0/include/asm-m68k/mmu.h 2000-12-29 23:07:24.000000000 +0100 +++ uClinux-amiga-2.6.8.1/include/asm-m68k/mmu.h 2004-05-03 21:45:14.000000000 +0200 @@ -1,7 +1,33 @@ #ifndef __MMU_H #define __MMU_H +#include + +#ifdef CONFIG_MMU + /* Default "unsigned long" context */ typedef unsigned long mm_context_t; +#else /* !CONFIG_MMU */ + +/* Copyright (C) 2002, David McCullough */ + +struct mm_rblock_struct { + int size; + int refcount; + void *kblock; +}; + +struct mm_tblock_struct { + struct mm_rblock_struct *rblock; + struct mm_tblock_struct *next; +}; + +typedef struct { + struct mm_tblock_struct tblock; + unsigned long end_brk; +} mm_context_t; + +#endif /* !CONFIG_MMU */ + #endif --- linux-m68k-2.6.8.1+uc0/include/asm-m68k/mmu_context.h 2004-05-24 11:13:53.000000000 +0200 +++ uClinux-amiga-2.6.8.1/include/asm-m68k/mmu_context.h 2004-06-26 17:17:50.000000000 +0200 @@ -13,6 +13,10 @@ static inline void enter_lazy_tlb(struct #include #include +#define destroy_context(mm) do { } while(0) +#define deactivate_mm(tsk,mm) do { } while (0) + +#ifdef CONFIG_MMU static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm) { @@ -89,8 +93,6 @@ static inline void switch_mm(struct mm_s } } -#define deactivate_mm(tsk,mm) do { } while (0) - static inline void activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm) { @@ -102,6 +104,26 @@ static inline void activate_mm(struct mm switch_mm_0460(next_mm); } +#else /* !CONFIG_MMU */ + +static inline int init_new_context(struct task_struct *tsk, + struct mm_struct *mm) +{ + return 0; +} + +static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, + struct task_struct *tsk) +{ +} + +static inline void activate_mm(struct mm_struct *prev_mm, + struct mm_struct *next_mm) +{ +} + +#endif /* !CONFIG_MMU */ + #else /* CONFIG_SUN3 */ #include #include --- linux-m68k-2.6.8.1+uc0/include/asm-m68k/pgalloc.h 2004-04-27 20:10:02.000000000 +0200 +++ uClinux-amiga-2.6.8.1/include/asm-m68k/pgalloc.h 2004-05-03 21:45:15.000000000 +0200 @@ -10,10 +10,12 @@ +#ifdef CONFIG_MMU #ifdef CONFIG_SUN3 #include #else #include #endif +#endif /* !CONFIG_MMU */ #endif /* M68K_PGALLOC_H */ --- linux-m68k-2.6.8.1+uc0/include/asm-m68k/pgtable.h 2004-05-24 11:13:53.000000000 +0200 +++ uClinux-amiga-2.6.8.1/include/asm-m68k/pgtable.h 2004-06-26 17:20:56.000000000 +0200 @@ -9,6 +9,10 @@ #include #include +#ifndef CONFIG_MMU +extern unsigned int kobjsize(const void *objp); +#endif + /* * This file contains the functions and defines necessary to modify and use * the m68k page table tree. @@ -142,6 +146,8 @@ static inline void update_mmu_cache(stru /* MMU-specific headers */ +#ifdef CONFIG_MMU + #ifdef CONFIG_SUN3 #include #else @@ -168,8 +174,47 @@ static inline void update_mmu_cache(stru ? (__pgprot((pgprot_val(prot) & _CACHEMASK040) | _PAGE_NOCACHE_S)) \ : (prot))) +#endif + +#else /* !CONFIG_MMU */ + +#define pgd_none(pgd) (0) +#define pmd_offset(a, b) ((void *)0) + +#define PAGE_NONE __pgprot(0) +#define PAGE_SHARED __pgprot(0) +#define PAGE_COPY __pgprot(0) +#define PAGE_READONLY __pgprot(0) +#define PAGE_KERNEL __pgprot(0) + +#define swapper_pg_dir ((pgd_t *) 0) + +#define _PAGE_NOCACHE030 0x040 /* 68030 no-cache mode */ +#define _PAGE_NOCACHE_S 0x040 /* 68040 no-cache mode, serialized */ +#define _PAGE_CACHE040 0x020 /* 68040 cache mode, cachable, copyback */ +#define _PAGE_CACHE040W 0x000 /* 68040 cache mode, cachable, write-through */ + +#ifndef __ASSEMBLY__ +#define pmd_none(pmd) (!pmd_val(pmd)) +extern pgd_t kernel_pg_dir[128]; + +extern inline pgd_t * pgd_offset_k(unsigned long address) +{ + return kernel_pg_dir + (address >> PGDIR_SHIFT); +} + +#define __swp_type(x) (0) +#define __swp_offset(x) (0) +#define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) }) +#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) +#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) + +static inline int pte_file(pte_t pte) { return 0; } + #endif /* !__ASSEMBLY__ */ +#endif /* !CONFIG_MMU */ + /* * No page table caches to initialise */ --- linux-m68k-2.6.8.1+uc0/include/asm-m68k/segment.h 1998-02-13 01:30:13.000000000 +0100 +++ uClinux-amiga-2.6.8.1/include/asm-m68k/segment.h 2004-05-03 21:45:15.000000000 +0200 @@ -1,6 +1,8 @@ #ifndef _M68K_SEGMENT_H #define _M68K_SEGMENT_H +#include + /* define constants */ /* Address spaces (FC0-FC2) */ #define USER_DATA (1) @@ -31,10 +33,14 @@ typedef struct { static inline mm_segment_t get_fs(void) { +#ifdef CONFIG_MMU mm_segment_t _v; __asm__ ("movec %/dfc,%0":"=r" (_v.seg):); return _v; +#else /* !CONFIG_MMU */ + return USER_DS; +#endif /* !CONFIG_MMU */ } static inline mm_segment_t get_ds(void) @@ -45,9 +51,11 @@ static inline mm_segment_t get_ds(void) static inline void set_fs(mm_segment_t val) { +#ifdef CONFIG_MMU __asm__ __volatile__ ("movec %0,%/sfc\n\t" "movec %0,%/dfc\n\t" : /* no outputs */ : "r" (val.seg) : "memory"); +#endif /* CONFIG_MMU */ } #define segment_eq(a,b) ((a).seg == (b).seg) --- linux-m68k-2.6.8.1+uc0/include/asm-m68k/setup.h 2004-05-24 11:13:53.000000000 +0200 +++ uClinux-amiga-2.6.8.1/include/asm-m68k/setup.h 2004-06-26 17:17:50.000000000 +0200 @@ -209,10 +209,14 @@ extern unsigned long m68k_machtype; #define CPUB_68040 2 #define CPUB_68060 3 + +#define CPUB_68010 6 /* FIXME m68kboot-uC */ +#define CPU_68000 (0) #define CPU_68020 (1< #include #include #include @@ -11,9 +12,27 @@ #define VERIFY_READ 0 #define VERIFY_WRITE 1 +#ifdef CONFIG_MMU + /* We let the MMU do all checking */ #define access_ok(type,addr,size) 1 +#else /* !CONFIG_MMU */ + +#define access_ok(type,addr,size) _access_ok((unsigned long)(addr),(size)) + +#define is_in_rom(addr) 0 /* FIXME */ + +static inline int _access_ok(unsigned long addr, unsigned long size) +{ + extern unsigned long memory_start, memory_end; + + return (((addr >= memory_start) && (addr+size < memory_end)) || + (is_in_rom(addr) && is_in_rom(addr+size))); +} + +#endif /* !CONFIG_MMU */ + static inline int verify_area(int type, const void *addr, unsigned long size) { return access_ok(type,addr,size)?0:-EFAULT; @@ -750,6 +774,7 @@ __constant_copy_to_user(void *to, const return n; } +#ifdef CONFIG_MMU #define copy_from_user(to, from, n) \ (__builtin_constant_p(n) ? \ __constant_copy_from_user(to, from, n) : \ @@ -759,6 +784,10 @@ __constant_copy_to_user(void *to, const (__builtin_constant_p(n) ? \ __constant_copy_to_user(to, from, n) : \ __generic_copy_to_user(to, from, n)) +#else /* !CONFIG_MMU */ +#define copy_from_user(to, from, n) (memcpy(to, from, n), 0) +#define copy_to_user(to, from, n) (memcpy(to, from, n), 0) +#endif /* !CONFIG_MMU */ #define __copy_from_user(to, from, n) copy_from_user(to, from, n) #define __copy_to_user(to, from, n) copy_to_user(to, from, n) @@ -770,6 +799,7 @@ __constant_copy_to_user(void *to, const static inline long strncpy_from_user(char *dst, const char *src, long count) { +#ifdef CONFIG_MMU long res; if (count == 0) return count; __asm__ __volatile__ @@ -794,6 +824,12 @@ strncpy_from_user(char *dst, const char : "i"(-EFAULT), "0"(count), "1"(dst), "2"(src), "3"(count) : "d0", "memory"); return res; +#else /* !CONFIG_MMU */ + char *tmp; + strncpy(dst, src, count); + for (tmp = dst; *tmp && count > 0; tmp++, count--); + return tmp-dst; +#endif /* !CONFIG_MMU */ } /* @@ -803,6 +839,7 @@ strncpy_from_user(char *dst, const char */ static inline long strnlen_user(const char *src, long n) { +#ifdef CONFIG_MMU long res; res = -(long)src; @@ -835,6 +872,9 @@ static inline long strnlen_user(const ch : "i"(0), "0"(res), "1"(src), "2"(n) : "d0"); return res; +#else /* !CONFIG_MMU */ + return(strlen(src) + 1); +#endif /* !CONFIG_MMU */ } #define strlen_user(str) strnlen_user(str, 32767) @@ -846,6 +886,7 @@ static inline long strnlen_user(const ch static inline unsigned long clear_user(void *to, unsigned long n) { +#ifdef CONFIG_MMU __asm__ __volatile__ (" tstl %1\n" " jeq 3f\n" @@ -884,6 +925,10 @@ clear_user(void *to, unsigned long n) : "=a"(to), "=d"(n) : "r"(n & 3), "r"(0), "0"(to), "1"(n/4)); return n; +#else /* !CONFIG_MMU */ + memset(to, 0, n); + return 0; +#endif /* !CONFIG_MMU */ } #endif /* _M68K_UACCESS_H */ --- linux-m68k-2.6.8.1+uc0/include/linux/kbd_kern.h 2004-04-27 20:37:52.000000000 +0200 +++ uClinux-amiga-2.6.8.1/include/linux/kbd_kern.h 2004-05-03 21:45:15.000000000 +0200 @@ -1,6 +1,7 @@ #ifndef _KBD_KERN_H #define _KBD_KERN_H +#include #include #include #include @@ -80,7 +81,9 @@ extern void schedule_console_callback(vo static inline void set_leds(void) { +#ifdef CONFIG_INPUT tasklet_schedule(&keyboard_tasklet); +#endif } static inline int vc_kbd_mode(struct kbd_struct * kbd, int flag) --- linux-m68k-2.6.8.1+uc0/include/linux/mmzone.h 2004-05-24 11:14:01.000000000 +0200 +++ uClinux-amiga-2.6.8.1/include/linux/mmzone.h 2004-06-26 17:17:52.000000000 +0200 @@ -362,7 +362,12 @@ static inline int is_normal_idx(int idx) */ static inline int is_highmem(struct zone *zone) { +#ifdef CONFIG_MMU return (is_highmem_idx(zone - zone->zone_pgdat->node_zones)); +#else /* !CONFIG_MMU */ + /* FIXME why does the above return true? */ + return 0; +#endif /* !CONFIG_MMU */ } static inline int is_normal(struct zone *zone)