blob: cc926c98598141a2fbcdb762148ec17782982d06 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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.
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 */
George G. Davisf2255be2009-04-01 20:27:18 +010011#include <asm/thread_info.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <asm/vfpmacros.h>
George G. Davisf2255be2009-04-01 20:27:18 +010013#include "../kernel/entry-header.S"
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Russell King15ac49b2012-07-30 19:42:10 +010015@ 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@
Catalin Marinas93ed3972008-08-28 11:22:32 +010024ENTRY(do_vfp)
George G. Davisf2255be2009-04-01 20:27:18 +010025#ifdef CONFIG_PREEMPT
26 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
27 add r11, r4, #1 @ increment it
28 str r11, [r10, #TI_PREEMPT]
29#endif
Russell King5d25ac02006-03-15 12:33:43 +000030 enable_irq
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 ldr r4, .LCvfp
Catalin Marinasc6428462007-01-24 18:47:08 +010032 ldr r11, [r10, #TI_CPU] @ CPU number
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 add r10, r10, #TI_VFPSTATE @ r10 = workspace
34 ldr pc, [r4] @ call VFP entry point
Catalin Marinas93ed3972008-08-28 11:22:32 +010035ENDPROC(do_vfp)
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Russell King5d4cae52007-06-10 12:22:20 +010037ENTRY(vfp_null_entry)
George G. Davisf2255be2009-04-01 20:27:18 +010038#ifdef CONFIG_PREEMPT
39 get_thread_info r10
40 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
41 sub r11, r4, #1 @ decrement it
42 str r11, [r10, #TI_PREEMPT]
43#endif
Russell King5d4cae52007-06-10 12:22:20 +010044 mov pc, lr
45ENDPROC(vfp_null_entry)
46
Catalin Marinas88987ef2009-07-24 12:32:52 +010047 .align 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070048.LCvfp:
49 .word vfp_vector
50
51@ This code is called if the VFP does not exist. It needs to flag the
52@ failure to the VFP initialisation code.
53
54 __INIT
Catalin Marinas93ed3972008-08-28 11:22:32 +010055ENTRY(vfp_testing_entry)
George G. Davisf2255be2009-04-01 20:27:18 +010056#ifdef CONFIG_PREEMPT
57 get_thread_info r10
58 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
59 sub r11, r4, #1 @ decrement it
60 str r11, [r10, #TI_PREEMPT]
61#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 ldr r0, VFP_arch_address
63 str r5, [r0] @ known non-zero value
64 mov pc, r9 @ we have handled the fault
Catalin Marinas93ed3972008-08-28 11:22:32 +010065ENDPROC(vfp_testing_entry)
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
Catalin Marinas88987ef2009-07-24 12:32:52 +010067 .align 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070068VFP_arch_address:
69 .word VFP_arch
70
71 __FINIT