| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/arch/arm/vfp/vfpinstr.h |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2004 ARM Limited. |
|---|
| 5 | 6 | * 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 | 7 | * |
|---|
| 11 | 8 | * VFP instruction masks. |
|---|
| 12 | 9 | */ |
|---|
| .. | .. |
|---|
| 65 | 62 | #define FPSCR_C (1 << 29) |
|---|
| 66 | 63 | #define FPSCR_V (1 << 28) |
|---|
| 67 | 64 | |
|---|
| 68 | | -/* |
|---|
| 69 | | - * Since we aren't building with -mfpu=vfp, we need to code |
|---|
| 70 | | - * these instructions using their MRC/MCR equivalents. |
|---|
| 71 | | - */ |
|---|
| 65 | +#ifdef CONFIG_AS_VFP_VMRS_FPINST |
|---|
| 66 | + |
|---|
| 67 | +#define fmrx(_vfp_) ({ \ |
|---|
| 68 | + u32 __v; \ |
|---|
| 69 | + asm(".fpu vfpv2\n" \ |
|---|
| 70 | + "vmrs %0, " #_vfp_ \ |
|---|
| 71 | + : "=r" (__v) : : "cc"); \ |
|---|
| 72 | + __v; \ |
|---|
| 73 | + }) |
|---|
| 74 | + |
|---|
| 75 | +#define fmxr(_vfp_,_var_) \ |
|---|
| 76 | + asm(".fpu vfpv2\n" \ |
|---|
| 77 | + "vmsr " #_vfp_ ", %0" \ |
|---|
| 78 | + : : "r" (_var_) : "cc") |
|---|
| 79 | + |
|---|
| 80 | +#else |
|---|
| 81 | + |
|---|
| 72 | 82 | #define vfpreg(_vfp_) #_vfp_ |
|---|
| 73 | 83 | |
|---|
| 74 | 84 | #define fmrx(_vfp_) ({ \ |
|---|
| .. | .. |
|---|
| 82 | 92 | asm("mcr p10, 7, %0, " vfpreg(_vfp_) ", cr0, 0 @ fmxr " #_vfp_ ", %0" \ |
|---|
| 83 | 93 | : : "r" (_var_) : "cc") |
|---|
| 84 | 94 | |
|---|
| 95 | +#endif |
|---|
| 96 | + |
|---|
| 85 | 97 | u32 vfp_single_cpdo(u32 inst, u32 fpscr); |
|---|
| 86 | 98 | u32 vfp_single_cprt(u32 inst, u32 fpscr, struct pt_regs *regs); |
|---|
| 87 | 99 | |
|---|