From: Jamie Lokier <jamie@shareable.org>
To: "TAKEDA, toshiya" <t-takeda@m1.interq.or.jp>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH V4 03/18] target-i386: support a20 mask for NEC PC-9812
Date: Tue, 22 Dec 2009 22:05:56 +0000 [thread overview]
Message-ID: <20091222220556.GA19806@shareable.org> (raw)
In-Reply-To: <200912221740.AA00206@YOUR-BD18D6DD63.m1.interq.or.jp>
TAKEDA, toshiya wrote:
> @@ -940,7 +966,15 @@ void cpu_x86_set_a20(CPUX86State *env, int a20_state)
> /* when a20 is changed, all the MMU mappings are invalid, so
> we must flush everything */
> tlb_flush(env, 1);
> - env->a20_mask = ~(1 << 20) | (a20_state << 20);
> + if (env->private_features & PRIVATE_FEATURE_PC98_A20MASK) {
> + if (a20_state) {
> + env->a20_mask = ~0x0;
> + } else {
> + env->a20_mask = 0xfffff;
> + }
> + } else {
> + env->a20_mask = ~(1 << 20) | (a20_state << 20);
> + }
> }
> }
It seems strange to mix different styles in that way. How about this,
which I think makes the PC98 vs. PC difference clearer too:
if (a20_state) {
env->a20_mask = ~0x0;
} else if (env->private_features & PRIVATE_FEATURE_PC98_A20MASK) {
env->a20_mask = (1 << 20) - 1; /* A20 masks all bits >= 20. */
} else {
env->a20_mask = ~(1 << 20); /* A20 masks only bit 20. */
}
(When I say clearer, it's not _that_ obvious that these or the
original expressions store the right thing into "uint64
env->a20_mask", given these expressions are all of type "int", but, in
fact, they do owing to C type promotion rules. Same for the save/load
state).
-- Jamie
prev parent reply other threads:[~2009-12-22 22:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-22 17:40 [Qemu-devel] [PATCH V4 03/18] target-i386: support a20 mask for NEC PC-9812 TAKEDA, toshiya
2009-12-22 22:05 ` Jamie Lokier [this message]
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=20091222220556.GA19806@shareable.org \
--to=jamie@shareable.org \
--cc=qemu-devel@nongnu.org \
--cc=t-takeda@m1.interq.or.jp \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).