utility.hh (9765:da0e0df0ba97) utility.hh (9880:3fda7e22041b)
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 129 unchanged lines hidden (view full) ---

138 /**
139 * Extract the bit string representing a double value.
140 */
141 inline uint64_t getDoubleBits(double val) {
142 return *(uint64_t *)(&val);
143 }
144
145 /**
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 129 unchanged lines hidden (view full) ---

138 /**
139 * Extract the bit string representing a double value.
140 */
141 inline uint64_t getDoubleBits(double val) {
142 return *(uint64_t *)(&val);
143 }
144
145 /**
146 * Convert an x87 tag word to abridged tag format.
147 *
148 * Convert from the x87 tag representation to the tag abridged
149 * representation used in the FXSAVE area. The classic format uses
150 * 2 bits per stack position to indicate if a position is valid,
151 * zero, special, or empty. The abridged format only stores
152 * whether a position is empty or not.
153 *
154 * @param ftw Tag word in classic x87 format.
155 * @return Tag word in the abridged format.
156 */
157 uint8_t convX87TagsToXTags(uint16_t ftw);
158
159 /**
160 * Convert an x87 xtag word to normal tags format.
161 *
162 * Convert from the abridged x87 tag representation used in the
163 * FXSAVE area to a full x87 tag. The classic format uses 2 bits
164 * per stack position to indicate if a position is valid, zero,
165 * special, or empty. The abridged format only stores whether a
166 * position is empty or not.
167 *
168 * @todo Reconstruct the correct state of stack positions instead
169 * of just valid/invalid.
170 *
171 * @param ftwx Tag word in the abridged format.
172 * @return Tag word in classic x87 format.
173 */
174 uint16_t convX87XTagsToTags(uint8_t ftwx);
175
176 /**
146 * Generate and updated x87 tag register after a push/pop
147 * operation.
148 *
149 * @note There is currently no support for setting other tags than
150 * valid and invalid. A real x87 will set the tag value to zero or
151 * special for some special floating point values.
152 *
153 * @param ftw Current value of the FTW register.
154 * @param top Current x87 TOP value.
155 * @param spm Stack displacement.
156 * @return New value of the FTW register.
157 */
158 uint16_t genX87Tags(uint16_t ftw, uint8_t top, int8_t spm);
159}
160
161#endif // __ARCH_X86_UTILITY_HH__
177 * Generate and updated x87 tag register after a push/pop
178 * operation.
179 *
180 * @note There is currently no support for setting other tags than
181 * valid and invalid. A real x87 will set the tag value to zero or
182 * special for some special floating point values.
183 *
184 * @param ftw Current value of the FTW register.
185 * @param top Current x87 TOP value.
186 * @param spm Stack displacement.
187 * @return New value of the FTW register.
188 */
189 uint16_t genX87Tags(uint16_t ftw, uint8_t top, int8_t spm);
190}
191
192#endif // __ARCH_X86_UTILITY_HH__