2 * This file is part of SIS.
4 * SIS, SPARC instruction simulator. Copyright (C) 1995 Jiri Gaisler, European
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 675
19 * Mass Ave, Cambridge, MA 02139, USA.
22 * This file implements the interface between the host and the simulated
23 * FPU. IEEE trap handling is done as follows:
24 * 1. In the host, all IEEE traps are masked
25 * 2. After each simulated FPU instruction, check if any exception occured
26 * by reading the exception bits from the host FPU status register
28 * 3. Propagate any exceptions to the simulated FSR.
29 * 4. Clear host exception bits
32 * This can also be done using ieee_flags() library routine on sun.
37 /* This host dependent routine should return the accrued exceptions */
42 return ((_get_fsr_raw() >> 5) & 0x1F);
46 accx
= _get_sw() & 0x3f;
47 accx
= ((accx
& 1) << 4) | ((accx
& 2) >> 1) | ((accx
& 4) >> 1) |
48 (accx
& 8) | ((accx
& 16) >> 2) | ((accx
& 32) >> 5);
52 #warning no fpu trap support for this target
57 /* How to clear the accrued exceptions */
62 set_fsr((_get_fsr_raw() & ~0x3e0));
70 #warning no fpu trap support for this target
74 /* How to map SPARC FSR onto the host */
80 _set_fsr_raw(fsr
& ~0x0f800000);
92 rawfsr
|= (fsr
<< 10) | 0x3ff;
95 #warning no fpu trap support for this target
100 /* Host dependent support functions */
108 .global __set_fsr_raw,_set_fsr_raw
119 .global __get_fsr_raw
132 /* both these align statements were 16, not 8 */
138 .globl _get_sw,__get_sw
150 .globl _get_cw,__get_cw
167 #warning no fpu trap support for this target