qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

fpu: move inline helpers into a separate header

There are a bunch of users of the inline helpers who do not need
access to the entire softfloat API. Move those inline helpers into a
new header file which can be included without bringing in the rest of
the world.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

+133 -62
+132
include/fpu/softfloat-helpers.h
··· 1 + /* 2 + * QEMU float support - standalone helpers 3 + * 4 + * This is provided for files that don't need the access to the full 5 + * set of softfloat functions. Typically this is cpu initialisation 6 + * code which wants to set default rounding and exceptions modes. 7 + * 8 + * The code in this source file is derived from release 2a of the SoftFloat 9 + * IEC/IEEE Floating-point Arithmetic Package. Those parts of the code (and 10 + * some later contributions) are provided under that license, as detailed below. 11 + * It has subsequently been modified by contributors to the QEMU Project, 12 + * so some portions are provided under: 13 + * the SoftFloat-2a license 14 + * the BSD license 15 + * GPL-v2-or-later 16 + * 17 + * Any future contributions to this file after December 1st 2014 will be 18 + * taken to be licensed under the Softfloat-2a license unless specifically 19 + * indicated otherwise. 20 + */ 21 + 22 + /* 23 + =============================================================================== 24 + This C header file is part of the SoftFloat IEC/IEEE Floating-point 25 + Arithmetic Package, Release 2a. 26 + 27 + Written by John R. Hauser. This work was made possible in part by the 28 + International Computer Science Institute, located at Suite 600, 1947 Center 29 + Street, Berkeley, California 94704. Funding was partially provided by the 30 + National Science Foundation under grant MIP-9311980. The original version 31 + of this code was written as part of a project to build a fixed-point vector 32 + processor in collaboration with the University of California at Berkeley, 33 + overseen by Profs. Nelson Morgan and John Wawrzynek. More information 34 + is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/ 35 + arithmetic/SoftFloat.html'. 36 + 37 + THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort 38 + has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT 39 + TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO 40 + PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY 41 + AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. 42 + 43 + Derivative works are acceptable, even for commercial purposes, so long as 44 + (1) they include prominent notice that the work is derivative, and (2) they 45 + include prominent notice akin to these four paragraphs for those parts of 46 + this code that are retained. 47 + 48 + =============================================================================== 49 + */ 50 + 51 + #ifndef _SOFTFLOAT_HELPERS_H_ 52 + #define _SOFTFLOAT_HELPERS_H_ 53 + 54 + #include "fpu/softfloat-types.h" 55 + 56 + static inline void set_float_detect_tininess(int val, float_status *status) 57 + { 58 + status->float_detect_tininess = val; 59 + } 60 + 61 + static inline void set_float_rounding_mode(int val, float_status *status) 62 + { 63 + status->float_rounding_mode = val; 64 + } 65 + 66 + static inline void set_float_exception_flags(int val, float_status *status) 67 + { 68 + status->float_exception_flags = val; 69 + } 70 + 71 + static inline void set_floatx80_rounding_precision(int val, 72 + float_status *status) 73 + { 74 + status->floatx80_rounding_precision = val; 75 + } 76 + 77 + static inline void set_flush_to_zero(flag val, float_status *status) 78 + { 79 + status->flush_to_zero = val; 80 + } 81 + 82 + static inline void set_flush_inputs_to_zero(flag val, float_status *status) 83 + { 84 + status->flush_inputs_to_zero = val; 85 + } 86 + 87 + static inline void set_default_nan_mode(flag val, float_status *status) 88 + { 89 + status->default_nan_mode = val; 90 + } 91 + 92 + static inline void set_snan_bit_is_one(flag val, float_status *status) 93 + { 94 + status->snan_bit_is_one = val; 95 + } 96 + 97 + static inline int get_float_detect_tininess(float_status *status) 98 + { 99 + return status->float_detect_tininess; 100 + } 101 + 102 + static inline int get_float_rounding_mode(float_status *status) 103 + { 104 + return status->float_rounding_mode; 105 + } 106 + 107 + static inline int get_float_exception_flags(float_status *status) 108 + { 109 + return status->float_exception_flags; 110 + } 111 + 112 + static inline int get_floatx80_rounding_precision(float_status *status) 113 + { 114 + return status->floatx80_rounding_precision; 115 + } 116 + 117 + static inline flag get_flush_to_zero(float_status *status) 118 + { 119 + return status->flush_to_zero; 120 + } 121 + 122 + static inline flag get_flush_inputs_to_zero(float_status *status) 123 + { 124 + return status->flush_inputs_to_zero; 125 + } 126 + 127 + static inline flag get_default_nan_mode(float_status *status) 128 + { 129 + return status->default_nan_mode; 130 + } 131 + 132 + #endif /* _SOFTFLOAT_HELPERS_H_ */
+1 -62
include/fpu/softfloat.h
··· 93 93 }; 94 94 95 95 #include "fpu/softfloat-types.h" 96 - 97 - static inline void set_float_detect_tininess(int val, float_status *status) 98 - { 99 - status->float_detect_tininess = val; 100 - } 101 - static inline void set_float_rounding_mode(int val, float_status *status) 102 - { 103 - status->float_rounding_mode = val; 104 - } 105 - static inline void set_float_exception_flags(int val, float_status *status) 106 - { 107 - status->float_exception_flags = val; 108 - } 109 - static inline void set_floatx80_rounding_precision(int val, 110 - float_status *status) 111 - { 112 - status->floatx80_rounding_precision = val; 113 - } 114 - static inline void set_flush_to_zero(flag val, float_status *status) 115 - { 116 - status->flush_to_zero = val; 117 - } 118 - static inline void set_flush_inputs_to_zero(flag val, float_status *status) 119 - { 120 - status->flush_inputs_to_zero = val; 121 - } 122 - static inline void set_default_nan_mode(flag val, float_status *status) 123 - { 124 - status->default_nan_mode = val; 125 - } 126 - static inline void set_snan_bit_is_one(flag val, float_status *status) 127 - { 128 - status->snan_bit_is_one = val; 129 - } 130 - static inline int get_float_detect_tininess(float_status *status) 131 - { 132 - return status->float_detect_tininess; 133 - } 134 - static inline int get_float_rounding_mode(float_status *status) 135 - { 136 - return status->float_rounding_mode; 137 - } 138 - static inline int get_float_exception_flags(float_status *status) 139 - { 140 - return status->float_exception_flags; 141 - } 142 - static inline int get_floatx80_rounding_precision(float_status *status) 143 - { 144 - return status->floatx80_rounding_precision; 145 - } 146 - static inline flag get_flush_to_zero(float_status *status) 147 - { 148 - return status->flush_to_zero; 149 - } 150 - static inline flag get_flush_inputs_to_zero(float_status *status) 151 - { 152 - return status->flush_inputs_to_zero; 153 - } 154 - static inline flag get_default_nan_mode(float_status *status) 155 - { 156 - return status->default_nan_mode; 157 - } 96 + #include "fpu/softfloat-helpers.h" 158 97 159 98 /*---------------------------------------------------------------------------- 160 99 | Routine to raise any or all of the software IEC/IEEE floating-point