···7272config ARCH_MTD_XIP7373 bool74747575+config VECTORS_BASE7676+ hex7777+ default 0xffff0000 if MMU7878+ default DRAM_BASE if REMAP_VECTORS_TO_RAM7979+ default 0x000000008080+ help8181+ The base address of exception vectors.8282+7583source "init/Kconfig"76847785menu "System Type"
+44
arch/arm/Kconfig-nommu
···11+#22+# Kconfig for uClinux(non-paged MM) depend configurations33+# Hyok S. Choi <hyok.choi@samsung.com>44+# 55+66+config SET_MEM_PARAM77+ bool "Set flash/sdram size and base addr"88+ help99+ Say Y to manually set the base addresses and sizes.1010+ otherwise, the default values are assigned.1111+1212+config DRAM_BASE1313+ hex '(S)DRAM Base Address' if SET_MEM_PARAM1414+ default 0x008000001515+1616+config DRAM_SIZE1717+ hex '(S)DRAM SIZE' if SET_MEM_PARAM1818+ default 0x008000001919+2020+config FLASH_MEM_BASE2121+ hex 'FLASH Base Address' if SET_MEM_PARAM2222+ default 0x004000002323+2424+config FLASH_SIZE2525+ hex 'FLASH Size' if SET_MEM_PARAM2626+ default 0x004000002727+2828+config REMAP_VECTORS_TO_RAM2929+ bool 'Install vectors to the begining of RAM' if DRAM_BASE3030+ depends on DRAM_BASE3131+ help3232+ The kernel needs to change the hardware exception vectors.3333+ In nommu mode, the hardware exception vectors are normally3434+ placed at address 0x00000000. However, this region may be3535+ occupied by read-only memory depending on H/W design.3636+3737+ If the region contains read-write memory, say 'n' here.3838+3939+ If your CPU provides a remap facility which allows the exception4040+ vectors to be mapped to writable memory, say 'n' here.4141+4242+ Otherwise, say 'y' here. In this case, the kernel will require4343+ external support to redirect the hardware exception vectors to4444+ the writable versions located at DRAM_BASE.
+7-2
arch/arm/Makefile
···2020# Select a platform tht is kept up-to-date2121KBUILD_DEFCONFIG := versatile_defconfig22222323+# defines filename extension depending memory manement type.2424+ifeq ($(CONFIG_MMU),)2525+MMUEXT := -nommu2626+endif2727+2328ifeq ($(CONFIG_FRAME_POINTER),y)2429CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog2530endif···7873CHECKFLAGS += -D__arm__79748075#Default value8181-head-y := arch/arm/kernel/head.o arch/arm/kernel/init_task.o7676+head-y := arch/arm/kernel/head$(MMUEXT).o arch/arm/kernel/init_task.o8277textofs-y := 0x0000800083788479 machine-$(CONFIG_ARCH_RPC) := rpc···138133MACHINE :=139134endif140135141141-export TEXT_OFFSET GZFLAGS136136+export TEXT_OFFSET GZFLAGS MMUEXT142137143138# Do we have FASTFPE?144139FASTFPE :=arch/arm/fastfpe
···11+/*22+ * linux/arch/arm/kernel/head-common.S33+ *44+ * Copyright (C) 1994-2002 Russell King55+ * Copyright (c) 2003 ARM Limited66+ * All Rights Reserved77+ *88+ * This program is free software; you can redistribute it and/or modify99+ * it under the terms of the GNU General Public License version 2 as1010+ * published by the Free Software Foundation.1111+ *1212+ */1313+1414+ .type __switch_data, %object1515+__switch_data:1616+ .long __mmap_switched1717+ .long __data_loc @ r41818+ .long __data_start @ r51919+ .long __bss_start @ r62020+ .long _end @ r72121+ .long processor_id @ r42222+ .long __machine_arch_type @ r52323+ .long cr_alignment @ r62424+ .long init_thread_union + THREAD_START_SP @ sp2525+2626+/*2727+ * The following fragment of code is executed with the MMU on in MMU mode,2828+ * and uses absolute addresses; this is not position independent.2929+ *3030+ * r0 = cp#15 control register3131+ * r1 = machine ID3232+ * r9 = processor ID3333+ */3434+ .type __mmap_switched, %function3535+__mmap_switched:3636+ adr r3, __switch_data + 43737+3838+ ldmia r3!, {r4, r5, r6, r7}3939+ cmp r4, r5 @ Copy data segment if needed4040+1: cmpne r5, r64141+ ldrne fp, [r4], #44242+ strne fp, [r5], #44343+ bne 1b4444+4545+ mov fp, #0 @ Clear BSS (and zero fp)4646+1: cmp r6, r74747+ strcc fp, [r6],#44848+ bcc 1b4949+5050+ ldmia r3, {r4, r5, r6, sp}5151+ str r9, [r4] @ Save processor ID5252+ str r1, [r5] @ Save machine type5353+ bic r4, r0, #CR_A @ Clear 'A' bit5454+ stmia r6, {r0, r4} @ Save control register values5555+ b start_kernel5656+5757+/*5858+ * Exception handling. Something went wrong and we can't proceed. We5959+ * ought to tell the user, but since we don't have any guarantee that6060+ * we're even running on the right architecture, we do virtually nothing.6161+ *6262+ * If CONFIG_DEBUG_LL is set we try to print out something about the error6363+ * and hope for the best (useful if bootloader fails to pass a proper6464+ * machine ID for example).6565+ */6666+6767+ .type __error_p, %function6868+__error_p:6969+#ifdef CONFIG_DEBUG_LL7070+ adr r0, str_p17171+ bl printascii7272+ b __error7373+str_p1: .asciz "\nError: unrecognized/unsupported processor variant.\n"7474+ .align7575+#endif7676+7777+ .type __error_a, %function7878+__error_a:7979+#ifdef CONFIG_DEBUG_LL8080+ mov r4, r1 @ preserve machine ID8181+ adr r0, str_a18282+ bl printascii8383+ mov r0, r48484+ bl printhex88585+ adr r0, str_a28686+ bl printascii8787+ adr r3, 3f8888+ ldmia r3, {r4, r5, r6} @ get machine desc list8989+ sub r4, r3, r4 @ get offset between virt&phys9090+ add r5, r5, r4 @ convert virt addresses to9191+ add r6, r6, r4 @ physical address space9292+1: ldr r0, [r5, #MACHINFO_TYPE] @ get machine type9393+ bl printhex89494+ mov r0, #'\t'9595+ bl printch9696+ ldr r0, [r5, #MACHINFO_NAME] @ get machine name9797+ add r0, r0, r49898+ bl printascii9999+ mov r0, #'\n'100100+ bl printch101101+ add r5, r5, #SIZEOF_MACHINE_DESC @ next machine_desc102102+ cmp r5, r6103103+ blo 1b104104+ adr r0, str_a3105105+ bl printascii106106+ b __error107107+str_a1: .asciz "\nError: unrecognized/unsupported machine ID (r1 = 0x"108108+str_a2: .asciz ").\n\nAvailable machine support:\n\nID (hex)\tNAME\n"109109+str_a3: .asciz "\nPlease check your kernel config and/or bootloader.\n"110110+ .align111111+#endif112112+113113+ .type __error, %function114114+__error:115115+#ifdef CONFIG_ARCH_RPC116116+/*117117+ * Turn the screen red on a error - RiscPC only.118118+ */119119+ mov r0, #0x02000000120120+ mov r3, #0x11121121+ orr r3, r3, r3, lsl #8122122+ orr r3, r3, r3, lsl #16123123+ str r3, [r0], #4124124+ str r3, [r0], #4125125+ str r3, [r0], #4126126+ str r3, [r0], #4127127+#endif128128+1: mov r0, r0129129+ b 1b130130+131131+132132+/*133133+ * Read processor ID register (CP#15, CR0), and look up in the linker-built134134+ * supported processor list. Note that we can't use the absolute addresses135135+ * for the __proc_info lists since we aren't running with the MMU on136136+ * (and therefore, we are not in the correct address space). We have to137137+ * calculate the offset.138138+ *139139+ * r9 = cpuid140140+ * Returns:141141+ * r3, r4, r6 corrupted142142+ * r5 = proc_info pointer in physical address space143143+ * r9 = cpuid (preserved)144144+ */145145+ .type __lookup_processor_type, %function146146+__lookup_processor_type:147147+ adr r3, 3f148148+ ldmda r3, {r5 - r7}149149+ sub r3, r3, r7 @ get offset between virt&phys150150+ add r5, r5, r3 @ convert virt addresses to151151+ add r6, r6, r3 @ physical address space152152+1: ldmia r5, {r3, r4} @ value, mask153153+ and r4, r4, r9 @ mask wanted bits154154+ teq r3, r4155155+ beq 2f156156+ add r5, r5, #PROC_INFO_SZ @ sizeof(proc_info_list)157157+ cmp r5, r6158158+ blo 1b159159+ mov r5, #0 @ unknown processor160160+2: mov pc, lr161161+162162+/*163163+ * This provides a C-API version of the above function.164164+ */165165+ENTRY(lookup_processor_type)166166+ stmfd sp!, {r4 - r7, r9, lr}167167+ mov r9, r0168168+ bl __lookup_processor_type169169+ mov r0, r5170170+ ldmfd sp!, {r4 - r7, r9, pc}171171+172172+/*173173+ * Look in include/asm-arm/procinfo.h and arch/arm/kernel/arch.[ch] for174174+ * more information about the __proc_info and __arch_info structures.175175+ */176176+ .long __proc_info_begin177177+ .long __proc_info_end178178+3: .long .179179+ .long __arch_info_begin180180+ .long __arch_info_end181181+182182+/*183183+ * Lookup machine architecture in the linker-build list of architectures.184184+ * Note that we can't use the absolute addresses for the __arch_info185185+ * lists since we aren't running with the MMU on (and therefore, we are186186+ * not in the correct address space). We have to calculate the offset.187187+ *188188+ * r1 = machine architecture number189189+ * Returns:190190+ * r3, r4, r6 corrupted191191+ * r5 = mach_info pointer in physical address space192192+ */193193+ .type __lookup_machine_type, %function194194+__lookup_machine_type:195195+ adr r3, 3b196196+ ldmia r3, {r4, r5, r6}197197+ sub r3, r3, r4 @ get offset between virt&phys198198+ add r5, r5, r3 @ convert virt addresses to199199+ add r6, r6, r3 @ physical address space200200+1: ldr r3, [r5, #MACHINFO_TYPE] @ get machine type201201+ teq r3, r1 @ matches loader number?202202+ beq 2f @ found203203+ add r5, r5, #SIZEOF_MACHINE_DESC @ next machine_desc204204+ cmp r5, r6205205+ blo 1b206206+ mov r5, #0 @ unknown machine207207+2: mov pc, lr208208+209209+/*210210+ * This provides a C-API version of the above function.211211+ */212212+ENTRY(lookup_machine_type)213213+ stmfd sp!, {r4 - r6, lr}214214+ mov r1, r0215215+ bl __lookup_machine_type216216+ mov r0, r5217217+ ldmfd sp!, {r4 - r6, pc}
+83
arch/arm/kernel/head-nommu.S
···11+/*22+ * linux/arch/arm/kernel/head-nommu.S33+ *44+ * Copyright (C) 1994-2002 Russell King55+ * Copyright (C) 2003-2006 Hyok S. Choi66+ *77+ * This program is free software; you can redistribute it and/or modify88+ * it under the terms of the GNU General Public License version 2 as99+ * published by the Free Software Foundation.1010+ *1111+ * Common kernel startup code (non-paged MM)1212+ * for 32-bit CPUs which has a process ID register(CP15).1313+ *1414+ */1515+#include <linux/config.h>1616+#include <linux/linkage.h>1717+#include <linux/init.h>1818+1919+#include <asm/assembler.h>2020+#include <asm/mach-types.h>2121+#include <asm/procinfo.h>2222+#include <asm/ptrace.h>2323+#include <asm/constants.h>2424+#include <asm/system.h>2525+2626+#define PROCINFO_INITFUNC 122727+2828+/*2929+ * Kernel startup entry point.3030+ * ---------------------------3131+ *3232+ * This is normally called from the decompressor code. The requirements3333+ * are: MMU = off, D-cache = off, I-cache = dont care, r0 = 0,3434+ * r1 = machine nr.3535+ *3636+ * See linux/arch/arm/tools/mach-types for the complete list of machine3737+ * numbers for r1.3838+ *3939+ */4040+ __INIT4141+ .type stext, %function4242+ENTRY(stext)4343+ msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | MODE_SVC @ ensure svc mode4444+ @ and irqs disabled4545+ mrc p15, 0, r9, c0, c0 @ get processor id4646+ bl __lookup_processor_type @ r5=procinfo r9=cpuid4747+ movs r10, r5 @ invalid processor (r5=0)?4848+ beq __error_p @ yes, error 'p'4949+ bl __lookup_machine_type @ r5=machinfo5050+ movs r8, r5 @ invalid machine (r5=0)?5151+ beq __error_a @ yes, error 'a'5252+5353+ ldr r13, __switch_data @ address to jump to after5454+ @ the initialization is done5555+ adr lr, __after_proc_init @ return (PIC) address5656+ add pc, r10, #PROCINFO_INITFUNC5757+5858+/*5959+ * Set the Control Register and Read the process ID.6060+ */6161+ .type __after_proc_init, %function6262+__after_proc_init:6363+ mrc p15, 0, r0, c1, c0, 0 @ read control reg6464+#ifdef CONFIG_ALIGNMENT_TRAP6565+ orr r0, r0, #CR_A6666+#else6767+ bic r0, r0, #CR_A6868+#endif6969+#ifdef CONFIG_CPU_DCACHE_DISABLE7070+ bic r0, r0, #CR_C7171+#endif7272+#ifdef CONFIG_CPU_BPREDICT_DISABLE7373+ bic r0, r0, #CR_Z7474+#endif7575+#ifdef CONFIG_CPU_ICACHE_DISABLE7676+ bic r0, r0, #CR_I7777+#endif7878+ mcr p15, 0, r0, c1, c0, 0 @ write control reg7979+8080+ mov pc, r13 @ clear the BSS and jump8181+ @ to start_kernel8282+8383+#include "head-common.S"
+1-206
arch/arm/kernel/head.S
···102102 adr lr, __enable_mmu @ return (PIC) address103103 add pc, r10, #PROCINFO_INITFUNC104104105105- .type __switch_data, %object106106-__switch_data:107107- .long __mmap_switched108108- .long __data_loc @ r4109109- .long __data_start @ r5110110- .long __bss_start @ r6111111- .long _end @ r7112112- .long processor_id @ r4113113- .long __machine_arch_type @ r5114114- .long cr_alignment @ r6115115- .long init_thread_union + THREAD_START_SP @ sp116116-117117-/*118118- * The following fragment of code is executed with the MMU on, and uses119119- * absolute addresses; this is not position independent.120120- *121121- * r0 = cp#15 control register122122- * r1 = machine ID123123- * r9 = processor ID124124- */125125- .type __mmap_switched, %function126126-__mmap_switched:127127- adr r3, __switch_data + 4128128-129129- ldmia r3!, {r4, r5, r6, r7}130130- cmp r4, r5 @ Copy data segment if needed131131-1: cmpne r5, r6132132- ldrne fp, [r4], #4133133- strne fp, [r5], #4134134- bne 1b135135-136136- mov fp, #0 @ Clear BSS (and zero fp)137137-1: cmp r6, r7138138- strcc fp, [r6],#4139139- bcc 1b140140-141141- ldmia r3, {r4, r5, r6, sp}142142- str r9, [r4] @ Save processor ID143143- str r1, [r5] @ Save machine type144144- bic r4, r0, #CR_A @ Clear 'A' bit145145- stmia r6, {r0, r4} @ Save control register values146146- b start_kernel147147-148105#if defined(CONFIG_SMP)149106 .type secondary_startup, #function150107ENTRY(secondary_startup)···324367 mov pc, lr325368 .ltorg326369327327-328328-329329-/*330330- * Exception handling. Something went wrong and we can't proceed. We331331- * ought to tell the user, but since we don't have any guarantee that332332- * we're even running on the right architecture, we do virtually nothing.333333- *334334- * If CONFIG_DEBUG_LL is set we try to print out something about the error335335- * and hope for the best (useful if bootloader fails to pass a proper336336- * machine ID for example).337337- */338338-339339- .type __error_p, %function340340-__error_p:341341-#ifdef CONFIG_DEBUG_LL342342- adr r0, str_p1343343- bl printascii344344- b __error345345-str_p1: .asciz "\nError: unrecognized/unsupported processor variant.\n"346346- .align347347-#endif348348-349349- .type __error_a, %function350350-__error_a:351351-#ifdef CONFIG_DEBUG_LL352352- mov r4, r1 @ preserve machine ID353353- adr r0, str_a1354354- bl printascii355355- mov r0, r4356356- bl printhex8357357- adr r0, str_a2358358- bl printascii359359- adr r3, 3f360360- ldmia r3, {r4, r5, r6} @ get machine desc list361361- sub r4, r3, r4 @ get offset between virt&phys362362- add r5, r5, r4 @ convert virt addresses to363363- add r6, r6, r4 @ physical address space364364-1: ldr r0, [r5, #MACHINFO_TYPE] @ get machine type365365- bl printhex8366366- mov r0, #'\t'367367- bl printch368368- ldr r0, [r5, #MACHINFO_NAME] @ get machine name369369- add r0, r0, r4370370- bl printascii371371- mov r0, #'\n'372372- bl printch373373- add r5, r5, #SIZEOF_MACHINE_DESC @ next machine_desc374374- cmp r5, r6375375- blo 1b376376- adr r0, str_a3377377- bl printascii378378- b __error379379-str_a1: .asciz "\nError: unrecognized/unsupported machine ID (r1 = 0x"380380-str_a2: .asciz ").\n\nAvailable machine support:\n\nID (hex)\tNAME\n"381381-str_a3: .asciz "\nPlease check your kernel config and/or bootloader.\n"382382- .align383383-#endif384384-385385- .type __error, %function386386-__error:387387-#ifdef CONFIG_ARCH_RPC388388-/*389389- * Turn the screen red on a error - RiscPC only.390390- */391391- mov r0, #0x02000000392392- mov r3, #0x11393393- orr r3, r3, r3, lsl #8394394- orr r3, r3, r3, lsl #16395395- str r3, [r0], #4396396- str r3, [r0], #4397397- str r3, [r0], #4398398- str r3, [r0], #4399399-#endif400400-1: mov r0, r0401401- b 1b402402-403403-404404-/*405405- * Read processor ID register (CP#15, CR0), and look up in the linker-built406406- * supported processor list. Note that we can't use the absolute addresses407407- * for the __proc_info lists since we aren't running with the MMU on408408- * (and therefore, we are not in the correct address space). We have to409409- * calculate the offset.410410- *411411- * r9 = cpuid412412- * Returns:413413- * r3, r4, r6 corrupted414414- * r5 = proc_info pointer in physical address space415415- * r9 = cpuid (preserved)416416- */417417- .type __lookup_processor_type, %function418418-__lookup_processor_type:419419- adr r3, 3f420420- ldmda r3, {r5 - r7}421421- sub r3, r3, r7 @ get offset between virt&phys422422- add r5, r5, r3 @ convert virt addresses to423423- add r6, r6, r3 @ physical address space424424-1: ldmia r5, {r3, r4} @ value, mask425425- and r4, r4, r9 @ mask wanted bits426426- teq r3, r4427427- beq 2f428428- add r5, r5, #PROC_INFO_SZ @ sizeof(proc_info_list)429429- cmp r5, r6430430- blo 1b431431- mov r5, #0 @ unknown processor432432-2: mov pc, lr433433-434434-/*435435- * This provides a C-API version of the above function.436436- */437437-ENTRY(lookup_processor_type)438438- stmfd sp!, {r4 - r7, r9, lr}439439- mov r9, r0440440- bl __lookup_processor_type441441- mov r0, r5442442- ldmfd sp!, {r4 - r7, r9, pc}443443-444444-/*445445- * Look in include/asm-arm/procinfo.h and arch/arm/kernel/arch.[ch] for446446- * more information about the __proc_info and __arch_info structures.447447- */448448- .long __proc_info_begin449449- .long __proc_info_end450450-3: .long .451451- .long __arch_info_begin452452- .long __arch_info_end453453-454454-/*455455- * Lookup machine architecture in the linker-build list of architectures.456456- * Note that we can't use the absolute addresses for the __arch_info457457- * lists since we aren't running with the MMU on (and therefore, we are458458- * not in the correct address space). We have to calculate the offset.459459- *460460- * r1 = machine architecture number461461- * Returns:462462- * r3, r4, r6 corrupted463463- * r5 = mach_info pointer in physical address space464464- */465465- .type __lookup_machine_type, %function466466-__lookup_machine_type:467467- adr r3, 3b468468- ldmia r3, {r4, r5, r6}469469- sub r3, r3, r4 @ get offset between virt&phys470470- add r5, r5, r3 @ convert virt addresses to471471- add r6, r6, r3 @ physical address space472472-1: ldr r3, [r5, #MACHINFO_TYPE] @ get machine type473473- teq r3, r1 @ matches loader number?474474- beq 2f @ found475475- add r5, r5, #SIZEOF_MACHINE_DESC @ next machine_desc476476- cmp r5, r6477477- blo 1b478478- mov r5, #0 @ unknown machine479479-2: mov pc, lr480480-481481-/*482482- * This provides a C-API version of the above function.483483- */484484-ENTRY(lookup_machine_type)485485- stmfd sp!, {r4 - r6, lr}486486- mov r1, r0487487- bl __lookup_machine_type488488- mov r0, r5489489- ldmfd sp!, {r4 - r6, pc}370370+#include "head-common.S"
+1-1
arch/arm/kernel/signal.h
···77 * it under the terms of the GNU General Public License version 2 as88 * published by the Free Software Foundation.99 */1010-#define KERN_SIGRETURN_CODE 0xffff05001010+#define KERN_SIGRETURN_CODE (CONFIG_VECTORS_BASE + 0x00000500)11111212extern const unsigned long sigreturn_codes[7];
+5-4
arch/arm/kernel/traps.c
···688688689689void __init trap_init(void)690690{691691+ unsigned long vectors = CONFIG_VECTORS_BASE;691692 extern char __stubs_start[], __stubs_end[];692693 extern char __vectors_start[], __vectors_end[];693694 extern char __kuser_helper_start[], __kuser_helper_end[];···699698 * into the vector page, mapped at 0xffff0000, and ensure these700699 * are visible to the instruction stream.701700 */702702- memcpy((void *)0xffff0000, __vectors_start, __vectors_end - __vectors_start);703703- memcpy((void *)0xffff0200, __stubs_start, __stubs_end - __stubs_start);704704- memcpy((void *)0xffff1000 - kuser_sz, __kuser_helper_start, kuser_sz);701701+ memcpy((void *)vectors, __vectors_start, __vectors_end - __vectors_start);702702+ memcpy((void *)vectors + 0x200, __stubs_start, __stubs_end - __stubs_start);703703+ memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz);705704706705 /*707706 * Copy signal return handlers into the vector page, and···710709 memcpy((void *)KERN_SIGRETURN_CODE, sigreturn_codes,711710 sizeof(sigreturn_codes));712711713713- flush_icache_range(0xffff0000, 0xffff0000 + PAGE_SIZE);712712+ flush_icache_range(vectors, vectors + PAGE_SIZE);714713 modify_domain(DOMAIN_USER, DOMAIN_CLIENT);715714}