yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/vfp/entry.S |
| 3 | * |
| 4 | * Copyright (C) 2004 ARM Limited. |
| 5 | * Written by Deep Blue Solutions Limited. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | #include <asm/thread_info.h> |
| 12 | #include <asm/vfpmacros.h> |
| 13 | #include "../kernel/entry-header.S" |
| 14 | |
| 15 | @ VFP entry point. |
| 16 | @ |
| 17 | @ r0 = instruction opcode (32-bit ARM or two 16-bit Thumb) |
| 18 | @ r2 = PC value to resume execution after successful emulation |
| 19 | @ r9 = normal "successful" return address |
| 20 | @ r10 = this threads thread_info structure |
| 21 | @ lr = unrecognised instruction return address |
| 22 | @ IRQs disabled. |
| 23 | @ |
| 24 | ENTRY(do_vfp) |
| 25 | #ifdef CONFIG_PREEMPT_COUNT |
| 26 | ldr r4, [r10, #TI_PREEMPT] @ get preempt count |
| 27 | add r11, r4, #1 @ increment it |
| 28 | str r11, [r10, #TI_PREEMPT] |
| 29 | #endif |
| 30 | enable_irq |
| 31 | str r2, [sp, #S_PC] @ update regs->ARM_pc for Thumb 2 case |
| 32 | ldr r4, .LCvfp |
| 33 | ldr r11, [r10, #TI_CPU] @ CPU number |
| 34 | add r10, r10, #TI_VFPSTATE @ r10 = workspace |
| 35 | ldr pc, [r4] @ call VFP entry point |
| 36 | ENDPROC(do_vfp) |
| 37 | |
| 38 | ENTRY(vfp_null_entry) |
| 39 | #ifdef CONFIG_PREEMPT_COUNT |
| 40 | get_thread_info r10 |
| 41 | ldr r4, [r10, #TI_PREEMPT] @ get preempt count |
| 42 | sub r11, r4, #1 @ decrement it |
| 43 | str r11, [r10, #TI_PREEMPT] |
| 44 | #endif |
| 45 | mov pc, lr |
| 46 | ENDPROC(vfp_null_entry) |
| 47 | |
| 48 | .align 2 |
| 49 | .LCvfp: |
| 50 | .word vfp_vector |
| 51 | |
| 52 | @ This code is called if the VFP does not exist. It needs to flag the |
| 53 | @ failure to the VFP initialisation code. |
| 54 | |
| 55 | __INIT |
| 56 | ENTRY(vfp_testing_entry) |
| 57 | #ifdef CONFIG_PREEMPT_COUNT |
| 58 | get_thread_info r10 |
| 59 | ldr r4, [r10, #TI_PREEMPT] @ get preempt count |
| 60 | sub r11, r4, #1 @ decrement it |
| 61 | str r11, [r10, #TI_PREEMPT] |
| 62 | #endif |
| 63 | ldr r0, VFP_arch_address |
| 64 | str r5, [r0] @ known non-zero value |
| 65 | mov pc, r9 @ we have handled the fault |
| 66 | ENDPROC(vfp_testing_entry) |
| 67 | |
| 68 | .align 2 |
| 69 | VFP_arch_address: |
| 70 | .word VFP_arch |
| 71 | |
| 72 | __FINIT |