···180180config ARCH_VERSATILE181181 bool "Versatile"182182 select ARM_AMBA183183+ select ARM_VIC183184 select ICST307184185 help185186 This enables support for ARM Ltd Versatile board.···401400 Currently at least OMAP, PXA2xx and SA11x0 platforms are known402401 to have accurate timekeeping with dynamic tick.403402403403+config AEABI404404+ bool "Use the ARM EABI to compile the kernel"405405+ help406406+ This option allows for the kernel to be compiled using the latest407407+ ARM ABI (aka EABI). This is only useful if you are using a user408408+ space environment that is also compiled with EABI.409409+410410+ Since there are major incompatibilities between the legacy ABI and411411+ EABI, especially with regard to structure member alignment, this412412+ option also changes the kernel syscall calling convention to413413+ disambiguate both ABIs and allow for backward compatibility support414414+ (selected with CONFIG_OABI_COMPAT).415415+416416+ To use this you need GCC version 4.0.0 or later.417417+418418+config OABI_COMPAT419419+ bool "Allow old ABI binaries to run with this kernel"420420+ depends on AEABI421421+ default y422422+ help423423+ This option preserves the old syscall interface along with the424424+ new (ARM EABI) one. It also provides a compatibility layer to425425+ intercept syscalls that have structure arguments which layout426426+ in memory differs between the legacy ABI and the new ARM EABI427427+ (only for non "thumb" binaries). This option adds a tiny428428+ overhead to all syscalls and produces a slightly larger kernel.429429+ If you know you'll be using only pure EABI user space then you430430+ can say N here. If this option is not selected and you attempt431431+ to execute a legacy ABI binary then the result will be432432+ UNPREDICTABLE (in fact it can be predicted that it won't work433433+ at all). If in doubt say Y.434434+404435config ARCH_DISCONTIGMEM_ENABLE405436 bool406437 default (ARCH_LH7A40X && !LH7A40X_CONTIGMEM)···619586620587config FPE_NWFPE621588 bool "NWFPE math emulation"589589+ depends on !AEABI || OABI_COMPAT622590 ---help---623591 Say Y to include the NWFPE floating point emulator in the kernel.624592 This is necessary to run most binaries. Linux does not currently···643609644610config FPE_FASTFPE645611 bool "FastFPE math emulation (EXPERIMENTAL)"646646- depends on !CPU_32v3 && EXPERIMENTAL612612+ depends on (!AEABI || OABI_COMPAT) && !CPU_32v3 && EXPERIMENTAL647613 ---help---648614 Say Y here to include the FAST floating point emulator in the kernel.649615 This is an experimental much faster emulator which now also has full···675641676642config ARTHUR677643 tristate "RISC OS personality"644644+ depends on !AEABI678645 help679646 Say Y here to include the kernel code necessary if you want to run680647 Acorn RISC OS/Arthur binaries under Linux. This code is still very
+6-1
arch/arm/Makefile
···5656tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale5757tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)58585959-# Need -Uarm for gcc < 3.x5959+ifeq ($(CONFIG_AEABI),y)6060+CFLAGS_ABI :=-mabi=aapcs -mno-thumb-interwork6161+else6062CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)6363+endif6464+6565+# Need -Uarm for gcc < 3.x6166CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm6267AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float6368
···11+/*22+ * linux/arch/arm/common/vic.c33+ *44+ * Copyright (C) 1999 - 2003 ARM Limited55+ * Copyright (C) 2000 Deep Blue Solutions Ltd66+ *77+ * This program is free software; you can redistribute it and/or modify88+ * it under the terms of the GNU General Public License as published by99+ * the Free Software Foundation; either version 2 of the License, or1010+ * (at your option) any later version.1111+ *1212+ * This program is distributed in the hope that it will be useful,1313+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1414+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1515+ * GNU General Public License for more details.1616+ *1717+ * You should have received a copy of the GNU General Public License1818+ * along with this program; if not, write to the Free Software1919+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA2020+ */2121+#include <linux/init.h>2222+#include <linux/list.h>2323+2424+#include <asm/io.h>2525+#include <asm/irq.h>2626+#include <asm/mach/irq.h>2727+#include <asm/hardware/vic.h>2828+2929+static void __iomem *vic_base;3030+3131+static void vic_mask_irq(unsigned int irq)3232+{3333+ irq -= IRQ_VIC_START;3434+ writel(1 << irq, vic_base + VIC_INT_ENABLE_CLEAR);3535+}3636+3737+static void vic_unmask_irq(unsigned int irq)3838+{3939+ irq -= IRQ_VIC_START;4040+ writel(1 << irq, vic_base + VIC_INT_ENABLE);4141+}4242+4343+static struct irqchip vic_chip = {4444+ .ack = vic_mask_irq,4545+ .mask = vic_mask_irq,4646+ .unmask = vic_unmask_irq,4747+};4848+4949+void __init vic_init(void __iomem *base, u32 vic_sources)5050+{5151+ unsigned int i;5252+5353+ vic_base = base;5454+5555+ /* Disable all interrupts initially. */5656+5757+ writel(0, vic_base + VIC_INT_SELECT);5858+ writel(0, vic_base + VIC_INT_ENABLE);5959+ writel(~0, vic_base + VIC_INT_ENABLE_CLEAR);6060+ writel(0, vic_base + VIC_IRQ_STATUS);6161+ writel(0, vic_base + VIC_ITCR);6262+ writel(~0, vic_base + VIC_INT_SOFT_CLEAR);6363+6464+ /*6565+ * Make sure we clear all existing interrupts6666+ */6767+ writel(0, vic_base + VIC_VECT_ADDR);6868+ for (i = 0; i < 19; i++) {6969+ unsigned int value;7070+7171+ value = readl(vic_base + VIC_VECT_ADDR);7272+ writel(value, vic_base + VIC_VECT_ADDR);7373+ }7474+7575+ for (i = 0; i < 16; i++) {7676+ void __iomem *reg = vic_base + VIC_VECT_CNTL0 + (i * 4);7777+ writel(VIC_VECT_CNTL_ENABLE | i, reg);7878+ }7979+8080+ writel(32, vic_base + VIC_DEF_VECT_ADDR);8181+8282+ for (i = 0; i < 32; i++) {8383+ unsigned int irq = IRQ_VIC_START + i;8484+8585+ set_irq_chip(irq, &vic_chip);8686+8787+ if (vic_sources & (1 << i)) {8888+ set_irq_handler(irq, do_level_IRQ);8989+ set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);9090+ }9191+ }9292+}
···33 *44 * Copyright (C) 1996,1997,1998 Russell King.55 * ARM700 fix by Matthew Godbolt (linux-user@willothewisp.demon.co.uk)66+ * nommu support by Hyok S. Choi (hyok.choi@samsung.com)67 *78 * This program is free software; you can redistribute it and/or modify89 * it under the terms of the GNU General Public License version 2 as···105104/*106105 * SVC mode handlers107106 */107107+108108+#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5)109109+#define SPFIX(code...) code110110+#else111111+#define SPFIX(code...)112112+#endif113113+108114 .macro svc_entry109115 sub sp, sp, #S_FRAME_SIZE116116+ SPFIX( tst sp, #4 )117117+ SPFIX( bicne sp, sp, #4 )110118 stmib sp, {r1 - r12}111119112120 ldmia r0, {r1 - r3}113121 add r5, sp, #S_SP @ here for interlock avoidance114122 mov r4, #-1 @ "" "" "" ""115123 add r0, sp, #S_FRAME_SIZE @ "" "" "" ""124124+ SPFIX( addne r0, r0, #4 )116125 str r1, [sp] @ save the "real" r0 copied117126 @ from the exception stack118127···313302314303/*315304 * User mode handlers305305+ *306306+ * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE316307 */308308+309309+#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5) && (S_FRAME_SIZE & 7)310310+#error "sizeof(struct pt_regs) must be a multiple of 8"311311+#endif312312+317313 .macro usr_entry318314 sub sp, sp, #S_FRAME_SIZE319315 stmib sp, {r1 - r12}···556538 add ip, r1, #TI_CPU_SAVE557539 ldr r3, [r2, #TI_TP_VALUE]558540 stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack541541+#ifndef CONFIG_MMU542542+ add r2, r2, #TI_CPU_DOMAIN543543+#else559544 ldr r6, [r2, #TI_CPU_DOMAIN]!545545+#endif560546#if __LINUX_ARM_ARCH__ >= 6561547#ifdef CONFIG_CPU_MPCORE562548 clrex···578556 mov r4, #0xffff0fff579557 str r3, [r4, #-15] @ TLS val at 0xffff0ff0580558#endif559559+#ifdef CONFIG_MMU581560 mcr p15, 0, r6, c3, c0, 0 @ Set domain register561561+#endif582562#ifdef CONFIG_VFP583563 @ Always disable VFP so we can lazily save/restore the old584564 @ state. This occurs in the context of the previous thread.
+131-15
arch/arm/kernel/entry-common.S
···9898 run on an ARM7 and we can save a couple of instructions. 9999 --pb */100100#ifdef CONFIG_CPU_ARM710101101- .macro arm710_bug_check, instr, temp102102- and \temp, \instr, #0x0f000000 @ check for SWI103103- teq \temp, #0x0f000000104104- bne .Larm700bug105105- .endm106106-107107-.Larm700bug:101101+#define A710(code...) code102102+.Larm710bug:108103 ldmia sp, {r0 - lr}^ @ Get calling r0 - lr109104 mov r0, r0110105 add sp, sp, #S_FRAME_SIZE111106 subs pc, lr, #4112107#else113113- .macro arm710_bug_check, instr, temp114114- .endm108108+#define A710(code...)115109#endif116110117111 .align 5···123129 /*124130 * Get the system call number.125131 */132132+133133+#if defined(CONFIG_OABI_COMPAT)134134+135135+ /*136136+ * If we have CONFIG_OABI_COMPAT then we need to look at the swi137137+ * value to determine if it is an EABI or an old ABI call.138138+ */126139#ifdef CONFIG_ARM_THUMB140140+ tst r8, #PSR_T_BIT141141+ movne r10, #0 @ no thumb OABI emulation142142+ ldreq r10, [lr, #-4] @ get SWI instruction143143+#else144144+ ldr r10, [lr, #-4] @ get SWI instruction145145+ A710( and ip, r10, #0x0f000000 @ check for SWI )146146+ A710( teq ip, #0x0f000000 )147147+ A710( bne .Larm710bug )148148+#endif149149+150150+#elif defined(CONFIG_AEABI)151151+152152+ /*153153+ * Pure EABI user space always put syscall number into scno (r7).154154+ */155155+ A710( ldr ip, [lr, #-4] @ get SWI instruction )156156+ A710( and ip, ip, #0x0f000000 @ check for SWI )157157+ A710( teq ip, #0x0f000000 )158158+ A710( bne .Larm710bug )159159+160160+#elif defined(CONFIG_ARM_THUMB)161161+162162+ /* Legacy ABI only, possibly thumb mode. */127163 tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs128164 addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in129165 ldreq scno, [lr, #-4]166166+130167#else168168+169169+ /* Legacy ABI only. */131170 ldr scno, [lr, #-4] @ get SWI instruction171171+ A710( and ip, scno, #0x0f000000 @ check for SWI )172172+ A710( teq ip, #0x0f000000 )173173+ A710( bne .Larm710bug )174174+132175#endif133133- arm710_bug_check scno, ip134176135177#ifdef CONFIG_ALIGNMENT_TRAP136178 ldr ip, __cr_alignment···175145#endif176146 enable_irq177147178178- stmdb sp!, {r4, r5} @ push fifth and sixth args179179-180148 get_thread_info tsk149149+ adr tbl, sys_call_table @ load syscall table pointer181150 ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing151151+152152+#if defined(CONFIG_OABI_COMPAT)153153+ /*154154+ * If the swi argument is zero, this is an EABI call and we do nothing.155155+ *156156+ * If this is an old ABI call, get the syscall number into scno and157157+ * get the old ABI syscall table address.158158+ */159159+ bics r10, r10, #0xff000000160160+ eorne scno, r10, #__NR_OABI_SYSCALL_BASE161161+ ldrne tbl, =sys_oabi_call_table162162+#elif !defined(CONFIG_AEABI)182163 bic scno, scno, #0xff000000 @ mask off SWI op-code183164 eor scno, scno, #__NR_SYSCALL_BASE @ check OS number184184- adr tbl, sys_call_table @ load syscall table pointer165165+#endif166166+167167+ stmdb sp!, {r4, r5} @ push fifth and sixth args185168 tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?186169 bne __sys_trace187170188188- adr lr, ret_fast_syscall @ return address189171 cmp scno, #NR_syscalls @ check upper syscall limit172172+ adr lr, ret_fast_syscall @ return address190173 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine191174192175 add r1, sp, #S_OFF···214171 * context switches, and waiting for our parent to respond.215172 */216173__sys_trace:174174+ mov r2, scno217175 add r1, sp, #S_OFF218176 mov r0, #0 @ trace entry [IP = 0]219177 bl syscall_trace220178221179 adr lr, __sys_trace_return @ return address180180+ mov scno, r0 @ syscall number (possibly new)222181 add r1, sp, #S_R0 + S_OFF @ pointer to regs223182 cmp scno, #NR_syscalls @ check upper syscall limit224183 ldmccia r1, {r0 - r3} @ have to reload r0 - r3···229184230185__sys_trace_return:231186 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0187187+ mov r2, scno232188 mov r1, sp233189 mov r0, #1 @ trace exit [IP = 1]234190 bl syscall_trace···241195__cr_alignment:242196 .word cr_alignment243197#endif198198+ .ltorg199199+200200+/*201201+ * This is the syscall table declaration for native ABI syscalls.202202+ * With EABI a couple syscalls are obsolete and defined as sys_ni_syscall.203203+ */204204+#define ABI(native, compat) native205205+#ifdef CONFIG_AEABI206206+#define OBSOLETE(syscall) sys_ni_syscall207207+#else208208+#define OBSOLETE(syscall) syscall209209+#endif244210245211 .type sys_call_table, #object246212ENTRY(sys_call_table)247213#include "calls.S"214214+#undef ABI215215+#undef OBSOLETE248216249217/*============================================================================250218 * Special system call wrappers···267207@ r8 = syscall table268208 .type sys_syscall, #function269209sys_syscall:270270- eor scno, r0, #__NR_SYSCALL_BASE210210+ eor scno, r0, #__NR_OABI_SYSCALL_BASE271211 cmp scno, #__NR_syscall - __NR_SYSCALL_BASE272212 cmpne scno, #NR_syscalls @ check range273213 stmloia sp, {r5, r6} @ shuffle args···315255 ldr r2, [sp, #S_OFF + S_SP]316256 b do_sigaltstack317257258258+sys_statfs64_wrapper:259259+ teq r1, #88260260+ moveq r1, #84261261+ b sys_statfs64262262+263263+sys_fstatfs64_wrapper:264264+ teq r1, #88265265+ moveq r1, #84266266+ b sys_fstatfs64267267+318268/*319269 * Note: off_4k (r5) is always units of 4K. If we can't do the requested320270 * offset, we return EINVAL.···341271 str r5, [sp, #4]342272 b do_mmap2343273#endif274274+275275+#ifdef CONFIG_OABI_COMPAT276276+277277+/*278278+ * These are syscalls with argument register differences279279+ */280280+281281+sys_oabi_pread64:282282+ stmia sp, {r3, r4}283283+ b sys_pread64284284+285285+sys_oabi_pwrite64:286286+ stmia sp, {r3, r4}287287+ b sys_pwrite64288288+289289+sys_oabi_truncate64:290290+ mov r3, r2291291+ mov r2, r1292292+ b sys_truncate64293293+294294+sys_oabi_ftruncate64:295295+ mov r3, r2296296+ mov r2, r1297297+ b sys_ftruncate64298298+299299+sys_oabi_readahead:300300+ str r3, [sp]301301+ mov r3, r2302302+ mov r2, r1303303+ b sys_readahead304304+305305+/*306306+ * Let's declare a second syscall table for old ABI binaries307307+ * using the compatibility syscall entries.308308+ */309309+#define ABI(native, compat) compat310310+#define OBSOLETE(syscall) syscall311311+312312+ .type sys_oabi_call_table, #object313313+ENTRY(sys_oabi_call_table)314314+#include "calls.S"315315+#undef ABI316316+#undef OBSOLETE317317+318318+#endif319319+
+1
arch/arm/kernel/entry-header.S
···1919@2020@ Most of the stack format comes from struct pt_regs, but with2121@ the addition of 8 bytes for storing syscall args 5 and 6.2222+@ This _must_ remain a multiple of 8 for EABI.2223@2324#define S_OFF 82425
+3-4
arch/arm/kernel/head.S
···251251 * r10 = procinfo252252 *253253 * Returns:254254- * r0, r3, r5, r6, r7 corrupted254254+ * r0, r3, r6, r7 corrupted255255 * r4 = physical page table address256256 */257257 .type __create_page_tables, %function258258__create_page_tables:259259- ldr r5, [r8, #MACHINFO_PHYSRAM] @ physram260259 pgtbl r4 @ page table address261260262261 /*···302303 * Then map first 1MB of ram in case it contains our boot params.303304 */304305 add r0, r4, #PAGE_OFFSET >> 18305305- orr r6, r5, r7306306+ orr r6, r7, #PHYS_OFFSET306307 str r6, [r0]307308308309#ifdef CONFIG_XIP_KERNEL···310311 * Map some ram to cover our .data and .bss areas.311312 * Mapping 3MB should be plenty.312313 */313313- sub r3, r4, r5314314+ sub r3, r4, #PHYS_OFFSET314315 mov r3, r3, lsr #20315316 add r0, r0, r3, lsl #2316317 add r6, r6, r3, lsl #20
+12-3
arch/arm/kernel/ptrace.c
···766766 (unsigned long __user *) data);767767 break;768768769769+ case PTRACE_SET_SYSCALL:770770+ ret = 0;771771+ child->ptrace_message = data;772772+ break;773773+769774 default:770775 ret = ptrace_request(child, request, addr, data);771776 break;···779774 return ret;780775}781776782782-asmlinkage void syscall_trace(int why, struct pt_regs *regs)777777+asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno)783778{784779 unsigned long ip;785780786781 if (!test_thread_flag(TIF_SYSCALL_TRACE))787787- return;782782+ return scno;788783 if (!(current->ptrace & PT_PTRACED))789789- return;784784+ return scno;790785791786 /*792787 * Save IP. IP is used to denote syscall entry/exit:···794789 */795790 ip = regs->ARM_ip;796791 regs->ARM_ip = why;792792+793793+ current->ptrace_message = scno;797794798795 /* the 0x80 provides a way for the tracing parent to distinguish799796 between a syscall stop and SIGTRAP delivery */···811804 current->exit_code = 0;812805 }813806 regs->ARM_ip = ip;807807+808808+ return current->ptrace_message;814809}
+9-8
arch/arm/kernel/semaphore.c
···177177 * ip contains the semaphore pointer on entry. Save the C-clobbered178178 * registers (r0 to r3 and lr), but not ip, as we use it as a return179179 * value in some cases..180180+ * To remain AAPCS compliant (64-bit stack align) we save r4 as well.180181 */181182asm(" .section .sched.text,\"ax\",%progbits \n\182183 .align 5 \n\183184 .globl __down_failed \n\184185__down_failed: \n\185185- stmfd sp!, {r0 - r3, lr} \n\186186+ stmfd sp!, {r0 - r4, lr} \n\186187 mov r0, ip \n\187188 bl __down \n\188188- ldmfd sp!, {r0 - r3, pc} \n\189189+ ldmfd sp!, {r0 - r4, pc} \n\189190 \n\190191 .align 5 \n\191192 .globl __down_interruptible_failed \n\192193__down_interruptible_failed: \n\193193- stmfd sp!, {r0 - r3, lr} \n\194194+ stmfd sp!, {r0 - r4, lr} \n\194195 mov r0, ip \n\195196 bl __down_interruptible \n\196197 mov ip, r0 \n\197197- ldmfd sp!, {r0 - r3, pc} \n\198198+ ldmfd sp!, {r0 - r4, pc} \n\198199 \n\199200 .align 5 \n\200201 .globl __down_trylock_failed \n\201202__down_trylock_failed: \n\202202- stmfd sp!, {r0 - r3, lr} \n\203203+ stmfd sp!, {r0 - r4, lr} \n\203204 mov r0, ip \n\204205 bl __down_trylock \n\205206 mov ip, r0 \n\206206- ldmfd sp!, {r0 - r3, pc} \n\207207+ ldmfd sp!, {r0 - r4, pc} \n\207208 \n\208209 .align 5 \n\209210 .globl __up_wakeup \n\210211__up_wakeup: \n\211211- stmfd sp!, {r0 - r3, lr} \n\212212+ stmfd sp!, {r0 - r4, lr} \n\212213 mov r0, ip \n\213214 bl __up \n\214214- ldmfd sp!, {r0 - r3, pc} \n\215215+ ldmfd sp!, {r0 - r4, pc} \n\215216 ");216217217218EXPORT_SYMBOL(__down_failed);
+2
arch/arm/kernel/sys_arm.c
···147147 return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);148148}149149150150+#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)150151/*151152 * sys_ipc() is the de-multiplexer for the SysV IPC calls..152153 *···227226 return -ENOSYS;228227 }229228}229229+#endif230230231231/* Fork a new task - this creates a new program thread.232232 * This is called indirectly via a small wrapper
+339
arch/arm/kernel/sys_oabi-compat.c
···11+/*22+ * arch/arm/kernel/sys_oabi-compat.c33+ *44+ * Compatibility wrappers for syscalls that are used from55+ * old ABI user space binaries with an EABI kernel.66+ *77+ * Author: Nicolas Pitre88+ * Created: Oct 7, 200599+ * Copyright: MontaVista Software, Inc.1010+ *1111+ * This program is free software; you can redistribute it and/or modify1212+ * it under the terms of the GNU General Public License version 2 as1313+ * published by the Free Software Foundation.1414+ */1515+1616+/*1717+ * The legacy ABI and the new ARM EABI have different rules making some1818+ * syscalls incompatible especially with structure arguments.1919+ * Most notably, Eabi says 64-bit members should be 64-bit aligned instead of2020+ * simply word aligned. EABI also pads structures to the size of the largest2121+ * member it contains instead of the invariant 32-bit.2222+ *2323+ * The following syscalls are affected:2424+ *2525+ * sys_stat64:2626+ * sys_lstat64:2727+ * sys_fstat64:2828+ *2929+ * struct stat64 has different sizes and some members are shifted3030+ * Compatibility wrappers are needed for them and provided below.3131+ *3232+ * sys_fcntl64:3333+ *3434+ * struct flock64 has different sizes and some members are shifted3535+ * A compatibility wrapper is needed and provided below.3636+ *3737+ * sys_statfs64:3838+ * sys_fstatfs64:3939+ *4040+ * struct statfs64 has extra padding with EABI growing its size from4141+ * 84 to 88. This struct is now __attribute__((packed,aligned(4)))4242+ * with a small assembly wrapper to force the sz argument to 84 if it is 884343+ * to avoid copying the extra padding over user space unexpecting it.4444+ *4545+ * sys_newuname:4646+ *4747+ * struct new_utsname has no padding with EABI. No problem there.4848+ *4949+ * sys_epoll_ctl:5050+ * sys_epoll_wait:5151+ *5252+ * struct epoll_event has its second member shifted also affecting the5353+ * structure size. Compatibility wrappers are needed and provided below.5454+ *5555+ * sys_ipc:5656+ * sys_semop:5757+ * sys_semtimedop:5858+ *5959+ * struct sembuf loses its padding with EABI. Since arrays of them are6060+ * used they have to be copyed to remove the padding. Compatibility wrappers6161+ * provided below.6262+ */6363+6464+#include <linux/syscalls.h>6565+#include <linux/errno.h>6666+#include <linux/fs.h>6767+#include <linux/fcntl.h>6868+#include <linux/eventpoll.h>6969+#include <linux/sem.h>7070+#include <asm/ipc.h>7171+#include <asm/uaccess.h>7272+7373+struct oldabi_stat64 {7474+ unsigned long long st_dev;7575+ unsigned int __pad1;7676+ unsigned long __st_ino;7777+ unsigned int st_mode;7878+ unsigned int st_nlink;7979+8080+ unsigned long st_uid;8181+ unsigned long st_gid;8282+8383+ unsigned long long st_rdev;8484+ unsigned int __pad2;8585+8686+ long long st_size;8787+ unsigned long st_blksize;8888+ unsigned long long st_blocks;8989+9090+ unsigned long st_atime;9191+ unsigned long st_atime_nsec;9292+9393+ unsigned long st_mtime;9494+ unsigned long st_mtime_nsec;9595+9696+ unsigned long st_ctime;9797+ unsigned long st_ctime_nsec;9898+9999+ unsigned long long st_ino;100100+} __attribute__ ((packed,aligned(4)));101101+102102+static long cp_oldabi_stat64(struct kstat *stat,103103+ struct oldabi_stat64 __user *statbuf)104104+{105105+ struct oldabi_stat64 tmp;106106+107107+ tmp.st_dev = huge_encode_dev(stat->dev);108108+ tmp.__pad1 = 0;109109+ tmp.__st_ino = stat->ino;110110+ tmp.st_mode = stat->mode;111111+ tmp.st_nlink = stat->nlink;112112+ tmp.st_uid = stat->uid;113113+ tmp.st_gid = stat->gid;114114+ tmp.st_rdev = huge_encode_dev(stat->rdev);115115+ tmp.st_size = stat->size;116116+ tmp.st_blocks = stat->blocks;117117+ tmp.__pad2 = 0;118118+ tmp.st_blksize = stat->blksize;119119+ tmp.st_atime = stat->atime.tv_sec;120120+ tmp.st_atime_nsec = stat->atime.tv_nsec;121121+ tmp.st_mtime = stat->mtime.tv_sec;122122+ tmp.st_mtime_nsec = stat->mtime.tv_nsec;123123+ tmp.st_ctime = stat->ctime.tv_sec;124124+ tmp.st_ctime_nsec = stat->ctime.tv_nsec;125125+ tmp.st_ino = stat->ino;126126+ return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;127127+}128128+129129+asmlinkage long sys_oabi_stat64(char __user * filename,130130+ struct oldabi_stat64 __user * statbuf)131131+{132132+ struct kstat stat;133133+ int error = vfs_stat(filename, &stat);134134+ if (!error)135135+ error = cp_oldabi_stat64(&stat, statbuf);136136+ return error;137137+}138138+139139+asmlinkage long sys_oabi_lstat64(char __user * filename,140140+ struct oldabi_stat64 __user * statbuf)141141+{142142+ struct kstat stat;143143+ int error = vfs_lstat(filename, &stat);144144+ if (!error)145145+ error = cp_oldabi_stat64(&stat, statbuf);146146+ return error;147147+}148148+149149+asmlinkage long sys_oabi_fstat64(unsigned long fd,150150+ struct oldabi_stat64 __user * statbuf)151151+{152152+ struct kstat stat;153153+ int error = vfs_fstat(fd, &stat);154154+ if (!error)155155+ error = cp_oldabi_stat64(&stat, statbuf);156156+ return error;157157+}158158+159159+struct oabi_flock64 {160160+ short l_type;161161+ short l_whence;162162+ loff_t l_start;163163+ loff_t l_len;164164+ pid_t l_pid;165165+} __attribute__ ((packed,aligned(4)));166166+167167+asmlinkage long sys_oabi_fcntl64(unsigned int fd, unsigned int cmd,168168+ unsigned long arg)169169+{170170+ struct oabi_flock64 user;171171+ struct flock64 kernel;172172+ mm_segment_t fs = USER_DS; /* initialized to kill a warning */173173+ unsigned long local_arg = arg;174174+ int ret;175175+176176+ switch (cmd) {177177+ case F_GETLK64:178178+ case F_SETLK64:179179+ case F_SETLKW64:180180+ if (copy_from_user(&user, (struct oabi_flock64 __user *)arg,181181+ sizeof(user)))182182+ return -EFAULT;183183+ kernel.l_type = user.l_type;184184+ kernel.l_whence = user.l_whence;185185+ kernel.l_start = user.l_start;186186+ kernel.l_len = user.l_len;187187+ kernel.l_pid = user.l_pid;188188+ local_arg = (unsigned long)&kernel;189189+ fs = get_fs();190190+ set_fs(KERNEL_DS);191191+ }192192+193193+ ret = sys_fcntl64(fd, cmd, local_arg);194194+195195+ switch (cmd) {196196+ case F_GETLK64:197197+ if (!ret) {198198+ user.l_type = kernel.l_type;199199+ user.l_whence = kernel.l_whence;200200+ user.l_start = kernel.l_start;201201+ user.l_len = kernel.l_len;202202+ user.l_pid = kernel.l_pid;203203+ if (copy_to_user((struct oabi_flock64 __user *)arg,204204+ &user, sizeof(user)))205205+ ret = -EFAULT;206206+ }207207+ case F_SETLK64:208208+ case F_SETLKW64:209209+ set_fs(fs);210210+ }211211+212212+ return ret;213213+}214214+215215+struct oabi_epoll_event {216216+ __u32 events;217217+ __u64 data;218218+} __attribute__ ((packed,aligned(4)));219219+220220+asmlinkage long sys_oabi_epoll_ctl(int epfd, int op, int fd,221221+ struct oabi_epoll_event __user *event)222222+{223223+ struct oabi_epoll_event user;224224+ struct epoll_event kernel;225225+ mm_segment_t fs;226226+ long ret;227227+228228+ if (op == EPOLL_CTL_DEL)229229+ return sys_epoll_ctl(epfd, op, fd, NULL);230230+ if (copy_from_user(&user, event, sizeof(user)))231231+ return -EFAULT;232232+ kernel.events = user.events;233233+ kernel.data = user.data;234234+ fs = get_fs();235235+ set_fs(KERNEL_DS);236236+ ret = sys_epoll_ctl(epfd, op, fd, &kernel);237237+ set_fs(fs);238238+ return ret;239239+}240240+241241+asmlinkage long sys_oabi_epoll_wait(int epfd,242242+ struct oabi_epoll_event __user *events,243243+ int maxevents, int timeout)244244+{245245+ struct epoll_event *kbuf;246246+ mm_segment_t fs;247247+ long ret, err, i;248248+249249+ if (maxevents <= 0 || maxevents > (INT_MAX/sizeof(struct epoll_event)))250250+ return -EINVAL;251251+ kbuf = kmalloc(sizeof(*kbuf) * maxevents, GFP_KERNEL);252252+ if (!kbuf)253253+ return -ENOMEM;254254+ fs = get_fs();255255+ set_fs(KERNEL_DS);256256+ ret = sys_epoll_wait(epfd, kbuf, maxevents, timeout);257257+ set_fs(fs);258258+ err = 0;259259+ for (i = 0; i < ret; i++) {260260+ __put_user_error(kbuf[i].events, &events->events, err);261261+ __put_user_error(kbuf[i].data, &events->data, err);262262+ events++;263263+ }264264+ kfree(kbuf);265265+ return err ? -EFAULT : ret;266266+}267267+268268+struct oabi_sembuf {269269+ unsigned short sem_num;270270+ short sem_op;271271+ short sem_flg;272272+ unsigned short __pad;273273+};274274+275275+asmlinkage long sys_oabi_semtimedop(int semid,276276+ struct oabi_sembuf __user *tsops,277277+ unsigned nsops,278278+ const struct timespec __user *timeout)279279+{280280+ struct sembuf *sops;281281+ struct timespec local_timeout;282282+ long err;283283+ int i;284284+285285+ if (nsops < 1)286286+ return -EINVAL;287287+ sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL);288288+ if (!sops)289289+ return -ENOMEM;290290+ err = 0;291291+ for (i = 0; i < nsops; i++) {292292+ __get_user_error(sops[i].sem_num, &tsops->sem_num, err);293293+ __get_user_error(sops[i].sem_op, &tsops->sem_op, err);294294+ __get_user_error(sops[i].sem_flg, &tsops->sem_flg, err);295295+ tsops++;296296+ }297297+ if (timeout) {298298+ /* copy this as well before changing domain protection */299299+ err |= copy_from_user(&local_timeout, timeout, sizeof(*timeout));300300+ timeout = &local_timeout;301301+ }302302+ if (err) {303303+ err = -EFAULT;304304+ } else {305305+ mm_segment_t fs = get_fs();306306+ set_fs(KERNEL_DS);307307+ err = sys_semtimedop(semid, sops, nsops, timeout);308308+ set_fs(fs);309309+ }310310+ kfree(sops);311311+ return err;312312+}313313+314314+asmlinkage long sys_oabi_semop(int semid, struct oabi_sembuf __user *tsops,315315+ unsigned nsops)316316+{317317+ return sys_oabi_semtimedop(semid, tsops, nsops, NULL);318318+}319319+320320+extern asmlinkage int sys_ipc(uint call, int first, int second, int third,321321+ void __user *ptr, long fifth);322322+323323+asmlinkage int sys_oabi_ipc(uint call, int first, int second, int third,324324+ void __user *ptr, long fifth)325325+{326326+ switch (call & 0xffff) {327327+ case SEMOP:328328+ return sys_oabi_semtimedop(first,329329+ (struct oabi_sembuf __user *)ptr,330330+ second, NULL);331331+ case SEMTIMEDOP:332332+ return sys_oabi_semtimedop(first,333333+ (struct oabi_sembuf __user *)ptr,334334+ second,335335+ (const struct timespec __user *)fifth);336336+ default:337337+ return sys_ipc(call, first, second, third, ptr, fifth);338338+ }339339+}
+1-1
arch/arm/kernel/traps.c
···404404 struct thread_info *thread = current_thread_info();405405 siginfo_t info;406406407407- if ((no >> 16) != 0x9f)407407+ if ((no >> 16) != (__ARM_NR_BASE>> 16))408408 return bad_syscall(no, regs);409409410410 switch (no & 0xffff) {
···3344config MACH_REALVIEW_EB55 bool "Support RealView/EB platform"66- default n76 select ARM_GIC87 help98 Include support for the ARM(R) RealView Emulation Baseboard platform.
···991010config MACH_VERSATILE_AB1111 bool "Support Versatile/AB platform"1212- default n1312 help1413 Include support for the ARM(R) Versatile/AP platform.1514
+5-53
arch/arm/mach-versatile/core.c
···3535#include <asm/leds.h>3636#include <asm/hardware/arm_timer.h>3737#include <asm/hardware/icst307.h>3838+#include <asm/hardware/vic.h>38393940#include <asm/mach/arch.h>4041#include <asm/mach/flash.h>···5655#define __io_address(n) __io(IO_ADDRESS(n))5756#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE)5857#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE)5959-6060-static void vic_mask_irq(unsigned int irq)6161-{6262- irq -= IRQ_VIC_START;6363- writel(1 << irq, VA_VIC_BASE + VIC_IRQ_ENABLE_CLEAR);6464-}6565-6666-static void vic_unmask_irq(unsigned int irq)6767-{6868- irq -= IRQ_VIC_START;6969- writel(1 << irq, VA_VIC_BASE + VIC_IRQ_ENABLE);7070-}7171-7272-static struct irqchip vic_chip = {7373- .ack = vic_mask_irq,7474- .mask = vic_mask_irq,7575- .unmask = vic_unmask_irq,7676-};77587859static void sic_mask_irq(unsigned int irq)7960{···110127111128void __init versatile_init_irq(void)112129{113113- unsigned int i, value;130130+ unsigned int i;114131115115- /* Disable all interrupts initially. */116116-117117- writel(0, VA_VIC_BASE + VIC_INT_SELECT);118118- writel(0, VA_VIC_BASE + VIC_IRQ_ENABLE);119119- writel(~0, VA_VIC_BASE + VIC_IRQ_ENABLE_CLEAR);120120- writel(0, VA_VIC_BASE + VIC_IRQ_STATUS);121121- writel(0, VA_VIC_BASE + VIC_ITCR);122122- writel(~0, VA_VIC_BASE + VIC_IRQ_SOFT_CLEAR);123123-124124- /*125125- * Make sure we clear all existing interrupts126126- */127127- writel(0, VA_VIC_BASE + VIC_VECT_ADDR);128128- for (i = 0; i < 19; i++) {129129- value = readl(VA_VIC_BASE + VIC_VECT_ADDR);130130- writel(value, VA_VIC_BASE + VIC_VECT_ADDR);131131- }132132-133133- for (i = 0; i < 16; i++) {134134- value = readl(VA_VIC_BASE + VIC_VECT_CNTL0 + (i * 4));135135- writel(value | VICVectCntl_Enable | i, VA_VIC_BASE + VIC_VECT_CNTL0 + (i * 4));136136- }137137-138138- writel(32, VA_VIC_BASE + VIC_DEF_VECT_ADDR);139139-140140- for (i = IRQ_VIC_START; i <= IRQ_VIC_END; i++) {141141- if (i != IRQ_VICSOURCE31) {142142- set_irq_chip(i, &vic_chip);143143- set_irq_handler(i, do_level_IRQ);144144- set_irq_flags(i, IRQF_VALID | IRQF_PROBE);145145- }146146- }132132+ vic_init(VA_VIC_BASE, ~(1 << 31));147133148134 set_irq_handler(IRQ_VICSOURCE31, sic_handle_irq);149149- vic_unmask_irq(IRQ_VICSOURCE31);135135+ enable_irq(IRQ_VICSOURCE31);150136151137 /* Do second interrupt controller */152138 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);···829877 ticks2 = readl(TIMER0_VA_BASE + TIMER_VALUE) & 0xffff;830878 do {831879 ticks1 = ticks2;832832- status = __raw_readl(VA_IC_BASE + VIC_IRQ_RAW_STATUS);880880+ status = __raw_readl(VA_IC_BASE + VIC_RAW_STATUS);833881 ticks2 = readl(TIMER0_VA_BASE + TIMER_VALUE) & 0xffff;834882 } while (ticks2 > ticks1);835883
···6262#else6363 u32 padding[3];6464#endif6565-} FPREG;6565+} __attribute__ ((packed,aligned(4))) FPREG;66666767/*6868 * FPA11 device model.···8989 so we can use it to detect whether this9090 instance of the emulator needs to be9191 initialised. */9292-} FPA11;9292+} __attribute__ ((packed,aligned(4))) FPA11;93939494extern int8 SetRoundingMode(const unsigned int);9595extern int8 SetRoundingPrecision(const unsigned int);
-3
arch/arm/plat-omap/Kconfig
···2222config OMAP_RESET_CLOCKS2323 bool "Reset unused clocks during boot"2424 depends on ARCH_OMAP2525- default n2625 help2726 Say Y if you want to reset unused clocks during boot.2827 This option saves power, but assumes all drivers are···4344config OMAP_MUX_DEBUG4445 bool "Multiplexing debug output"4546 depends on OMAP_MUX4646- default n4747 help4848 Makes the multiplexing functions print out a lot of debug info.4949 This is useful if you want to find out the correct values of the···91939294config OMAP_DM_TIMER9395 bool "Use dual-mode timer"9494- default n9596 depends on ARCH_OMAP16XX9697 help9798 Select this option if you want to use OMAP Dual-Mode timers.
+1-1
drivers/serial/imx.c
···499499 ucr2 |= UCR2_STPB;500500 if (termios->c_cflag & PARENB) {501501 ucr2 |= UCR2_PREN;502502- if (!(termios->c_cflag & PARODD))502502+ if (termios->c_cflag & PARODD)503503 ucr2 |= UCR2_PROE;504504 }505505
···11+/*22+ * linux/include/asm-arm/hardware/vic.h33+ *44+ * Copyright (c) ARM Limited 2003. All rights reserved.55+ *66+ * This program is free software; you can redistribute it and/or modify77+ * it under the terms of the GNU General Public License as published by88+ * the Free Software Foundation; either version 2 of the License, or99+ * (at your option) any later version.1010+ *1111+ * This program is distributed in the hope that it will be useful,1212+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1313+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+ * GNU General Public License for more details.1515+ *1616+ * You should have received a copy of the GNU General Public License1717+ * along with this program; if not, write to the Free Software1818+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA1919+ */2020+#ifndef __ASM_ARM_HARDWARE_VIC_H2121+#define __ASM_ARM_HARDWARE_VIC_H2222+2323+#define VIC_IRQ_STATUS 0x002424+#define VIC_FIQ_STATUS 0x042525+#define VIC_RAW_STATUS 0x082626+#define VIC_INT_SELECT 0x0c /* 1 = FIQ, 0 = IRQ */2727+#define VIC_INT_ENABLE 0x10 /* 1 = enable, 0 = disable */2828+#define VIC_INT_ENABLE_CLEAR 0x142929+#define VIC_INT_SOFT 0x183030+#define VIC_INT_SOFT_CLEAR 0x1c3131+#define VIC_PROTECT 0x203232+#define VIC_VECT_ADDR 0x303333+#define VIC_DEF_VECT_ADDR 0x343434+3535+#define VIC_VECT_ADDR0 0x100 /* 0 to 15 */3636+#define VIC_VECT_CNTL0 0x200 /* 0 to 15 */3737+#define VIC_ITCR 0x300 /* VIC test control register */3838+3939+#define VIC_VECT_CNTL_ENABLE (1 << 5)4040+4141+#ifndef __ASSEMBLY__4242+void vic_init(void __iomem *base, u32 vic_sources);4343+#endif4444+4545+#endif
+1-1
include/asm-arm/mach/arch.h
···2020 * by assembler code in head-armv.S2121 */2222 unsigned int nr; /* architecture number */2323- unsigned int phys_ram; /* start of physical ram */2323+ unsigned int __deprecated phys_ram; /* start of physical ram */2424 unsigned int phys_io; /* start of physical io */2525 unsigned int io_pg_offst; /* byte offset for io 2626 * page tabe entry */
+7
include/asm-arm/page.h
···170170#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \171171 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)172172173173+/*174174+ * With EABI on ARMv5 and above we must have 64-bit aligned slab pointers.175175+ */176176+#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5)177177+#define ARCH_SLAB_MINALIGN 8178178+#endif179179+173180#endif /* __KERNEL__ */174181175182#include <asm-generic/page.h>
+7
include/asm-arm/processor.h
···49495050#define INIT_THREAD { }51515252+#ifdef CONFIG_MMU5353+#define nommu_start_thread(regs) do { } while (0)5454+#else5555+#define nommu_start_thread(regs) regs->ARM_r10 = current->mm->start_data5656+#endif5757+5258#define start_thread(regs,pc,sp) \5359({ \5460 unsigned long *stack = (unsigned long *)sp; \···7165 regs->ARM_r2 = stack[2]; /* r2 (envp) */ \7266 regs->ARM_r1 = stack[1]; /* r1 (argv) */ \7367 regs->ARM_r0 = stack[0]; /* r0 (argc) */ \6868+ nommu_start_thread(regs); \7469})75707671/* Forward declaration, a strange C thing */
+8-3
include/asm-arm/ptrace.h
···2323#define PTRACE_OLDSETOPTIONS 2124242525#define PTRACE_GET_THREAD_AREA 222626+2727+#define PTRACE_SET_SYSCALL 232828+2629/*2730 * PSR bits2831 */···63606461#ifndef __ASSEMBLY__65626666-/* this struct defines the way the registers are stored on the6767- stack during a system call. */6868-6363+/*6464+ * This struct defines the way the registers are stored on the6565+ * stack during a system call. Note that sizeof(struct pt_regs)6666+ * has to be a multiple of 8.6767+ */6968struct pt_regs {7069 long uregs[18];7170};
+2-9
include/asm-arm/stat.h
···70707171 long long st_size;7272 unsigned long st_blksize;7373-7474-#if defined(__ARMEB__)7575- unsigned long __pad4; /* Future possible st_blocks hi bits */7676- unsigned long st_blocks; /* Number 512-byte blocks allocated. */7777-#else /* Must be little */7878- unsigned long st_blocks; /* Number 512-byte blocks allocated. */7979- unsigned long __pad4; /* Future possible st_blocks hi bits */8080-#endif7373+ unsigned long long st_blocks; /* Number 512-byte blocks allocated. */81748275 unsigned long st_atime;8376 unsigned long st_atime_nsec;···8289 unsigned long st_ctime_nsec;83908491 unsigned long long st_ino;8585-} __attribute__((packed));9292+};86938794#endif
+37-1
include/asm-arm/statfs.h
···11#ifndef _ASMARM_STATFS_H22#define _ASMARM_STATFS_H3344-#include <asm-generic/statfs.h>44+#ifndef __KERNEL_STRICT_NAMES55+# include <linux/types.h>66+typedef __kernel_fsid_t fsid_t;77+#endif88+99+struct statfs {1010+ __u32 f_type;1111+ __u32 f_bsize;1212+ __u32 f_blocks;1313+ __u32 f_bfree;1414+ __u32 f_bavail;1515+ __u32 f_files;1616+ __u32 f_ffree;1717+ __kernel_fsid_t f_fsid;1818+ __u32 f_namelen;1919+ __u32 f_frsize;2020+ __u32 f_spare[5];2121+};2222+2323+/*2424+ * With EABI there is 4 bytes of padding added to this structure.2525+ * Let's pack it so the padding goes away to simplify dual ABI support.2626+ * Note that user space does NOT have to pack this structure.2727+ */2828+struct statfs64 {2929+ __u32 f_type;3030+ __u32 f_bsize;3131+ __u64 f_blocks;3232+ __u64 f_bfree;3333+ __u64 f_bavail;3434+ __u64 f_files;3535+ __u64 f_ffree;3636+ __kernel_fsid_t f_fsid;3737+ __u32 f_namelen;3838+ __u32 f_frsize;3939+ __u32 f_spare[5];4040+} __attribute__ ((packed,aligned(4)));541642#endif