9cc290ae4e3be2e13e2a61005b2bfc8230f71333
[linux.git] / arch / arm / vfp / entry.S
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 <linux/init.h>
12 #include <linux/linkage.h>
13 #include <asm/thread_info.h>
14 #include <asm/vfpmacros.h>
15 #include <asm/assembler.h>
16 #include <asm/asm-offsets.h>
17
18 @ VFP entry point.
19 @
20 @  r0  = instruction opcode (32-bit ARM or two 16-bit Thumb)
21 @  r2  = PC value to resume execution after successful emulation
22 @  r9  = normal "successful" return address
23 @  r10 = this threads thread_info structure
24 @  lr  = unrecognised instruction return address
25 @  IRQs disabled.
26 @
27 ENTRY(do_vfp)
28 #ifdef CONFIG_PREEMPT_COUNT
29         ldr     r4, [r10, #TI_PREEMPT]  @ get preempt count
30         add     r11, r4, #1             @ increment it
31         str     r11, [r10, #TI_PREEMPT]
32 #endif
33         enable_irq
34         ldr     r4, .LCvfp
35         ldr     r11, [r10, #TI_CPU]     @ CPU number
36         add     r10, r10, #TI_VFPSTATE  @ r10 = workspace
37         ldr     pc, [r4]                @ call VFP entry point
38 ENDPROC(do_vfp)
39
40 ENTRY(vfp_null_entry)
41 #ifdef CONFIG_PREEMPT_COUNT
42         get_thread_info r10
43         ldr     r4, [r10, #TI_PREEMPT]  @ get preempt count
44         sub     r11, r4, #1             @ decrement it
45         str     r11, [r10, #TI_PREEMPT]
46 #endif
47         mov     pc, lr
48 ENDPROC(vfp_null_entry)
49
50         .align  2
51 .LCvfp:
52         .word   vfp_vector
53
54 @ This code is called if the VFP does not exist. It needs to flag the
55 @ failure to the VFP initialisation code.
56
57         __INIT
58 ENTRY(vfp_testing_entry)
59 #ifdef CONFIG_PREEMPT_COUNT
60         get_thread_info r10
61         ldr     r4, [r10, #TI_PREEMPT]  @ get preempt count
62         sub     r11, r4, #1             @ decrement it
63         str     r11, [r10, #TI_PREEMPT]
64 #endif
65         ldr     r0, VFP_arch_address
66         str     r0, [r0]                @ set to non-zero value
67         mov     pc, r9                  @ we have handled the fault
68 ENDPROC(vfp_testing_entry)
69
70         .align  2
71 VFP_arch_address:
72         .word   VFP_arch
73
74         __FINIT