From: Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH/RFC] overflow and register size mismatch in sh4-softmmu
Date: Sun, 11 Nov 2007 07:11:13 -0600 [thread overview]
Message-ID: <20071111131113.GC25322@tapir> (raw)
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;
}
next reply other threads:[~2007-11-11 13:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-11 13:11 Carlo Marcelo Arenas Belon [this message]
2007-11-11 13:33 ` [Qemu-devel] [PATCH/RFC] overflow and register size mismatch in sh4-softmmu Paul Brook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071111131113.GC25322@tapir \
--to=carenas@sajinet.com.pe \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.