* [Qemu-devel] [PATCH v2] linux-user: Handle microMIPS encoding when processing trap exceptions
@ 2013-07-19 14:47 Kwok Cheung Yeung
2013-07-19 14:52 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Kwok Cheung Yeung @ 2013-07-19 14:47 UTC (permalink / raw)
To: peter.maydell, qemu-devel; +Cc: Kwok Cheung Yeung, riku.voipio, aurelien
Decode trap instructions during the handling of an EXCP_TRAP according to
the current ISA mode.
Signed-off-by: Kwok Cheung Yeung <kcy@codesourcery.com>
---
linux-user/main.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
v2: Read microMIPS instructions sequentially as 16-bit values to avoid
endianess issues. Add braces to if statement to conform to formatting
standards.
diff --git a/linux-user/main.c b/linux-user/main.c
index 7f15d3d..7faa945 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2372,14 +2372,30 @@ done_syscall:
abi_ulong trap_instr;
unsigned int code = 0;
- ret = get_user_ual(trap_instr, env->active_tc.PC);
+ if (env->hflags & MIPS_HFLAG_M16) {
+ /* microMIPS mode */
+ abi_ulong instr[2];
+
+ ret = get_user_u16(instr[0], env->active_tc.PC) ||
+ get_user_u16(instr[1], env->active_tc.PC + 2);
+
+ trap_instr = (instr[0] << 16) | instr[1];
+ } else {
+ ret = get_user_ual(trap_instr, env->active_tc.PC);
+ }
+
if (ret != 0) {
goto error;
}
/* The immediate versions don't provide a code. */
if (!(trap_instr & 0xFC000000)) {
- code = ((trap_instr >> 6) & ((1 << 10) - 1));
+ if (env->hflags & MIPS_HFLAG_M16) {
+ /* microMIPS mode */
+ code = ((trap_instr >> 12) & ((1 << 4) - 1));
+ } else {
+ code = ((trap_instr >> 6) & ((1 << 10) - 1));
+ }
}
if (do_break(env, &info, code) != 0) {
--
1.8.3.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] linux-user: Handle microMIPS encoding when processing trap exceptions
2013-07-19 14:47 [Qemu-devel] [PATCH v2] linux-user: Handle microMIPS encoding when processing trap exceptions Kwok Cheung Yeung
@ 2013-07-19 14:52 ` Peter Maydell
2013-07-19 15:09 ` Kwok Cheung Yeung
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2013-07-19 14:52 UTC (permalink / raw)
To: Kwok Cheung Yeung; +Cc: riku.voipio, qemu-devel, aurelien
On 19 July 2013 15:47, Kwok Cheung Yeung <kcy@codesourcery.com> wrote:
> Decode trap instructions during the handling of an EXCP_TRAP according to
> the current ISA mode.
>
> Signed-off-by: Kwok Cheung Yeung <kcy@codesourcery.com>
> ---
> linux-user/main.c | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> v2: Read microMIPS instructions sequentially as 16-bit values to avoid
> endianess issues. Add braces to if statement to conform to formatting
> standards.
This code looks OK but last time round I asked about
EXCP_BREAK -- why doesn't that also need to change?
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] linux-user: Handle microMIPS encoding when processing trap exceptions
2013-07-19 14:52 ` Peter Maydell
@ 2013-07-19 15:09 ` Kwok Cheung Yeung
0 siblings, 0 replies; 3+ messages in thread
From: Kwok Cheung Yeung @ 2013-07-19 15:09 UTC (permalink / raw)
To: Peter Maydell; +Cc: riku.voipio, qemu-devel, aurelien
On 19/07/2013 3:52 PM, Peter Maydell wrote:
> On 19 July 2013 15:47, Kwok Cheung Yeung <kcy@codesourcery.com> wrote:
>> Decode trap instructions during the handling of an EXCP_TRAP according to
>> the current ISA mode.
>>
>> Signed-off-by: Kwok Cheung Yeung <kcy@codesourcery.com>
>> ---
>> linux-user/main.c | 20 ++++++++++++++++++--
>> 1 file changed, 18 insertions(+), 2 deletions(-)
>>
>> v2: Read microMIPS instructions sequentially as 16-bit values to avoid
>> endianess issues. Add braces to if statement to conform to formatting
>> standards.
>
> This code looks OK but last time round I asked about
> EXCP_BREAK -- why doesn't that also need to change?
>
This patch was intended to fix the handling of floating-point exceptions while
running the GCC unit tests (gcc.c-torture/execute/20101011-1.c) on microMIPS,
which only requires EXCP_TRAP to work properly. I'll post a version with
EXCP_BREAK fixed shortly.
Thanks
Kwok
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-19 15:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-19 14:47 [Qemu-devel] [PATCH v2] linux-user: Handle microMIPS encoding when processing trap exceptions Kwok Cheung Yeung
2013-07-19 14:52 ` Peter Maydell
2013-07-19 15:09 ` Kwok Cheung Yeung
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).