[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH/RFC] overflow and register size mismatch in sh4-soft
From: |
Carlo Marcelo Arenas Belon |
Subject: |
[Qemu-devel] [PATCH/RFC] overflow and register size mismatch in sh4-softmmu |
Date: |
Sun, 11 Nov 2007 07:11:13 -0600 |
User-agent: |
Mutt/1.4.1i |
as shown by the following warning when compiling HEAD :
qemu/target-sh4/translate.c: In function `cpu_sh4_reset':
qemu/target-sh4/translate.c:139: warning: overflow in implicit constant
conversion
the problem was introduced in version 1.11 of that file and is being triggered
by the fact that the following assignment :
env->fp_status.float_rounding_mode = float_round_to_zero;
is trying to assign the value of float_round_to_zero which is defined in
softfloat-native.h as :
enum {
float_round_nearest_even = FE_TONEAREST,
float_round_down = FE_DOWNWARD,
float_round_up = FE_UPWARD,
float_round_to_zero = FE_TOWARDZERO
};
where FE_TOWARDZERO = 0xc00 and sizeof(env->fp_status.float_rounding_mode) ==
1 as shown by :
typedef struct float_status {
signed char float_rounding_mode;
signed char floatx80_rounding_precision;
} float_status;
float_status fp_status;
the following patch changes the logic to use a helper function just like other
targets and has been tested in x86 and amd64 to compile correctly, but I have
no way to test it and should be ideally validated by anyone that knows the sh4
emulation better and has a way to confirm that it is functionally equivalent.
Carlo
---
Index: target-sh4/translate.c
===================================================================
RCS file: /sources/qemu/qemu/target-sh4/translate.c,v
retrieving revision 1.19
diff -u -r1.19 translate.c
--- target-sh4/translate.c 10 Nov 2007 15:15:54 -0000 1.19
+++ target-sh4/translate.c 11 Nov 2007 13:01:31 -0000
@@ -136,7 +136,7 @@
env->fp_status.float_rounding_mode = float_round_nearest_even; /* ?! */
#else
env->fpscr = 0x00040001; /* CPU reset value according to SH4 manual */
- env->fp_status.float_rounding_mode = float_round_to_zero;
+ set_float_rounding_mode(float_round_to_zero, &env->fp_status);
#endif
env->mmucr = 0;
}
- [Qemu-devel] [PATCH/RFC] overflow and register size mismatch in sh4-softmmu,
Carlo Marcelo Arenas Belon <=