All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings
@ 2015-01-08 12:19 Peter Maydell
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 1/6] linux-user/signal.c: Remove current_exec_domain_sig() Peter Maydell
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Peter Maydell @ 2015-01-08 12:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

This patchset fixes warnings produced by clang in the linux-user code.
Mostly this is deleting or marking unused functions/data, but it
does include a genuine bugfix for Alpha.

I think that this means I have patches out on the list now for
all the clang warnings we currently generate; maybe some day soon
we can enable warnings-as-errors...

Peter Maydell (6):
  linux-user/signal.c: Remove current_exec_domain_sig()
  linux-user/alpha: Add define for NR_shmat to enable shmat syscall
  linux-user/arm/nwfpe: Delete unused aCC array
  linux-user/main.c: Call cpu_exec_start/end on all target archs
  linux-user/main.c: Mark end_exclusive() as possibly unused
  linux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_user

 linux-user/alpha/syscall_nr.h   |  4 +++
 linux-user/arm/nwfpe/fpopcode.c | 22 ---------------
 linux-user/main.c               | 20 +++++++++++++-
 linux-user/signal.c             | 59 ++++++++++++-----------------------------
 4 files changed, 40 insertions(+), 65 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 1/6] linux-user/signal.c: Remove current_exec_domain_sig()
  2015-01-08 12:19 [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings Peter Maydell
@ 2015-01-08 12:19 ` Peter Maydell
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 2/6] linux-user/alpha: Add define for NR_shmat to enable shmat syscall Peter Maydell
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Peter Maydell @ 2015-01-08 12:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

Remove the function current_exec_domain_sig(), which always returns
its argument. This was intended as a stub for supporting the kernel's
exec_domain handling, but:
 * we don't have any of the other code for execution domains
 * in the kernel this handling is architecture-specific, not generic
 * we only call this function in the x86, ppc and sh4 signal code paths,
   and the PPC one is wrong anyway because the PPC kernel doesn't
   have this signal-remapping code

So it's best to simply delete the function; any future attempt to
implement exec domains will be better served by adding the correct
code from scratch based on the kernel sources at that time.

This change also fixes some clang warnings about the function being
defined but not used for some target architectures.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/signal.c | 31 ++++++-------------------------
 1 file changed, 6 insertions(+), 25 deletions(-)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index e11b208..fa955ef 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -738,12 +738,6 @@ static inline void copy_siginfo_to_user(target_siginfo_t *tinfo,
     tswap_siginfo(tinfo, info);
 }
 
-static inline int current_exec_domain_sig(int sig)
-{
-    return /* current->exec_domain && current->exec_domain->signal_invmap
-	      && sig < 32 ? current->exec_domain->signal_invmap[sig] : */ sig;
-}
-
 #if defined(TARGET_I386) && TARGET_ABI_BITS == 32
 
 /* from the Linux kernel */
@@ -926,8 +920,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,
 	if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
 		goto give_sigsegv;
 
-    __put_user(current_exec_domain_sig(sig),
-               &frame->sig);
+    __put_user(sig, &frame->sig);
 
 	setup_sigcontext(&frame->sc, &frame->fpstate, env, set->sig[0],
                          frame_addr + offsetof(struct sigframe, fpstate));
@@ -988,7 +981,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
 	if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
 		goto give_sigsegv;
 
-    __put_user(current_exec_domain_sig(sig), &frame->sig);
+    __put_user(sig, &frame->sig);
         addr = frame_addr + offsetof(struct rt_sigframe, info);
     __put_user(addr, &frame->pinfo);
         addr = frame_addr + offsetof(struct rt_sigframe, uc);
@@ -3228,14 +3221,11 @@ static void setup_frame(int sig, struct target_sigaction *ka,
     abi_ulong frame_addr;
     int i;
     int err = 0;
-    int signal;
 
     frame_addr = get_sigframe(ka, regs->gregs[15], sizeof(*frame));
     if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
 	goto give_sigsegv;
 
-    signal = current_exec_domain_sig(sig);
-
     setup_sigcontext(&frame->sc, regs, set->sig[0]);
 
     for (i = 0; i < TARGET_NSIG_WORDS - 1; i++) {
@@ -3259,7 +3249,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,
 
     /* Set up registers for signal handler */
     regs->gregs[15] = frame_addr;
-    regs->gregs[4] = signal; /* Arg for signal handler */
+    regs->gregs[4] = sig; /* Arg for signal handler */
     regs->gregs[5] = 0;
     regs->gregs[6] = frame_addr += offsetof(typeof(*frame), sc);
     regs->pc = (unsigned long) ka->_sa_handler;
@@ -3280,14 +3270,11 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
     abi_ulong frame_addr;
     int i;
     int err = 0;
-    int signal;
 
     frame_addr = get_sigframe(ka, regs->gregs[15], sizeof(*frame));
     if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
 	goto give_sigsegv;
 
-    signal = current_exec_domain_sig(sig);
-
     copy_siginfo_to_user(&frame->info, info);
 
     /* Create the ucontext.  */
@@ -3322,7 +3309,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
 
     /* Set up registers for signal handler */
     regs->gregs[15] = frame_addr;
-    regs->gregs[4] = signal; /* Arg for signal handler */
+    regs->gregs[4] = sig; /* Arg for signal handler */
     regs->gregs[5] = frame_addr + offsetof(typeof(*frame), info);
     regs->gregs[6] = frame_addr + offsetof(typeof(*frame), uc);
     regs->pc = (unsigned long) ka->_sa_handler;
@@ -4680,7 +4667,6 @@ static void setup_frame(int sig, struct target_sigaction *ka,
     struct target_sigcontext *sc;
     target_ulong frame_addr, newsp;
     int err = 0;
-    int signal;
 #if defined(TARGET_PPC64)
     struct image_info *image = ((TaskState *)thread_cpu->opaque)->info;
 #endif
@@ -4690,8 +4676,6 @@ static void setup_frame(int sig, struct target_sigaction *ka,
         goto sigsegv;
     sc = &frame->sctx;
 
-    signal = current_exec_domain_sig(sig);
-
     __put_user(ka->_sa_handler, &sc->handler);
     __put_user(set->sig[0], &sc->oldmask);
 #if TARGET_ABI_BITS == 64
@@ -4724,7 +4708,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,
 
     /* Set up registers for signal handler.  */
     env->gpr[1] = newsp;
-    env->gpr[3] = signal;
+    env->gpr[3] = sig;
     env->gpr[4] = frame_addr + offsetof(struct target_sigframe, sctx);
 
 #if defined(TARGET_PPC64)
@@ -4765,7 +4749,6 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
     struct target_mcontext *mctx = 0;
     target_ulong rt_sf_addr, newsp = 0;
     int i, err = 0;
-    int signal;
 #if defined(TARGET_PPC64)
     struct image_info *image = ((TaskState *)thread_cpu->opaque)->info;
 #endif
@@ -4774,8 +4757,6 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
     if (!lock_user_struct(VERIFY_WRITE, rt_sf, rt_sf_addr, 1))
         goto sigsegv;
 
-    signal = current_exec_domain_sig(sig);
-
     copy_siginfo_to_user(&rt_sf->info, info);
 
     __put_user(0, &rt_sf->uc.tuc_flags);
@@ -4821,7 +4802,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
 
     /* Set up registers for signal handler.  */
     env->gpr[1] = newsp;
-    env->gpr[3] = (target_ulong) signal;
+    env->gpr[3] = (target_ulong) sig;
     env->gpr[4] = (target_ulong) h2g(&rt_sf->info);
     env->gpr[5] = (target_ulong) h2g(&rt_sf->uc);
     env->gpr[6] = (target_ulong) h2g(rt_sf);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 2/6] linux-user/alpha: Add define for NR_shmat to enable shmat syscall
  2015-01-08 12:19 [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings Peter Maydell
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 1/6] linux-user/signal.c: Remove current_exec_domain_sig() Peter Maydell
@ 2015-01-08 12:19 ` Peter Maydell
  2015-01-10 15:56   ` Peter Maydell
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 3/6] linux-user/arm/nwfpe: Delete unused aCC array Peter Maydell
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Peter Maydell @ 2015-01-08 12:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, Richard Henderson, patches

For historical reasons, the define for the shmat() syscall on Alpha is
NR_osf_shmat; however it has the same semantics as this syscall does
on all other architectures, so define TARGET_NR_shmat as well so that
QEMU's code for the syscall is enabled.

This patch brings our behaviour on the LTP shmat tests into line
with that for ARM (still not a perfect pass rate but not "this syscall
is completely broken" as we had before).

(Problem detected via a clang warning that the do_shmat() function
was unused on Alpha.)

Cc: Richard Henderson <rth@twiddle.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Possibly other _osf_ syscalls need similar defines; somebody who
cares about Alpha might like to audit?
---
 linux-user/alpha/syscall_nr.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/linux-user/alpha/syscall_nr.h b/linux-user/alpha/syscall_nr.h
index 625f301..dde8d5c 100644
--- a/linux-user/alpha/syscall_nr.h
+++ b/linux-user/alpha/syscall_nr.h
@@ -185,6 +185,10 @@
 #define TARGET_NR_osf_utsname	207
 #define TARGET_NR_lchown		208
 #define TARGET_NR_osf_shmat		209
+/* this has the usual shmat semantics so give it the name syscall.c expects
+ * so that our support for it is enabled.
+ */
+#define TARGET_NR_shmat TARGET_NR_osf_shmat
 #define TARGET_NR_shmctl		210
 #define TARGET_NR_shmdt		211
 #define TARGET_NR_shmget		212
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 3/6] linux-user/arm/nwfpe: Delete unused aCC array
  2015-01-08 12:19 [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings Peter Maydell
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 1/6] linux-user/signal.c: Remove current_exec_domain_sig() Peter Maydell
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 2/6] linux-user/alpha: Add define for NR_shmat to enable shmat syscall Peter Maydell
@ 2015-01-08 12:19 ` Peter Maydell
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 4/6] linux-user/main.c: Call cpu_exec_start/end on all target archs Peter Maydell
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Peter Maydell @ 2015-01-08 12:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

The aCC array in fpopcode.c is completely unused in QEMU; delete
it (silencing a clang warning).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/arm/nwfpe/fpopcode.c | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/linux-user/arm/nwfpe/fpopcode.c b/linux-user/arm/nwfpe/fpopcode.c
index 0dc5c9c..0ada30c 100644
--- a/linux-user/arm/nwfpe/fpopcode.c
+++ b/linux-user/arm/nwfpe/fpopcode.c
@@ -88,25 +88,3 @@ unsigned int getDestinationSize(const unsigned int opcode)
 
   return(nRc);
 }
-
-/* condition code lookup table
- index into the table is test code: EQ, NE, ... LT, GT, AL, NV
- bit position in short is condition code: NZCV */
-static const unsigned short aCC[16] = {
-    0xF0F0, // EQ == Z set
-    0x0F0F, // NE
-    0xCCCC, // CS == C set
-    0x3333, // CC
-    0xFF00, // MI == N set
-    0x00FF, // PL
-    0xAAAA, // VS == V set
-    0x5555, // VC
-    0x0C0C, // HI == C set && Z clear
-    0xF3F3, // LS == C clear || Z set
-    0xAA55, // GE == (N==V)
-    0x55AA, // LT == (N!=V)
-    0x0A05, // GT == (!Z && (N==V))
-    0xF5FA, // LE == (Z || (N!=V))
-    0xFFFF, // AL always
-    0 // NV
-};
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 4/6] linux-user/main.c: Call cpu_exec_start/end on all target archs
  2015-01-08 12:19 [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings Peter Maydell
                   ` (2 preceding siblings ...)
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 3/6] linux-user/arm/nwfpe: Delete unused aCC array Peter Maydell
@ 2015-01-08 12:19 ` Peter Maydell
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 5/6] linux-user/main.c: Mark end_exclusive() as possibly unused Peter Maydell
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Peter Maydell @ 2015-01-08 12:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

The start_exclusive() infrastructure is used on all target
architectures, even if only to do the "stop all CPUs before
dumping core" in force_sig(), so be consistent and call
cpu_exec_start/end in the main loop of every target.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/main.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/linux-user/main.c b/linux-user/main.c
index 67b0231..bbd1cfd 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -283,7 +283,9 @@ void cpu_loop(CPUX86State *env)
     target_siginfo_t info;
 
     for(;;) {
+        cpu_exec_start(cs);
         trapnr = cpu_x86_exec(env);
+        cpu_exec_end(cs);
         switch(trapnr) {
         case 0x80:
             /* linux syscall from int $0x80 */
@@ -1288,7 +1290,9 @@ void cpu_loop (CPUSPARCState *env)
     target_siginfo_t info;
 
     while (1) {
+        cpu_exec_start(cs);
         trapnr = cpu_sparc_exec (env);
+        cpu_exec_end(cs);
 
         /* Compute PSR before exposing state.  */
         if (env->cc_op != CC_OP_FLAGS) {
@@ -2656,7 +2660,9 @@ void cpu_loop(CPUOpenRISCState *env)
     int trapnr, gdbsig;
 
     for (;;) {
+        cpu_exec_start(cs);
         trapnr = cpu_exec(env);
+        cpu_exec_end(cs);
         gdbsig = 0;
 
         switch (trapnr) {
@@ -2744,7 +2750,9 @@ void cpu_loop(CPUSH4State *env)
     target_siginfo_t info;
 
     while (1) {
+        cpu_exec_start(cs);
         trapnr = cpu_sh4_exec (env);
+        cpu_exec_end(cs);
 
         switch (trapnr) {
         case 0x160:
@@ -2804,7 +2812,9 @@ void cpu_loop(CPUCRISState *env)
     target_siginfo_t info;
     
     while (1) {
+        cpu_exec_start(cs);
         trapnr = cpu_cris_exec (env);
+        cpu_exec_end(cs);
         switch (trapnr) {
         case 0xaa:
             {
@@ -2863,7 +2873,9 @@ void cpu_loop(CPUMBState *env)
     target_siginfo_t info;
     
     while (1) {
+        cpu_exec_start(cs);
         trapnr = cpu_mb_exec (env);
+        cpu_exec_end(cs);
         switch (trapnr) {
         case 0xaa:
             {
@@ -2966,7 +2978,9 @@ void cpu_loop(CPUM68KState *env)
     TaskState *ts = cs->opaque;
 
     for(;;) {
+        cpu_exec_start(cs);
         trapnr = cpu_m68k_exec(env);
+        cpu_exec_end(cs);
         switch(trapnr) {
         case EXCP_ILLEGAL:
             {
@@ -3103,7 +3117,9 @@ void cpu_loop(CPUAlphaState *env)
     abi_long sysret;
 
     while (1) {
+        cpu_exec_start(cs);
         trapnr = cpu_alpha_exec (env);
+        cpu_exec_end(cs);
 
         /* All of the traps imply a transition through PALcode, which
            implies an REI instruction has been executed.  Which means
@@ -3289,7 +3305,9 @@ void cpu_loop(CPUS390XState *env)
     target_ulong addr;
 
     while (1) {
+        cpu_exec_start(cs);
         trapnr = cpu_s390x_exec(env);
+        cpu_exec_end(cs);
         switch (trapnr) {
         case EXCP_INTERRUPT:
             /* Just indicate that signals should be handled asap.  */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 5/6] linux-user/main.c: Mark end_exclusive() as possibly unused
  2015-01-08 12:19 [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings Peter Maydell
                   ` (3 preceding siblings ...)
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 4/6] linux-user/main.c: Call cpu_exec_start/end on all target archs Peter Maydell
@ 2015-01-08 12:19 ` Peter Maydell
  2015-01-21  8:40   ` Thomas Huth
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 6/6] linux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_user Peter Maydell
  2015-01-20 14:54 ` [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings Peter Maydell
  6 siblings, 1 reply; 14+ messages in thread
From: Peter Maydell @ 2015-01-08 12:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

The function end_exclusive() isn't used on all targets; mark it as
such to avoid a clang warning.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/main.c b/linux-user/main.c
index bbd1cfd..0fda51c 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -169,7 +169,7 @@ static inline void start_exclusive(void)
 }
 
 /* Finish an exclusive operation.  */
-static inline void end_exclusive(void)
+static inline void __attribute__((unused)) end_exclusive(void)
 {
     pending_cpus = 0;
     pthread_cond_broadcast(&exclusive_resume);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 6/6] linux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_user
  2015-01-08 12:19 [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings Peter Maydell
                   ` (4 preceding siblings ...)
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 5/6] linux-user/main.c: Mark end_exclusive() as possibly unused Peter Maydell
@ 2015-01-08 12:19 ` Peter Maydell
  2015-01-20 14:54 ` [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings Peter Maydell
  6 siblings, 0 replies; 14+ messages in thread
From: Peter Maydell @ 2015-01-08 12:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

The function copy_siginfo_to_user() just calls tswap_siginfo(), so
call the latter function directly and delete the wrapper function.
The wrapper is actually misleading since it implies that the
semantics are like the kernel function with the same name which
copies the data to a guest user-space address. In fact tswap_siginfo()
just does data-structure conversion between two structures whose
addresses are host addresses (the copy to userspace is handled
in QEMU by the lock_user/unlock_user calls).

This also fixes clang complaints about the wrapper being unused
in some configs.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/signal.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index fa955ef..8065710 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -732,12 +732,6 @@ int do_sigaction(int sig, const struct target_sigaction *act,
     return ret;
 }
 
-static inline void copy_siginfo_to_user(target_siginfo_t *tinfo,
-                                       const target_siginfo_t *info)
-{
-    tswap_siginfo(tinfo, info);
-}
-
 #if defined(TARGET_I386) && TARGET_ABI_BITS == 32
 
 /* from the Linux kernel */
@@ -986,7 +980,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
     __put_user(addr, &frame->pinfo);
         addr = frame_addr + offsetof(struct rt_sigframe, uc);
     __put_user(addr, &frame->puc);
-	copy_siginfo_to_user(&frame->info, info);
+    tswap_siginfo(&frame->info, info);
 
 	/* Create the ucontext.  */
     __put_user(0, &frame->uc.tuc_flags);
@@ -1353,7 +1347,7 @@ static void target_setup_frame(int usig, struct target_sigaction *ka,
     env->pc = ka->_sa_handler;
     env->xregs[30] = return_addr;
     if (info) {
-        copy_siginfo_to_user(&frame->info, info);
+        tswap_siginfo(&frame->info, info);
         env->xregs[1] = frame_addr + offsetof(struct target_rt_sigframe, info);
         env->xregs[2] = frame_addr + offsetof(struct target_rt_sigframe, uc);
     }
@@ -1770,7 +1764,7 @@ static void setup_rt_frame_v1(int usig, struct target_sigaction *ka,
 	__put_user(info_addr, &frame->pinfo);
         uc_addr = frame_addr + offsetof(struct rt_sigframe_v1, uc);
 	__put_user(uc_addr, &frame->puc);
-	copy_siginfo_to_user(&frame->info, info);
+        tswap_siginfo(&frame->info, info);
 
 	/* Clear all the bits of the ucontext we don't use.  */
 	memset(&frame->uc, 0, offsetof(struct target_ucontext_v1, tuc_mcontext));
@@ -1808,7 +1802,7 @@ static void setup_rt_frame_v2(int usig, struct target_sigaction *ka,
 
         info_addr = frame_addr + offsetof(struct rt_sigframe_v2, info);
         uc_addr = frame_addr + offsetof(struct rt_sigframe_v2, uc);
-	copy_siginfo_to_user(&frame->info, info);
+        tswap_siginfo(&frame->info, info);
 
         setup_sigframe_v2(&frame->uc, set, env);
 
@@ -3010,7 +3004,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
 
     install_sigtramp(frame->rs_code, TARGET_NR_rt_sigreturn);
 
-    copy_siginfo_to_user(&frame->rs_info, info);
+    tswap_siginfo(&frame->rs_info, info);
 
     __put_user(0, &frame->rs_uc.tuc_flags);
     __put_user(0, &frame->rs_uc.tuc_link);
@@ -3275,7 +3269,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
     if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
 	goto give_sigsegv;
 
-    copy_siginfo_to_user(&frame->info, info);
+    tswap_siginfo(&frame->info, info);
 
     /* Create the ucontext.  */
     __put_user(0, &frame->uc.tuc_flags);
@@ -3934,7 +3928,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
     __put_user(uc_addr, &frame->puc);
 
     if (ka->sa_flags & SA_SIGINFO) {
-        copy_siginfo_to_user(&frame->info, info);
+        tswap_siginfo(&frame->info, info);
     }
 
     /*err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));*/
@@ -4182,7 +4176,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
     }
 
     qemu_log("%s: 1\n", __FUNCTION__);
-    copy_siginfo_to_user(&frame->info, info);
+    tswap_siginfo(&frame->info, info);
 
     /* Create the ucontext.  */
     __put_user(0, &frame->uc.tuc_flags);
@@ -4757,7 +4751,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
     if (!lock_user_struct(VERIFY_WRITE, rt_sf, rt_sf_addr, 1))
         goto sigsegv;
 
-    copy_siginfo_to_user(&rt_sf->info, info);
+    tswap_siginfo(&rt_sf->info, info);
 
     __put_user(0, &rt_sf->uc.tuc_flags);
     __put_user(0, &rt_sf->uc.tuc_link);
@@ -5177,7 +5171,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
     uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc);
     __put_user(uc_addr, &frame->puc);
 
-    copy_siginfo_to_user(&frame->info, info);
+    tswap_siginfo(&frame->info, info);
 
     /* Create the ucontext */
 
@@ -5454,7 +5448,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
         goto give_sigsegv;
     }
 
-    copy_siginfo_to_user(&frame->info, info);
+    tswap_siginfo(&frame->info, info);
 
     __put_user(0, &frame->uc.tuc_flags);
     __put_user(0, &frame->uc.tuc_link);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/6] linux-user/alpha: Add define for NR_shmat to enable shmat syscall
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 2/6] linux-user/alpha: Add define for NR_shmat to enable shmat syscall Peter Maydell
@ 2015-01-10 15:56   ` Peter Maydell
  2015-01-10 21:02     ` Richard Henderson
  0 siblings, 1 reply; 14+ messages in thread
From: Peter Maydell @ 2015-01-10 15:56 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Richard Henderson, Riku Voipio, Patch Tracking

Oops, just realized I got RTH's email wrong on the cc. Sorry...

-- PMM

On 8 January 2015 at 12:19, Peter Maydell <peter.maydell@linaro.org> wrote:
> For historical reasons, the define for the shmat() syscall on Alpha is
> NR_osf_shmat; however it has the same semantics as this syscall does
> on all other architectures, so define TARGET_NR_shmat as well so that
> QEMU's code for the syscall is enabled.
>
> This patch brings our behaviour on the LTP shmat tests into line
> with that for ARM (still not a perfect pass rate but not "this syscall
> is completely broken" as we had before).
>
> (Problem detected via a clang warning that the do_shmat() function
> was unused on Alpha.)
>
> Cc: Richard Henderson <rth@twiddle.org>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Possibly other _osf_ syscalls need similar defines; somebody who
> cares about Alpha might like to audit?
> ---
>  linux-user/alpha/syscall_nr.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/linux-user/alpha/syscall_nr.h b/linux-user/alpha/syscall_nr.h
> index 625f301..dde8d5c 100644
> --- a/linux-user/alpha/syscall_nr.h
> +++ b/linux-user/alpha/syscall_nr.h
> @@ -185,6 +185,10 @@
>  #define TARGET_NR_osf_utsname  207
>  #define TARGET_NR_lchown               208
>  #define TARGET_NR_osf_shmat            209
> +/* this has the usual shmat semantics so give it the name syscall.c expects
> + * so that our support for it is enabled.
> + */
> +#define TARGET_NR_shmat TARGET_NR_osf_shmat
>  #define TARGET_NR_shmctl               210
>  #define TARGET_NR_shmdt                211
>  #define TARGET_NR_shmget               212
> --
> 1.9.1
>
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/6] linux-user/alpha: Add define for NR_shmat to enable shmat syscall
  2015-01-10 15:56   ` Peter Maydell
@ 2015-01-10 21:02     ` Richard Henderson
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Henderson @ 2015-01-10 21:02 UTC (permalink / raw)
  To: Peter Maydell, QEMU Developers; +Cc: Riku Voipio, Patch Tracking

On 01/10/2015 07:56 AM, Peter Maydell wrote:
>>  #define TARGET_NR_osf_shmat            209
>> +/* this has the usual shmat semantics so give it the name syscall.c expects
>> + * so that our support for it is enabled.
>> + */
>> +#define TARGET_NR_shmat TARGET_NR_osf_shmat

Eh, you could just s/osf_// on this line if you like.
But otherwise looks good.

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings
  2015-01-08 12:19 [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings Peter Maydell
                   ` (5 preceding siblings ...)
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 6/6] linux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_user Peter Maydell
@ 2015-01-20 14:54 ` Peter Maydell
  2015-01-21 10:23   ` Riku Voipio
  6 siblings, 1 reply; 14+ messages in thread
From: Peter Maydell @ 2015-01-20 14:54 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Riku Voipio, Patch Tracking

Ping!

thanks
-- PMM

On 8 January 2015 at 12:19, Peter Maydell <peter.maydell@linaro.org> wrote:
> This patchset fixes warnings produced by clang in the linux-user code.
> Mostly this is deleting or marking unused functions/data, but it
> does include a genuine bugfix for Alpha.
>
> I think that this means I have patches out on the list now for
> all the clang warnings we currently generate; maybe some day soon
> we can enable warnings-as-errors...
>
> Peter Maydell (6):
>   linux-user/signal.c: Remove current_exec_domain_sig()
>   linux-user/alpha: Add define for NR_shmat to enable shmat syscall
>   linux-user/arm/nwfpe: Delete unused aCC array
>   linux-user/main.c: Call cpu_exec_start/end on all target archs
>   linux-user/main.c: Mark end_exclusive() as possibly unused
>   linux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_user
>
>  linux-user/alpha/syscall_nr.h   |  4 +++
>  linux-user/arm/nwfpe/fpopcode.c | 22 ---------------
>  linux-user/main.c               | 20 +++++++++++++-
>  linux-user/signal.c             | 59 ++++++++++++-----------------------------
>  4 files changed, 40 insertions(+), 65 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 5/6] linux-user/main.c: Mark end_exclusive() as possibly unused
  2015-01-08 12:19 ` [Qemu-devel] [PATCH 5/6] linux-user/main.c: Mark end_exclusive() as possibly unused Peter Maydell
@ 2015-01-21  8:40   ` Thomas Huth
  2015-01-21 10:54     ` Peter Maydell
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Huth @ 2015-01-21  8:40 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Riku Voipio, qemu-devel, patches

On Thu,  8 Jan 2015 12:19:47 +0000
Peter Maydell <peter.maydell@linaro.org> wrote:

> The function end_exclusive() isn't used on all targets; mark it as
> such to avoid a clang warning.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  linux-user/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/main.c b/linux-user/main.c
> index bbd1cfd..0fda51c 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -169,7 +169,7 @@ static inline void start_exclusive(void)
>  }
> 
>  /* Finish an exclusive operation.  */
> -static inline void end_exclusive(void)
> +static inline void __attribute__((unused)) end_exclusive(void)
>  {
>      pending_cpus = 0;
>      pthread_cond_broadcast(&exclusive_resume);

IMHO it might be better to add a proper #ifdef guard around that
function. Consider that the calls to end_exclusive() might get removed
completely one day, then you won't get a compiler warning about the
unused function anymore if you used the attribute__((unused)) way.

 Thomas

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings
  2015-01-20 14:54 ` [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings Peter Maydell
@ 2015-01-21 10:23   ` Riku Voipio
  2015-01-27 19:06     ` Peter Maydell
  0 siblings, 1 reply; 14+ messages in thread
From: Riku Voipio @ 2015-01-21 10:23 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers

Hi,

On Tue, Jan 20, 2015 at 02:54:20PM +0000, Peter Maydell wrote:
> Ping!

I've just updated my linux-user-for-upstream tree. I'll get it
reviewed/tested tonight.

> thanks
> -- PMM
> 
> On 8 January 2015 at 12:19, Peter Maydell <peter.maydell@linaro.org> wrote:
> > This patchset fixes warnings produced by clang in the linux-user code.
> > Mostly this is deleting or marking unused functions/data, but it
> > does include a genuine bugfix for Alpha.
> >
> > I think that this means I have patches out on the list now for
> > all the clang warnings we currently generate; maybe some day soon
> > we can enable warnings-as-errors...
> >
> > Peter Maydell (6):
> >   linux-user/signal.c: Remove current_exec_domain_sig()
> >   linux-user/alpha: Add define for NR_shmat to enable shmat syscall
> >   linux-user/arm/nwfpe: Delete unused aCC array
> >   linux-user/main.c: Call cpu_exec_start/end on all target archs
> >   linux-user/main.c: Mark end_exclusive() as possibly unused
> >   linux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_user
> >
> >  linux-user/alpha/syscall_nr.h   |  4 +++
> >  linux-user/arm/nwfpe/fpopcode.c | 22 ---------------
> >  linux-user/main.c               | 20 +++++++++++++-
> >  linux-user/signal.c             | 59 ++++++++++++-----------------------------
> >  4 files changed, 40 insertions(+), 65 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 5/6] linux-user/main.c: Mark end_exclusive() as possibly unused
  2015-01-21  8:40   ` Thomas Huth
@ 2015-01-21 10:54     ` Peter Maydell
  0 siblings, 0 replies; 14+ messages in thread
From: Peter Maydell @ 2015-01-21 10:54 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Riku Voipio, QEMU Developers, Patch Tracking

On 21 January 2015 at 08:40, Thomas Huth <thuth@linux.vnet.ibm.com> wrote:
> IMHO it might be better to add a proper #ifdef guard around that
> function. Consider that the calls to end_exclusive() might get removed
> completely one day, then you won't get a compiler warning about the
> unused function anymore if you used the attribute__((unused)) way.

Too painful, and these functions are likely going to go away/change
with the multithreaded-system-emulation support (I hope).

-- PMM

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings
  2015-01-21 10:23   ` Riku Voipio
@ 2015-01-27 19:06     ` Peter Maydell
  0 siblings, 0 replies; 14+ messages in thread
From: Peter Maydell @ 2015-01-27 19:06 UTC (permalink / raw)
  To: Riku Voipio; +Cc: QEMU Developers

Ping^2 ?

thanks
-- PMM

On 21 January 2015 at 10:23, Riku Voipio <riku.voipio@iki.fi> wrote:
> Hi,
>
> On Tue, Jan 20, 2015 at 02:54:20PM +0000, Peter Maydell wrote:
>> Ping!
>
> I've just updated my linux-user-for-upstream tree. I'll get it
> reviewed/tested tonight.
>
>> thanks
>> -- PMM
>>
>> On 8 January 2015 at 12:19, Peter Maydell <peter.maydell@linaro.org> wrote:
>> > This patchset fixes warnings produced by clang in the linux-user code.
>> > Mostly this is deleting or marking unused functions/data, but it
>> > does include a genuine bugfix for Alpha.
>> >
>> > I think that this means I have patches out on the list now for
>> > all the clang warnings we currently generate; maybe some day soon
>> > we can enable warnings-as-errors...
>> >
>> > Peter Maydell (6):
>> >   linux-user/signal.c: Remove current_exec_domain_sig()
>> >   linux-user/alpha: Add define for NR_shmat to enable shmat syscall
>> >   linux-user/arm/nwfpe: Delete unused aCC array
>> >   linux-user/main.c: Call cpu_exec_start/end on all target archs
>> >   linux-user/main.c: Mark end_exclusive() as possibly unused
>> >   linux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_user
>> >
>> >  linux-user/alpha/syscall_nr.h   |  4 +++
>> >  linux-user/arm/nwfpe/fpopcode.c | 22 ---------------
>> >  linux-user/main.c               | 20 +++++++++++++-
>> >  linux-user/signal.c             | 59 ++++++++++++-----------------------------
>> >  4 files changed, 40 insertions(+), 65 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-01-27 19:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-08 12:19 [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings Peter Maydell
2015-01-08 12:19 ` [Qemu-devel] [PATCH 1/6] linux-user/signal.c: Remove current_exec_domain_sig() Peter Maydell
2015-01-08 12:19 ` [Qemu-devel] [PATCH 2/6] linux-user/alpha: Add define for NR_shmat to enable shmat syscall Peter Maydell
2015-01-10 15:56   ` Peter Maydell
2015-01-10 21:02     ` Richard Henderson
2015-01-08 12:19 ` [Qemu-devel] [PATCH 3/6] linux-user/arm/nwfpe: Delete unused aCC array Peter Maydell
2015-01-08 12:19 ` [Qemu-devel] [PATCH 4/6] linux-user/main.c: Call cpu_exec_start/end on all target archs Peter Maydell
2015-01-08 12:19 ` [Qemu-devel] [PATCH 5/6] linux-user/main.c: Mark end_exclusive() as possibly unused Peter Maydell
2015-01-21  8:40   ` Thomas Huth
2015-01-21 10:54     ` Peter Maydell
2015-01-08 12:19 ` [Qemu-devel] [PATCH 6/6] linux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_user Peter Maydell
2015-01-20 14:54 ` [Qemu-devel] [PATCH 0/6] linux-user: Fix various clang warnings Peter Maydell
2015-01-21 10:23   ` Riku Voipio
2015-01-27 19:06     ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.