Commit e163bca720425289b812e5e2c049e6139608c2ea

Authored by bellard
1 parent 8c6939c0

weird arm double format support


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@219 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 31 additions and 3 deletions
exec-i386.h
... ... @@ -243,11 +243,14 @@ void raise_interrupt(int intno, int is_int, int error_code,
243 243 unsigned int next_eip);
244 244 void raise_exception_err(int exception_index, int error_code);
245 245 void raise_exception(int exception_index);
  246 +void helper_divl_EAX_T0(uint32_t eip);
  247 +void helper_idivl_EAX_T0(uint32_t eip);
  248 +void helper_cmpxchg8b(void);
246 249 void helper_cpuid(void);
  250 +void helper_rdtsc(void);
247 251 void helper_lsl(void);
248 252 void helper_lar(void);
249 253  
250   -
251 254 #ifdef USE_X86LDOUBLE
252 255 /* use long double functions */
253 256 #define lrint lrintl
... ... @@ -287,6 +290,13 @@ extern CPU86_LDouble rint(CPU86_LDouble x);
287 290  
288 291 #define MAXTAN 9223372036854775808.0
289 292  
  293 +#ifdef __arm__
  294 +/* we have no way to do correct rounding - a FPU emulator is needed */
  295 +#define FE_DOWNWARD FE_TONEAREST
  296 +#define FE_UPWARD FE_TONEAREST
  297 +#define FE_TOWARDZERO FE_TONEAREST
  298 +#endif
  299 +
290 300 #ifdef USE_X86LDOUBLE
291 301  
292 302 /* only for x86 */
... ... @@ -308,9 +318,10 @@ typedef union {
308 318  
309 319 #else
310 320  
  321 +/* NOTE: arm is horrible as double 32 bit words are stored in big endian ! */
311 322 typedef union {
312 323 double d;
313   -#ifndef WORDS_BIGENDIAN
  324 +#if !defined(WORDS_BIGENDIAN) && !defined(__arm__)
314 325 struct {
315 326 uint32_t lower;
316 327 int32_t upper;
... ... @@ -321,7 +332,9 @@ typedef union {
321 332 uint32_t lower;
322 333 } l;
323 334 #endif
  335 +#ifndef __arm__
324 336 int64_t ll;
  337 +#endif
325 338 } CPU86_LDoubleU;
326 339  
327 340 /* the following deal with IEEE double-precision numbers */
... ... @@ -329,7 +342,11 @@ typedef union {
329 342 #define EXPBIAS 1023
330 343 #define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
331 344 #define SIGND(fp) ((fp.l.upper) & 0x80000000)
  345 +#ifdef __arm__
  346 +#define MANTD(fp) (fp.l.lower | ((uint64_t)(fp.l.upper & ((1 << 20) - 1)) << 32))
  347 +#else
332 348 #define MANTD(fp) (fp.ll & ((1LL << 52) - 1))
  349 +#endif
333 350 #define BIASEXPONENT(fp) fp.l.upper = (fp.l.upper & ~(0x7ff << 20)) | (EXPBIAS << 20)
334 351 #endif
335 352  
... ... @@ -350,12 +367,20 @@ static inline CPU86_LDouble helper_fldt(uint8_t *ptr)
350 367 {
351 368 CPU86_LDoubleU temp;
352 369 int upper, e;
  370 + uint64_t ll;
  371 +
353 372 /* mantissa */
354 373 upper = lduw(ptr + 8);
355 374 /* XXX: handle overflow ? */
356 375 e = (upper & 0x7fff) - 16383 + EXPBIAS; /* exponent */
357 376 e |= (upper >> 4) & 0x800; /* sign */
358   - temp.ll = ((ldq(ptr) >> 11) & ((1LL << 52) - 1)) | ((uint64_t)e << 52);
  377 + ll = (ldq(ptr) >> 11) & ((1LL << 52) - 1);
  378 +#ifdef __arm__
  379 + temp.l.upper = (e << 20) | (ll >> 32);
  380 + temp.l.lower = ll;
  381 +#else
  382 + temp.ll = ll | ((uint64_t)e << 52);
  383 +#endif
359 384 return temp.d;
360 385 }
361 386  
... ... @@ -363,6 +388,7 @@ static inline void helper_fstt(CPU86_LDouble f, uint8_t *ptr)
363 388 {
364 389 CPU86_LDoubleU temp;
365 390 int e;
  391 +
366 392 temp.d = f;
367 393 /* mantissa */
368 394 stq(ptr, (MANTD(temp) << 11) | (1LL << 63));
... ... @@ -373,6 +399,8 @@ static inline void helper_fstt(CPU86_LDouble f, uint8_t *ptr)
373 399 }
374 400 #endif
375 401  
  402 +const CPU86_LDouble f15rk[7];
  403 +
376 404 void helper_fldt_ST0_A0(void);
377 405 void helper_fstt_ST0_A0(void);
378 406 void helper_fbld_ST0_A0(void);
... ...