From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH][MIPS] Fix [ls][wd][lr] instructions
Date: Wed, 26 Sep 2007 11:47:10 +0200 [thread overview]
Message-ID: <46FA2A9E.7050105@bellard.org> (raw)
In-Reply-To: <20070926092330.GA29659@hall.aurel32.net>
Aurelien Jarno wrote:
> Hi,
>
> As written in the MIPS TODO file, the lwl, lwr, ldl, ldr, swl, swr,
> sdl and sdr instructions are not correctly implemented. In case of
> exception the BadVAddr register gets the aligned address instead of the
> unaligned original address.
>
> In addition to that, the store instructions are generating the wrong
> exception, AdEl instead of AdEs, because the current implementation
> first do a load.
>
> The patch below fixes that by accessing the bytes one by one, starting
> by the unaligned original address.
>
> Bye,
> Aurelien
[...]
BTW, you could simplify a lot the implementation :
switch (GET_LMASK(T0)) {
case 0:
T0 = (int32_t)tmp;
break;
case 1:
T0 = (int32_t)((tmp << 8) | (T1 & 0x000000FF));
break;
case 2:
T0 = (int32_t)((tmp << 16) | (T1 & 0x0000FFFF));
break;
case 3:
T0 = (int32_t)((tmp << 24) | (T1 & 0x00FFFFFF));
break;
}
->
v = GET_LMASK(T0);
if (v == 0) {
T0 = tmp;
} else {
TO = (int32_t)((tmp << (8 * v)) | (T1 & ((1 << (v * 8)) - 1)));
}
Fabrice.
next prev parent reply other threads:[~2007-09-26 9:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-26 9:23 [Qemu-devel] [PATCH][MIPS] Fix [ls][wd][lr] instructions Aurelien Jarno
2007-09-26 9:47 ` Fabrice Bellard [this message]
2007-09-26 10:45 ` Aurelien Jarno
2007-09-26 9:52 ` Fabrice Bellard
2007-09-26 10:45 ` Aurelien Jarno
2007-10-06 11:19 ` Aurelien Jarno
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=46FA2A9E.7050105@bellard.org \
--to=fabrice@bellard.org \
--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 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).