Patchwork [3/3] linux-user: cleanup force_sig() calls

login
register
mail settings
Submitter riku.voipio@nokia.com
Date Dec. 4, 2009, 1:16 p.m.
Message ID <ee3ddd4892c108ae6a1a9f15e10481a9fd6b83f9.1259931926.git.riku.voipio@nokia.com>
Download mbox | patch
Permalink /patch/40374/
State New
Headers show

Comments

riku.voipio@nokia.com - Dec. 4, 2009, 1:16 p.m.
From: Riku Voipio <riku.voipio@nokia.com>

Force_sig should be always called with TARGET_ signals.
Not that it really matters with SEGV, so this patch is
just for cleanup and improving consistency.

Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
---
 linux-user/signal.c |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

Patch

diff --git a/linux-user/signal.c b/linux-user/signal.c
index df189c3..b0faf2e 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -366,19 +366,19 @@  static inline void free_sigqueue(CPUState *env, struct sigqueue *q)
 }
 
 /* abort execution with signal */
-static void QEMU_NORETURN force_sig(int sig)
+static void QEMU_NORETURN force_sig(int target_sig)
 {
     TaskState *ts = (TaskState *)thread_env->opaque;
     int host_sig, core_dumped = 0;
     struct sigaction act;
-    host_sig = target_to_host_signal(sig);
-    gdb_signalled(thread_env, sig);
+    host_sig = target_to_host_signal(target_sig);
+    gdb_signalled(thread_env, target_sig);
 
     /* dump core if supported by target binary format */
-    if (core_dump_signal(sig) && (ts->bprm->core_dump != NULL)) {
+    if (core_dump_signal(target_sig) && (ts->bprm->core_dump != NULL)) {
         stop_all_tasks();
         core_dumped =
-            ((*ts->bprm->core_dump)(sig, thread_env) == 0);
+            ((*ts->bprm->core_dump)(target_sig, thread_env) == 0);
     }
     if (core_dumped) {
         /* we already dumped the core of target process, we don't want
@@ -388,7 +388,7 @@  static void QEMU_NORETURN force_sig(int sig)
         nodump.rlim_cur=0;
         setrlimit(RLIMIT_CORE, &nodump);
         (void) fprintf(stderr, "qemu: uncaught target signal %d (%s) - %s\n",
-            sig, strsignal(host_sig), "core dumped" );
+            target_sig, strsignal(host_sig), "core dumped" );
     }
 
     /* The proper exit code for dieing from an uncaught signal is
@@ -1487,7 +1487,7 @@  static long do_sigreturn_v1(CPUState *env)
 
 badframe:
 	unlock_user_struct(frame, frame_addr, 0);
-        force_sig(SIGSEGV /* , current */);
+        force_sig(TARGET_SIGSEGV /* , current */);
 	return 0;
 }
 
@@ -1539,7 +1539,7 @@  static long do_sigreturn_v2(CPUState *env)
 
 badframe:
 	unlock_user_struct(frame, frame_addr, 0);
-        force_sig(SIGSEGV /* , current */);
+        force_sig(TARGET_SIGSEGV /* , current */);
 	return 0;
 }
 
@@ -1589,7 +1589,7 @@  static long do_rt_sigreturn_v1(CPUState *env)
 
 badframe:
 	unlock_user_struct(frame, frame_addr, 0);
-        force_sig(SIGSEGV /* , current */);
+        force_sig(TARGET_SIGSEGV /* , current */);
 	return 0;
 }
 
@@ -1618,7 +1618,7 @@  static long do_rt_sigreturn_v2(CPUState *env)
 
 badframe:
 	unlock_user_struct(frame, frame_addr, 0);
-        force_sig(SIGSEGV /* , current */);
+        force_sig(TARGET_SIGSEGV /* , current */);
 	return 0;
 }
 
@@ -2160,7 +2160,7 @@  void sparc64_set_context(CPUSPARCState *env)
     return;
  do_sigsegv:
     unlock_user_struct(ucp, ucp_addr, 0);
-    force_sig(SIGSEGV);
+    force_sig(TARGET_SIGSEGV);
 }
 
 void sparc64_get_context(CPUSPARCState *env)
@@ -2254,7 +2254,7 @@  void sparc64_get_context(CPUSPARCState *env)
     return;
  do_sigsegv:
     unlock_user_struct(ucp, ucp_addr, 1);
-    force_sig(SIGSEGV);
+    force_sig(TARGET_SIGSEGV);
 }
 #endif
 #elif defined(TARGET_ABI_MIPSN64)
@@ -2908,7 +2908,7 @@  static void setup_frame(int sig, struct target_sigaction *ka,
 
 give_sigsegv:
     unlock_user_struct(frame, frame_addr, 1);
-    force_sig(SIGSEGV);
+    force_sig(TARGET_SIGSEGV);
 }
 
 static void setup_rt_frame(int sig, struct target_sigaction *ka,
@@ -2971,7 +2971,7 @@  static void setup_rt_frame(int sig, struct target_sigaction *ka,
 
 give_sigsegv:
     unlock_user_struct(frame, frame_addr, 1);
-    force_sig(SIGSEGV);
+    force_sig(TARGET_SIGSEGV);
 }
 
 long do_sigreturn(CPUState *regs)
@@ -3850,7 +3850,7 @@  sigsegv:
     unlock_user_struct(frame, frame_addr, 1);
     if (logfile)
         fprintf (logfile, "segfaulting from setup_frame\n");
-    force_sig(SIGSEGV);
+    force_sig(TARGET_SIGSEGV);
 }
 
 static void setup_rt_frame(int sig, struct target_sigaction *ka,
@@ -3919,7 +3919,7 @@  sigsegv:
     unlock_user_struct(rt_sf, rt_sf_addr, 1);
     if (logfile)
         fprintf (logfile, "segfaulting from setup_rt_frame\n");
-    force_sig(SIGSEGV);
+    force_sig(TARGET_SIGSEGV);
 
 }
 
@@ -3961,7 +3961,7 @@  sigsegv:
     unlock_user_struct(sc, sc_addr, 1);
     if (logfile)
         fprintf (logfile, "segfaulting from do_sigreturn\n");
-    force_sig(SIGSEGV);
+    force_sig(TARGET_SIGSEGV);
     return 0;
 }
 
@@ -4024,7 +4024,7 @@  sigsegv:
     unlock_user_struct(rt_sf, rt_sf_addr, 1);
     if (logfile)
         fprintf (logfile, "segfaulting from do_rt_sigreturn\n");
-    force_sig(SIGSEGV);
+    force_sig(TARGET_SIGSEGV);
     return 0;
 }
 
@@ -4194,7 +4194,7 @@  static void setup_frame(int sig, struct target_sigaction *ka,
 
 give_sigsegv:
     unlock_user_struct(frame, frame_addr, 1);
-    force_sig(SIGSEGV);
+    force_sig(TARGET_SIGSEGV);
 }
 
 static inline int target_rt_setup_ucontext(struct target_ucontext *uc,
@@ -4336,7 +4336,7 @@  static void setup_rt_frame(int sig, struct target_sigaction *ka,
 
 give_sigsegv:
     unlock_user_struct(frame, frame_addr, 1);
-    force_sig(SIGSEGV);
+    force_sig(TARGET_SIGSEGV);
 }
 
 long do_sigreturn(CPUState *env)