blob: 9cc290ae4e3be2e13e2a61005b2bfc8230f71333 [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 */
Catalin Marinas39ad04c2014-04-02 10:57:48 +010011#include <linux/init.h>
12#include <linux/linkage.h>
George G. Davisf2255be2009-04-01 20:27:18 +010013#include <asm/thread_info.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <asm/vfpmacros.h>
Catalin Marinas39ad04c2014-04-02 10:57:48 +010015#include <asm/assembler.h>
16#include <asm/asm-offsets.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
Russell King15ac49b2012-07-30 19:42:10 +010018@ 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@
Catalin Marinas93ed3972008-08-28 11:22:32 +010027ENTRY(do_vfp)
Stephen Boyd568dca12013-01-14 19:50:42 +010028#ifdef CONFIG_PREEMPT_COUNT
George G. Davisf2255be2009-04-01 20:27:18 +010029 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
30 add r11, r4, #1 @ increment it
31 str r11, [r10, #TI_PREEMPT]
32#endif
Russell King5d25ac02006-03-15 12:33:43 +000033 enable_irq
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 ldr r4, .LCvfp
Catalin Marinasc6428462007-01-24 18:47:08 +010035 ldr r11, [r10, #TI_CPU] @ CPU number
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 add r10, r10, #TI_VFPSTATE @ r10 = workspace
37 ldr pc, [r4] @ call VFP entry point
Catalin Marinas93ed3972008-08-28 11:22:32 +010038ENDPROC(do_vfp)
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Russell King5d4cae52007-06-10 12:22:20 +010040ENTRY(vfp_null_entry)
Stephen Boyd568dca12013-01-14 19:50:42 +010041#ifdef CONFIG_PREEMPT_COUNT
George G. Davisf2255be2009-04-01 20:27:18 +010042 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
Russell King5d4cae52007-06-10 12:22:20 +010047 mov pc, lr
48ENDPROC(vfp_null_entry)
49
Catalin Marinas88987ef2009-07-24 12:32:52 +010050 .align 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070051.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
Catalin Marinas93ed3972008-08-28 11:22:32 +010058ENTRY(vfp_testing_entry)
Stephen Boyd568dca12013-01-14 19:50:42 +010059#ifdef CONFIG_PREEMPT_COUNT
George G. Davisf2255be2009-04-01 20:27:18 +010060 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 ldr r0, VFP_arch_address
Will Deaconf27d6e12013-05-16 19:38:51 +010066 str r0, [r0] @ set to non-zero value
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 mov pc, r9 @ we have handled the fault
Catalin Marinas93ed3972008-08-28 11:22:32 +010068ENDPROC(vfp_testing_entry)
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
Catalin Marinas88987ef2009-07-24 12:32:52 +010070 .align 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070071VFP_arch_address:
72 .word VFP_arch
73
74 __FINIT