Skip to contentSkip to conversation

linux-user: correct handling of break exception for MIPS

PATCH In review Petar Jovanovic 3 participants 3 messages Feb 28, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: correct handling of break exception for MIPS

From: Petar Jovanovic <[email protected]>

Exception with break instruction has not been correctly propagated as SIGTRAP. This resolves crash issues with examples that use break instruction on MIPS.

---
 linux-user/main.c |    4 ++++
 1 file changed, 4 insertions(+)
linux-user/main.c +4 -0
index 9192977..c19e7fb 100644
@@ -2384,6 +2384,10 @@ static int do_break(CPUMIPSState *env, target_siginfo_t *info,
         ret = 0;
         break;
     default:
+        info->si_signo = TARGET_SIGTRAP;
+        info->si_errno = 0;
+        queue_signal(env, info->si_signo, &*info);
+        ret = 0;
         break;
     }
 
Signature · 1 line
1.7.9.5
#1 lore raw

Hi,

Am 28.02.2014 15:25, schrieb Petar Jovanovic:

Quoted 16 lines

From: Petar Jovanovic <[email protected]>

Exception with break instruction has not been correctly propagated as SIGTRAP. This resolves crash issues with examples that use break instruction on MIPS.

---
 linux-user/main.c |    4 ++++
 1 file changed, 4 insertions(+)
linux-user/main.c +0 -0
index 9192977..c19e7fb 100644

linux-user/main.c static int do_break(CPUMIPSState *env, target_siginfo_t *info, · line 2389

Quoted 6 lines
linux-user/main.c +3 -0
@@ -2384,6 +2384,10 @@ static int do_break(CPUMIPSState *env, target_siginfo_t *info,
         ret = 0;
         break;
     default:
+        info->si_signo = TARGET_SIGTRAP;
+        info->si_errno = 0;
+        queue_signal(env, info->si_signo, &*info);

This looks strange. Isn't &*info == info?

Other than that seems to touch only MIPS code and looks sensible.

Regards,
Andreas

Quoted 4 lines
linux-user/main.c +1 -0
+        ret = 0;
         break;
     }
 
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
Quoted 1 line

This looks strange. Isn't &*info == info?

It is. Just a few lines above, queue_signal is called in the same manner for style/preference reasons I presume, so this patch follows the pattern. Otherwise, it would require to change the other call site too.

Regards,
Petar

________________________________________
From: Andreas Färber [[email protected]]
Sent: Friday, February 28, 2014 4:30 PM
To: Petar Jovanovic; [email protected]
Cc: [email protected]; Petar Jovanovic; [email protected]
Subject: Re: [Qemu-devel] [PATCH] linux-user: correct handling of break exception for MIPS

Hi,

Am 28.02.2014 15:25, schrieb Petar Jovanovic:

Quoted 16 lines

From: Petar Jovanovic <[email protected]>

Exception with break instruction has not been correctly propagated as SIGTRAP. This resolves crash issues with examples that use break instruction on MIPS.

---
 linux-user/main.c |    4 ++++
 1 file changed, 4 insertions(+)
linux-user/main.c +0 -0
index 9192977..c19e7fb 100644

linux-user/main.c static int do_break(CPUMIPSState *env, target_siginfo_t *info, · line 2389

Quoted 6 lines
linux-user/main.c +3 -0
@@ -2384,6 +2384,10 @@ static int do_break(CPUMIPSState *env, target_siginfo_t *info,
         ret = 0;
         break;
     default:
+        info->si_signo = TARGET_SIGTRAP;
+        info->si_errno = 0;
+        queue_signal(env, info->si_signo, &*info);

This looks strange. Isn't &*info == info?

Other than that seems to touch only MIPS code and looks sensible.

Regards,
Andreas

linux-user/main.c static int do_break(CPUMIPSState *env, target_siginfo_t *info, · line 2393

Quoted 4 lines
linux-user/main.c +1 -0
+        ret = 0;
         break;
     }
 

--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg