blob: c1a978402583ff7cbf1b54c743fccf7da6be1440 [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.
10 *
11 * Basic entry code, called from the kernel's undefined instruction trap.
12 * r0 = faulted instruction
Colin Cross082fec52011-01-27 15:46:20 -080013 * r2 = faulted PC+4
Linus Torvalds1da177e2005-04-16 15:20:36 -070014 * r9 = successful return
15 * r10 = thread_info structure
16 * lr = failure return
17 */
George G. Davisf2255be2009-04-01 20:27:18 +010018#include <asm/thread_info.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <asm/vfpmacros.h>
George G. Davisf2255be2009-04-01 20:27:18 +010020#include "../kernel/entry-header.S"
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Catalin Marinas93ed3972008-08-28 11:22:32 +010022ENTRY(do_vfp)
George G. Davisf2255be2009-04-01 20:27:18 +010023#ifdef CONFIG_PREEMPT
24 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
25 add r11, r4, #1 @ increment it
26 str r11, [r10, #TI_PREEMPT]
27#endif
Russell King5d25ac02006-03-15 12:33:43 +000028 enable_irq
Colin Cross082fec52011-01-27 15:46:20 -080029 str r2, [sp, #S_PC] @ update regs->ARM_pc for Thumb 2 case
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 ldr r4, .LCvfp
Catalin Marinasc6428462007-01-24 18:47:08 +010031 ldr r11, [r10, #TI_CPU] @ CPU number
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 add r10, r10, #TI_VFPSTATE @ r10 = workspace
33 ldr pc, [r4] @ call VFP entry point
Catalin Marinas93ed3972008-08-28 11:22:32 +010034ENDPROC(do_vfp)
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
Russell King5d4cae52007-06-10 12:22:20 +010036ENTRY(vfp_null_entry)
George G. Davisf2255be2009-04-01 20:27:18 +010037#ifdef CONFIG_PREEMPT
38 get_thread_info r10
39 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
40 sub r11, r4, #1 @ decrement it
41 str r11, [r10, #TI_PREEMPT]
42#endif
Russell King5d4cae52007-06-10 12:22:20 +010043 mov pc, lr
44ENDPROC(vfp_null_entry)
45
Catalin Marinas88987ef2009-07-24 12:32:52 +010046 .align 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070047.LCvfp:
48 .word vfp_vector
49
50@ This code is called if the VFP does not exist. It needs to flag the
51@ failure to the VFP initialisation code.
52
53 __INIT
Catalin Marinas93ed3972008-08-28 11:22:32 +010054ENTRY(vfp_testing_entry)
George G. Davisf2255be2009-04-01 20:27:18 +010055#ifdef CONFIG_PREEMPT
56 get_thread_info r10
57 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
58 sub r11, r4, #1 @ decrement it
59 str r11, [r10, #TI_PREEMPT]
60#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 ldr r0, VFP_arch_address
62 str r5, [r0] @ known non-zero value
63 mov pc, r9 @ we have handled the fault
Catalin Marinas93ed3972008-08-28 11:22:32 +010064ENDPROC(vfp_testing_entry)
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
Catalin Marinas88987ef2009-07-24 12:32:52 +010066 .align 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070067VFP_arch_address:
68 .word VFP_arch
69
70 __FINIT