diff options
author | Yunhong Jiang <yunhong.jiang@intel.com> | 2015-08-04 12:17:53 -0700 |
---|---|---|
committer | Yunhong Jiang <yunhong.jiang@intel.com> | 2015-08-04 15:44:42 -0700 |
commit | 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (patch) | |
tree | 1c9cafbcd35f783a87880a10f85d1a060db1a563 /kernel/arch/arm/nwfpe/fpa11.c | |
parent | 98260f3884f4a202f9ca5eabed40b1354c489b29 (diff) |
Add the rt linux 4.1.3-rt3 as base
Import the rt linux 4.1.3-rt3 as OPNFV kvm base.
It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and
the base is:
commit 0917f823c59692d751951bf5ea699a2d1e2f26a2
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Sat Jul 25 12:13:34 2015 +0200
Prepare v4.1.3-rt3
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
We lose all the git history this way and it's not good. We
should apply another opnfv project repo in future.
Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Diffstat (limited to 'kernel/arch/arm/nwfpe/fpa11.c')
-rw-r--r-- | kernel/arch/arm/nwfpe/fpa11.c | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/kernel/arch/arm/nwfpe/fpa11.c b/kernel/arch/arm/nwfpe/fpa11.c new file mode 100644 index 000000000..2782ebcc2 --- /dev/null +++ b/kernel/arch/arm/nwfpe/fpa11.c @@ -0,0 +1,128 @@ +/* + NetWinder Floating Point Emulator + (c) Rebel.COM, 1998,1999 + (c) Philip Blundell, 2001 + + Direct questions, comments to Scott Bambrough <scottb@netwinder.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "fpa11.h" +#include "fpopcode.h" + +#include "fpmodule.h" +#include "fpmodule.inl" + +#include <linux/compiler.h> +#include <linux/string.h> + +/* Reset the FPA11 chip. Called to initialize and reset the emulator. */ +static void resetFPA11(void) +{ + int i; + FPA11 *fpa11 = GET_FPA11(); + + /* initialize the register type array */ + for (i = 0; i <= 7; i++) { + fpa11->fType[i] = typeNone; + } + + /* FPSR: set system id to FP_EMULATOR, set AC, clear all other bits */ + fpa11->fpsr = FP_EMULATOR | BIT_AC; +} + +int8 SetRoundingMode(const unsigned int opcode) +{ + switch (opcode & MASK_ROUNDING_MODE) { + default: + case ROUND_TO_NEAREST: + return float_round_nearest_even; + + case ROUND_TO_PLUS_INFINITY: + return float_round_up; + + case ROUND_TO_MINUS_INFINITY: + return float_round_down; + + case ROUND_TO_ZERO: + return float_round_to_zero; + } +} + +int8 SetRoundingPrecision(const unsigned int opcode) +{ +#ifdef CONFIG_FPE_NWFPE_XP + switch (opcode & MASK_ROUNDING_PRECISION) { + case ROUND_SINGLE: + return 32; + + case ROUND_DOUBLE: + return 64; + + case ROUND_EXTENDED: + return 80; + + default: + return 80; + } +#endif + return 80; +} + +void nwfpe_init_fpa(union fp_state *fp) +{ + FPA11 *fpa11 = (FPA11 *)fp; +#ifdef NWFPE_DEBUG + printk("NWFPE: setting up state.\n"); +#endif + memset(fpa11, 0, sizeof(FPA11)); + resetFPA11(); + fpa11->initflag = 1; +} + +/* Emulate the instruction in the opcode. */ +unsigned int EmulateAll(unsigned int opcode) +{ + unsigned int code; + +#ifdef NWFPE_DEBUG + printk("NWFPE: emulating opcode %08x\n", opcode); +#endif + code = opcode & 0x00000f00; + if (code == 0x00000100 || code == 0x00000200) { + /* For coprocessor 1 or 2 (FPA11) */ + code = opcode & 0x0e000000; + if (code == 0x0e000000) { + if (opcode & 0x00000010) { + /* Emulate conversion opcodes. */ + /* Emulate register transfer opcodes. */ + /* Emulate comparison opcodes. */ + return EmulateCPRT(opcode); + } else { + /* Emulate monadic arithmetic opcodes. */ + /* Emulate dyadic arithmetic opcodes. */ + return EmulateCPDO(opcode); + } + } else if (code == 0x0c000000) { + /* Emulate load/store opcodes. */ + /* Emulate load/store multiple opcodes. */ + return EmulateCPDT(opcode); + } + } + + /* Invalid instruction detected. Return FALSE. */ + return 0; +} |