123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233 |
- .macro irq_handler
- ldr r1, =handle_arch_irq
- mov r0, sp
- badr lr, 9997f
- ldr pc, [r1]
- arch_irq_handler_default
- 9997:
- .endm
- .macro pabt_helper
- @ PABORT handler takes pt_regs in r2, fault address in r4 and psr in r5
- ldr ip, .LCprocfns
- mov lr, pc
- ldr pc, [ip,
- bl CPU_PABORT_HANDLER
- .endm
- .macro dabt_helper
- @
- @ Call the processor-specific abort handler:
- @
- @ r2 - pt_regs
- @ r4 - aborted context pc
- @ r5 - aborted context psr
- @
- @ The abort handler must return the aborted address in r0, and
- @ the fault status register in r1. r9 must be preserved.
- @
- ldr ip, .LCprocfns
- mov lr, pc
- ldr pc, [ip,
- bl CPU_DABORT_HANDLER
- .endm
- .section .kprobes.text,"ax",%progbits
- .text
- .macro inv_entry, reason
- sub sp, sp,
- ARM( stmib sp, {r1 - lr} )
- THUMB( stmia sp, {r0 - r12} )
- THUMB( str sp, [sp,
- THUMB( str lr, [sp,
- mov r1,
- .endm
- __pabt_invalid:
- inv_entry BAD_PREFETCH
- b common_invalid
- ENDPROC(__pabt_invalid)
- __dabt_invalid:
- inv_entry BAD_DATA
- b common_invalid
- ENDPROC(__dabt_invalid)
- __irq_invalid:
- inv_entry BAD_IRQ
- b common_invalid
- ENDPROC(__irq_invalid)
- __und_invalid:
- inv_entry BAD_UNDEFINSTR
- @
- @ XXX fall through to common_invalid
- @
- @
- @ common_invalid - generic code for failed exception (re-entrant version of handlers)
- @
- common_invalid:
- zero_fp
- ldmia r0, {r4 - r6}
- add r0, sp,
- mov r7,
- str r4, [sp] @ save preserved r0
- stmia r0, {r5 - r7} @ lr_<exception>,
- @ cpsr_<exception>, "old_r0"
- mov r0, sp
- b bad_mode
- ENDPROC(__und_invalid)
- .macro svc_entry, stack_hole=0, trace=1, uaccess=1
- UNWIND(.fnstart )
- UNWIND(.save {r0 - pc} )
- sub sp, sp,
- SPFIX( str r0, [sp] ) @ temporarily saved
- SPFIX( mov r0, sp )
- SPFIX( tst r0,
- SPFIX( ldr r0, [sp] ) @ restored
- SPFIX( tst sp,
- SPFIX( subeq sp, sp,
- stmia sp, {r1 - r12}
- ldmia r0, {r3 - r5}
- add r7, sp,
- mov r6,
- add r2, sp,
- SPFIX( addeq r2, r2,
- str r3, [sp,
- @ from the exception stack
- mov r3, lr
- @
- @ We are now ready to fill in the remaining blanks on the stack:
- @
- @ r2 - sp_svc
- @ r3 - lr_svc
- @ r4 - lr_<exception>, already fixed up for correct return/restart
- @ r5 - spsr_<exception>
- @ r6 - orig_r0 (see pt_regs definition in ptrace.h)
- @
- stmia r7, {r2 - r6}
- get_thread_info tsk
- ldr r0, [tsk,
- mov r1,
- str r1, [tsk,
- str r0, [sp,
- uaccess_save r0
- .if \uaccess
- uaccess_disable r0
- .endif
- .if \trace
- bl trace_hardirqs_off
- .endif
- .endm
- .align 5
- __dabt_svc:
- svc_entry uaccess=0
- mov r2, sp
- dabt_helper
- THUMB( ldr r5, [sp,
- svc_exit r5 @ return from exception
- UNWIND(.fnend )
- ENDPROC(__dabt_svc)
- .align 5
- __irq_svc:
- svc_entry
- irq_handler
- ldr r8, [tsk,
- ldr r0, [tsk,
- teq r8,
- movne r0,
- tst r0,
- blne svc_preempt
- svc_exit r5, irq = 1 @ return from exception
- UNWIND(.fnend )
- ENDPROC(__irq_svc)
- .ltorg
- svc_preempt:
- mov r8, lr
- 1: bl preempt_schedule_irq @ irq en/disable is done inside
- ldr r0, [tsk,
- tst r0,
- reteq r8 @ go again
- b 1b
- __und_fault:
- @ Correct the PC such that it is pointing at the instruction
- @ which caused the fault. If the faulting instruction was ARM
- @ the PC will be pointing at the next instruction, and have to
- @ subtract 4. Otherwise, it is Thumb, and the PC will be
- @ pointing at the second half of the Thumb instruction. We
- @ have to subtract 2.
- ldr r2, [r0,
- sub r2, r2, r1
- str r2, [r0,
- b do_undefinstr
- ENDPROC(__und_fault)
- .align 5
- __und_svc:
- @ If a kprobe is about to simulate a "stmdb sp..." instruction,
- @ it obviously needs free stack space which then will belong to
- @ the saved context.
- svc_entry MAX_STACK_SIZE
- svc_entry
- @
- @ call emulation code, which returns using r9 if it has emulated
- @ the instruction, or the more conventional lr if we are to treat
- @ this as a real undefined instruction
- @
- @ r0 - instruction
- @
- ldr r0, [r4,
- mov r1,
- ldrh r0, [r4,
- cmp r0,
- blo __und_svc_fault
- ldrh r9, [r4] @ bottom 16 bits
- add r4, r4,
- str r4, [sp,
- orr r0, r9, r0, lsl
- badr r9, __und_svc_finish
- mov r2, r4
- bl call_fpe
- mov r1,
- __und_svc_fault:
- mov r0, sp @ struct pt_regs *regs
- bl __und_fault
- __und_svc_finish:
- get_thread_info tsk
- ldr r5, [sp,
- svc_exit r5 @ return from exception
- UNWIND(.fnend )
- ENDPROC(__und_svc)
- .align 5
- __pabt_svc:
- svc_entry
- mov r2, sp @ regs
- pabt_helper
- svc_exit r5 @ return from exception
- UNWIND(.fnend )
- ENDPROC(__pabt_svc)
- .align 5
- __fiq_svc:
- svc_entry trace=0
- mov r0, sp @ struct pt_regs *regs
- bl handle_fiq_as_nmi
- svc_exit_via_fiq
- UNWIND(.fnend )
- ENDPROC(__fiq_svc)
- .align 5
- .LCcralign:
- .word cr_alignment
- .LCprocfns:
- .word processor
- .LCfp:
- .word fp_enter
- @
- @ Taking a FIQ in abort mode is similar to taking a FIQ in SVC mode
- @ and reuses the same macros. However in abort mode we must also
- @ save/restore lr_abt and spsr_abt to make nested aborts safe.
- @
- .align 5
- __fiq_abt:
- svc_entry trace=0
- ARM( msr cpsr_c,
- THUMB( mov r0,
- THUMB( msr cpsr_c, r0 )
- mov r1, lr @ Save lr_abt
- mrs r2, spsr @ Save spsr_abt, abort is now safe
- ARM( msr cpsr_c,
- THUMB( mov r0,
- THUMB( msr cpsr_c, r0 )
- stmfd sp!, {r1 - r2}
- add r0, sp,
- bl handle_fiq_as_nmi
- ldmfd sp!, {r1 - r2}
- ARM( msr cpsr_c,
- THUMB( mov r0,
- THUMB( msr cpsr_c, r0 )
- mov lr, r1 @ Restore lr_abt, abort is unsafe
- msr spsr_cxsf, r2 @ Restore spsr_abt
- ARM( msr cpsr_c,
- THUMB( mov r0,
- THUMB( msr cpsr_c, r0 )
- svc_exit_via_fiq
- UNWIND(.fnend )
- ENDPROC(__fiq_abt)
- .macro usr_entry, trace=1, uaccess=1
- UNWIND(.fnstart )
- UNWIND(.cantunwind ) @ don't unwind the user space
- sub sp, sp, #PT_REGS_SIZE
- ARM( stmib sp, {r1 - r12} )
- THUMB( stmia sp, {r0 - r12} )
- ATRAP( mrc p15, 0, r7, c1, c0, 0)
- ATRAP( ldr r8, .LCcralign)
- ldmia r0, {r3 - r5}
- add r0, sp, #S_PC @ here for interlock avoidance
- mov r6, #-1 @ "" "" "" ""
- str r3, [sp] @ save the "real" r0 copied
- @ from the exception stack
- ATRAP( ldr r8, [r8, #0])
- @
- @ We are now ready to fill in the remaining blanks on the stack:
- @
- @ r4 - lr_<exception>, already fixed up for correct return/restart
- @ r5 - spsr_<exception>
- @ r6 - orig_r0 (see pt_regs definition in ptrace.h)
- @
- @ Also, separately save sp_usr and lr_usr
- @
- stmia r0, {r4 - r6}
- ARM( stmdb r0, {sp, lr}^ )
- THUMB( store_user_sp_lr r0, r1, S_SP - S_PC )
- .if \uaccess
- uaccess_disable ip
- .endif
- @ Enable the alignment trap while in kernel mode
- ATRAP( teq r8, r7)
- ATRAP( mcrne p15, 0, r8, c1, c0, 0)
- @
- @ Clear FP to mark the first stack frame
- @
- zero_fp
- .if \trace
- #ifdef CONFIG_TRACE_IRQFLAGS
- bl trace_hardirqs_off
- #endif
- ct_user_exit save = 0
- .endif
- .endm
- .macro kuser_cmpxchg_check
- #if !defined(CONFIG_CPU_32v6K) && defined(CONFIG_KUSER_HELPERS)
- #ifndef CONFIG_MMU
- #warning "NPTL on non MMU needs fixing"
- #else
- @ Make sure our user space atomic helper is restarted
- @ if it was interrupted in a critical region. Here we
- @ perform a quick test inline since it should be false
- @ 99.9999% of the time. The rest is done out of line.
- cmp r4, #TASK_SIZE
- blhs kuser_cmpxchg64_fixup
- #endif
- #endif
- .endm
- .align 5
- __dabt_usr:
- usr_entry uaccess=0
- kuser_cmpxchg_check
- mov r2, sp
- dabt_helper
- b ret_from_exception
- UNWIND(.fnend )
- ENDPROC(__dabt_usr)
- .align 5
- __irq_usr:
- usr_entry
- kuser_cmpxchg_check
- irq_handler
- get_thread_info tsk
- mov why, #0
- b ret_to_user_from_irq
- UNWIND(.fnend )
- ENDPROC(__irq_usr)
- .ltorg
- .align 5
- __und_usr:
- usr_entry uaccess=0
- mov r2, r4
- mov r3, r5
- @ r2 = regs->ARM_pc, which is either 2 or 4 bytes ahead of the
- @ faulting instruction depending on Thumb mode.
- @ r3 = regs->ARM_cpsr
- @
- @ The emulation code returns using r9 if it has emulated the
- @ instruction, or the more conventional lr if we are to treat
- @ this as a real undefined instruction
- @
- badr r9, ret_from_exception
- @ IRQs must be enabled before attempting to read the instruction from
- @ user space since that could cause a page/translation fault if the
- @ page table was modified by another CPU.
- enable_irq
- tst r3, #PSR_T_BIT @ Thumb mode?
- bne __und_usr_thumb
- sub r4, r2, #4 @ ARM instr at LR - 4
- 1: ldrt r0, [r4]
- ARM_BE8(rev r0, r0) @ little endian instruction
- uaccess_disable ip
- @ r0 = 32-bit ARM instruction which caused the exception
- @ r2 = PC value for the following instruction (:= regs->ARM_pc)
- @ r4 = PC value for the faulting instruction
- @ lr = 32-bit undefined instruction function
- badr lr, __und_usr_fault_32
- b call_fpe
- __und_usr_thumb:
- @ Thumb instruction
- sub r4, r2, #2 @ First half of thumb instr at LR - 2
- #if CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7
- /*
- * Thumb-2 instruction handling. Note that because pre-v6 and >= v6 platforms
- * can never be supported in a single kernel, this code is not applicable at
- * all when __LINUX_ARM_ARCH__ < 6. This allows simplifying assumptions to be
- * made about .arch directives.
- */
- #if __LINUX_ARM_ARCH__ < 7
- /* If the target CPU may not be Thumb-2-capable, a run-time check is needed: */
- #define NEED_CPU_ARCHITECTURE
- ldr r5, .LCcpu_architecture
- ldr r5, [r5]
- cmp r5, #CPU_ARCH_ARMv7
- blo __und_usr_fault_16 @ 16bit undefined instruction
- /*
- * The following code won't get run unless the running CPU really is v7, so
- * coding round the lack of ldrht on older arches is pointless. Temporarily
- * override the assembler target arch with the minimum required instead:
- */
- .arch armv6t2
- 2: ldrht r5, [r4]
- ARM_BE8(rev16 r5, r5) @ little endian instruction
- cmp r5,
- blo __und_usr_fault_16_pan @ 16bit undefined instruction
- 3: ldrht r0, [r2]
- ARM_BE8(rev16 r0, r0) @ little endian instruction
- uaccess_disable ip
- add r2, r2,
- str r2, [sp,
- orr r0, r0, r5, lsl
- badr lr, __und_usr_fault_32
- @ r0 = the two 16-bit Thumb instructions which caused the exception
- @ r2 = PC value for the following Thumb instruction (:= regs->ARM_pc)
- @ r4 = PC value for the first 16-bit Thumb instruction
- @ lr = 32bit undefined instruction function
- .arch armv6k
- .arch armv6
- b __und_usr_fault_16
- UNWIND(.fnend)
- ENDPROC(__und_usr)
- .pushsection .text.fixup, "ax"
- .align 2
- 4: str r4, [sp,
- ret r9
- .popsection
- .pushsection __ex_table,"a"
- .long 1b, 4b
- .long 2b, 4b
- .long 3b, 4b
- .popsection
- @
- @ Fall-through from Thumb-2 __und_usr
- @
- get_thread_info r10 @ get current thread
- adr r6, .LCneon_thumb_opcodes
- b 2f
- call_fpe:
- get_thread_info r10 @ get current thread
- adr r6, .LCneon_arm_opcodes
- 2: ldr r5, [r6],
- ldr r7, [r6],
- cmp r5,
- beq 1f
- and r8, r0, r5
- cmp r8, r7 @ NEON instruction?
- bne 2b
- mov r7,
- strb r7, [r10,
- strb r7, [r10,
- b do_vfp @ let VFP handler handle this
- 1:
- tst r0,
- tstne r0,
- reteq lr
- and r8, r0,
- THUMB( lsr r8, r8,
- mov r7,
- add r6, r10,
- ARM( strb r7, [r6, r8, lsr
- THUMB( strb r7, [r6, r8] ) @ set appropriate used_cp[]
- @ Test if we need to give access to iWMMXt coprocessors
- ldr r5, [r10,
- rsbs r7, r8,
- movcss r7, r5, lsr
- bcs iwmmxt_task_enable
- ARM( add pc, pc, r8, lsr
- THUMB( lsl r8, r8,
- THUMB( add pc, r8 )
- nop
- ret.w lr @ CP
- W(b) do_fpe @ CP
- W(b) do_fpe @ CP
- ret.w lr @ CP
- b crunch_task_enable @ CP
- b crunch_task_enable @ CP
- b crunch_task_enable @ CP
- ret.w lr @ CP
- ret.w lr @ CP
- ret.w lr @ CP
- ret.w lr @ CP
- ret.w lr @ CP
- ret.w lr @ CP
- W(b) do_vfp @ CP
- W(b) do_vfp @ CP
- ret.w lr @ CP
- ret.w lr @ CP
- ret.w lr @ CP
- ret.w lr @ CP
- ret.w lr @ CP
- ret.w lr @ CP
- .align 2
- .LCcpu_architecture:
- .word __cpu_architecture
- .align 6
- .LCneon_arm_opcodes:
- .word 0xfe000000 @ mask
- .word 0xf2000000 @ opcode
- .word 0xff100000 @ mask
- .word 0xf4000000 @ opcode
- .word 0x00000000 @ mask
- .word 0x00000000 @ opcode
- .LCneon_thumb_opcodes:
- .word 0xef000000 @ mask
- .word 0xef000000 @ opcode
- .word 0xff100000 @ mask
- .word 0xf9000000 @ opcode
- .word 0x00000000 @ mask
- .word 0x00000000 @ opcode
- do_fpe:
- ldr r4, .LCfp
- add r10, r10,
- ldr pc, [r4] @ Call FP module USR entry point
- .pushsection .data
- ENTRY(fp_enter)
- .word no_fp
- .popsection
- ENTRY(no_fp)
- ret lr
- ENDPROC(no_fp)
- __und_usr_fault_32:
- mov r1,
- b 1f
- __und_usr_fault_16_pan:
- uaccess_disable ip
- __und_usr_fault_16:
- mov r1,
- 1: mov r0, sp
- badr lr, ret_from_exception
- b __und_fault
- ENDPROC(__und_usr_fault_32)
- ENDPROC(__und_usr_fault_16)
- .align 5
- __pabt_usr:
- usr_entry
- mov r2, sp @ regs
- pabt_helper
- UNWIND(.fnend )
-
- ENTRY(ret_from_exception)
- UNWIND(.fnstart )
- UNWIND(.cantunwind )
- get_thread_info tsk
- mov why,
- b ret_to_user
- UNWIND(.fnend )
- ENDPROC(__pabt_usr)
- ENDPROC(ret_from_exception)
- .align 5
- __fiq_usr:
- usr_entry trace=0
- kuser_cmpxchg_check
- mov r0, sp @ struct pt_regs *regs
- bl handle_fiq_as_nmi
- get_thread_info tsk
- restore_user_regs fast = 0, offset = 0
- UNWIND(.fnend )
- ENDPROC(__fiq_usr)
- ENTRY(__switch_to)
- UNWIND(.fnstart )
- UNWIND(.cantunwind )
- add ip, r1,
- ARM( stmia ip!, {r4 - sl, fp, sp, lr} ) @ Store most regs on stack
- THUMB( stmia ip!, {r4 - sl, fp} ) @ Store most regs on stack
- THUMB( str sp, [ip],
- THUMB( str lr, [ip],
- ldr r4, [r2,
- ldr r5, [r2,
- mrc p15, 0, r6, c3, c0, 0 @ Get domain register
- str r6, [r1,
- ldr r6, [r2,
- switch_tls r1, r4, r5, r3, r7
- ldr r7, [r2,
- ldr r8, =__stack_chk_guard
- ldr r7, [r7,
- mcr p15, 0, r6, c3, c0, 0 @ Set domain register
- mov r5, r0
- add r4, r2,
- ldr r0, =thread_notify_head
- mov r1,
- bl atomic_notifier_call_chain
- str r7, [r8]
- THUMB( mov ip, r4 )
- mov r0, r5
- ARM( ldmia r4, {r4 - sl, fp, sp, pc} ) @ Load all regs saved previously
- THUMB( ldmia ip!, {r4 - sl, fp} ) @ Load all regs saved previously
- THUMB( ldr sp, [ip],
- THUMB( ldr pc, [ip] )
- UNWIND(.fnend )
- ENDPROC(__switch_to)
- __INIT
- THUMB( .arm )
- .macro usr_ret, reg
- bx \reg
- ret \reg
- .endm
- .macro kuser_pad, sym, size
- .if (. - \sym) & 3
- .rept 4 - (. - \sym) & 3
- .byte 0
- .endr
- .endif
- .rept (\size - (. - \sym)) / 4
- .word 0xe7fddef1
- .endr
- .endm
- .align 5
- .globl __kuser_helper_start
- __kuser_helper_start:
- __kuser_cmpxchg64: @ 0xffff0f60
- stmfd sp!, {r4, r5, r6, r7}
- ldrd r4, r5, [r0] @ load old val
- ldrd r6, r7, [r1] @ load new val
- smp_dmb arm
- 1: ldrexd r0, r1, [r2] @ load current val
- eors r3, r0, r4 @ compare with oldval (1)
- eoreqs r3, r1, r5 @ compare with oldval (2)
- strexdeq r3, r6, r7, [r2] @ store newval if eq
- teqeq r3,
- beq 1b @ if no then retry
- smp_dmb arm
- rsbs r0, r3,
- ldmfd sp!, {r4, r5, r6, r7}
- usr_ret lr
-
- stmfd sp!, {r4, r5, r6, lr}
- ldmia r0, {r4, r5} @ load old val
- ldmia r1, {r6, lr} @ load new val
- 1: ldmia r2, {r0, r1} @ load current val
- eors r3, r0, r4 @ compare with oldval (1)
- eoreqs r3, r1, r5 @ compare with oldval (2)
- 2: stmeqia r2, {r6, lr} @ store newval if eq
- rsbs r0, r3,
- ldmfd sp!, {r4, r5, r6, pc}
- .text
- kuser_cmpxchg64_fixup:
- @ Called from kuser_cmpxchg_fixup.
- @ r4 = address of interrupted insn (must be preserved).
- @ sp = saved regs. r7 and r8 are clobbered.
- @ 1b = first critical insn, 2b = last critical insn.
- @ If r4 >= 1b and r4 <= 2b then saved pc_usr is set to 1b.
- mov r7,
- sub r7, r7,
- subs r8, r4, r7
- rsbcss r8, r8,
- strcs r7, [sp,
- bcc kuser_cmpxchg32_fixup
- ret lr
- .previous
- mov r0,
- adds r0, r0,
- usr_ret lr
- kuser_pad __kuser_cmpxchg64, 64
- __kuser_memory_barrier: @ 0xffff0fa0
- smp_dmb arm
- usr_ret lr
- kuser_pad __kuser_memory_barrier, 32
- __kuser_cmpxchg: @ 0xffff0fc0
-
- 1: ldr r3, [r2] @ load current val
- subs r3, r3, r0 @ compare with oldval
- 2: streq r1, [r2] @ store newval if eq
- rsbs r0, r3,
- usr_ret lr
- .text
- kuser_cmpxchg32_fixup:
- @ Called from kuser_cmpxchg_check macro.
- @ r4 = address of interrupted insn (must be preserved).
- @ sp = saved regs. r7 and r8 are clobbered.
- @ 1b = first critical insn, 2b = last critical insn.
- @ If r4 >= 1b and r4 <= 2b then saved pc_usr is set to 1b.
- mov r7,
- sub r7, r7,
- subs r8, r4, r7
- rsbcss r8, r8,
- strcs r7, [sp,
- ret lr
- .previous
- mov r0,
- adds r0, r0,
- usr_ret lr
- smp_dmb arm
- 1: ldrex r3, [r2]
- subs r3, r3, r0
- strexeq r3, r1, [r2]
- teqeq r3,
- beq 1b
- rsbs r0, r3,
-
- ALT_SMP(b __kuser_memory_barrier)
- ALT_UP(usr_ret lr)
- kuser_pad __kuser_cmpxchg, 32
- __kuser_get_tls: @ 0xffff0fe0
- ldr r0, [pc,
- usr_ret lr
- mrc p15, 0, r0, c13, c0, 3 @ 0xffff0fe8 hardware TLS code
- kuser_pad __kuser_get_tls, 16
- .rep 3
- .word 0 @ 0xffff0ff0 software TLS value, then
- .endr @ pad up to __kuser_helper_version
- __kuser_helper_version: @ 0xffff0ffc
- .word ((__kuser_helper_end - __kuser_helper_start) >> 5)
- .globl __kuser_helper_end
- __kuser_helper_end:
- THUMB( .thumb )
- .macro vector_stub, name, mode, correction=0
- .align 5
- vector_\name:
- .if \correction
- sub lr, lr,
- .endif
- @
- @ Save r0, lr_<exception> (parent PC) and spsr_<exception>
- @ (parent CPSR)
- @
- stmia sp, {r0, lr} @ save r0, lr
- mrs lr, spsr
- str lr, [sp,
- @
- @ Prepare for SVC32 mode. IRQs remain disabled.
- @
- mrs r0, cpsr
- eor r0, r0,
- msr spsr_cxsf, r0
- @
- @ the branch table must immediately follow this code
- @
- and lr, lr,
- THUMB( adr r0, 1f )
- THUMB( ldr lr, [r0, lr, lsl
- mov r0, sp
- ARM( ldr lr, [pc, lr, lsl
- movs pc, lr @ branch to handler in SVC mode
- ENDPROC(vector_\name)
- .align 2
- @ handler addresses follow this label
- 1:
- .endm
- .section .stubs, "ax", %progbits
- @ This must be the first word
- .word vector_swi
- vector_rst:
- ARM( swi SYS_ERROR0 )
- THUMB( svc
- THUMB( nop )
- b vector_und
- vector_stub irq, IRQ_MODE, 4
- .long __irq_usr @ 0 (USR_26 / USR_32)
- .long __irq_invalid @ 1 (FIQ_26 / FIQ_32)
- .long __irq_invalid @ 2 (IRQ_26 / IRQ_32)
- .long __irq_svc @ 3 (SVC_26 / SVC_32)
- .long __irq_invalid @ 4
- .long __irq_invalid @ 5
- .long __irq_invalid @ 6
- .long __irq_invalid @ 7
- .long __irq_invalid @ 8
- .long __irq_invalid @ 9
- .long __irq_invalid @ a
- .long __irq_invalid @ b
- .long __irq_invalid @ c
- .long __irq_invalid @ d
- .long __irq_invalid @ e
- .long __irq_invalid @ f
- vector_stub dabt, ABT_MODE, 8
- .long __dabt_usr @ 0 (USR_26 / USR_32)
- .long __dabt_invalid @ 1 (FIQ_26 / FIQ_32)
- .long __dabt_invalid @ 2 (IRQ_26 / IRQ_32)
- .long __dabt_svc @ 3 (SVC_26 / SVC_32)
- .long __dabt_invalid @ 4
- .long __dabt_invalid @ 5
- .long __dabt_invalid @ 6
- .long __dabt_invalid @ 7
- .long __dabt_invalid @ 8
- .long __dabt_invalid @ 9
- .long __dabt_invalid @ a
- .long __dabt_invalid @ b
- .long __dabt_invalid @ c
- .long __dabt_invalid @ d
- .long __dabt_invalid @ e
- .long __dabt_invalid @ f
- vector_stub pabt, ABT_MODE, 4
- .long __pabt_usr @ 0 (USR_26 / USR_32)
- .long __pabt_invalid @ 1 (FIQ_26 / FIQ_32)
- .long __pabt_invalid @ 2 (IRQ_26 / IRQ_32)
- .long __pabt_svc @ 3 (SVC_26 / SVC_32)
- .long __pabt_invalid @ 4
- .long __pabt_invalid @ 5
- .long __pabt_invalid @ 6
- .long __pabt_invalid @ 7
- .long __pabt_invalid @ 8
- .long __pabt_invalid @ 9
- .long __pabt_invalid @ a
- .long __pabt_invalid @ b
- .long __pabt_invalid @ c
- .long __pabt_invalid @ d
- .long __pabt_invalid @ e
- .long __pabt_invalid @ f
- vector_stub und, UND_MODE
- .long __und_usr @ 0 (USR_26 / USR_32)
- .long __und_invalid @ 1 (FIQ_26 / FIQ_32)
- .long __und_invalid @ 2 (IRQ_26 / IRQ_32)
- .long __und_svc @ 3 (SVC_26 / SVC_32)
- .long __und_invalid @ 4
- .long __und_invalid @ 5
- .long __und_invalid @ 6
- .long __und_invalid @ 7
- .long __und_invalid @ 8
- .long __und_invalid @ 9
- .long __und_invalid @ a
- .long __und_invalid @ b
- .long __und_invalid @ c
- .long __und_invalid @ d
- .long __und_invalid @ e
- .long __und_invalid @ f
- .align 5
- vector_addrexcptn:
- b vector_addrexcptn
- vector_stub fiq, FIQ_MODE, 4
- .long __fiq_usr @ 0 (USR_26 / USR_32)
- .long __fiq_svc @ 1 (FIQ_26 / FIQ_32)
- .long __fiq_svc @ 2 (IRQ_26 / IRQ_32)
- .long __fiq_svc @ 3 (SVC_26 / SVC_32)
- .long __fiq_svc @ 4
- .long __fiq_svc @ 5
- .long __fiq_svc @ 6
- .long __fiq_abt @ 7
- .long __fiq_svc @ 8
- .long __fiq_svc @ 9
- .long __fiq_svc @ a
- .long __fiq_svc @ b
- .long __fiq_svc @ c
- .long __fiq_svc @ d
- .long __fiq_svc @ e
- .long __fiq_svc @ f
- .globl vector_fiq
- .section .vectors, "ax", %progbits
- .L__vectors_start:
- W(b) vector_rst
- W(b) vector_und
- W(ldr) pc, .L__vectors_start + 0x1000
- W(b) vector_pabt
- W(b) vector_dabt
- W(b) vector_addrexcptn
- W(b) vector_irq
- W(b) vector_fiq
- .data
- .globl cr_alignment
- cr_alignment:
- .space 4
- .globl handle_arch_irq
- handle_arch_irq:
- .space 4
|