Patchwork [1/4] remove unused stuff from */exec.h

login
register
mail settings
Submitter Paolo Bonzini
Date June 28, 2010, 5:17 p.m.
Message ID <1277745445-30560-2-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/57175/
State New
Headers show

Comments

Paolo Bonzini - June 28, 2010, 5:17 p.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-alpha/exec.h      |    2 --
 target-cris/exec.h       |    3 ---
 target-i386/exec.h       |    9 ---------
 target-i386/op_helper.c  |    2 +-
 target-microblaze/exec.h |    2 --
 target-mips/exec.h       |    8 --------
 target-mips/op_helper.c  |    5 +++++
 7 files changed, 6 insertions(+), 25 deletions(-)
Blue Swirl - June 28, 2010, 5:43 p.m.
On Mon, Jun 28, 2010 at 5:17 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  target-alpha/exec.h      |    2 --
>  target-cris/exec.h       |    3 ---
>  target-i386/exec.h       |    9 ---------
>  target-i386/op_helper.c  |    2 +-
>  target-microblaze/exec.h |    2 --
>  target-mips/exec.h       |    8 --------
>  target-mips/op_helper.c  |    5 +++++
>  7 files changed, 6 insertions(+), 25 deletions(-)
>
> diff --git a/target-alpha/exec.h b/target-alpha/exec.h
> index 66526e2..0fb459d 100644
> --- a/target-alpha/exec.h
> +++ b/target-alpha/exec.h
> @@ -28,8 +28,6 @@
>
>  register struct CPUAlphaState *env asm(AREG0);
>
> -#define PARAM(n) ((uint64_t)PARAM##n)
> -#define SPARAM(n) ((int32_t)PARAM##n)
>  #define FP_STATUS (env->fp_status)
>
>  #include "cpu.h"
> diff --git a/target-cris/exec.h b/target-cris/exec.h
> index 728aa80..55776ba 100644
> --- a/target-cris/exec.h
> +++ b/target-cris/exec.h
> @@ -28,9 +28,6 @@ register struct CPUCRISState *env asm(AREG0);
>  #include "softmmu_exec.h"
>  #endif
>
> -void cpu_cris_flush_flags(CPUCRISState *env, int cc_op);
> -void helper_movec(CPUCRISState *env, int reg, uint32_t val);
> -
>  static inline int cpu_has_work(CPUState *env)
>  {
>     return (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI));
> diff --git a/target-i386/exec.h b/target-i386/exec.h
> index 4ff3c57..cb34605 100644
> --- a/target-i386/exec.h
> +++ b/target-i386/exec.h
> @@ -33,23 +33,14 @@ register struct CPUX86State *env asm(AREG0);
>  #include "qemu-common.h"
>  #include "qemu-log.h"
>
> -#undef EAX
>  #define EAX (env->regs[R_EAX])
> -#undef ECX
>  #define ECX (env->regs[R_ECX])
> -#undef EDX
>  #define EDX (env->regs[R_EDX])
> -#undef EBX
>  #define EBX (env->regs[R_EBX])
> -#undef ESP
>  #define ESP (env->regs[R_ESP])
> -#undef EBP
>  #define EBP (env->regs[R_EBP])
> -#undef ESI
>  #define ESI (env->regs[R_ESI])
> -#undef EDI
>  #define EDI (env->regs[R_EDI])
> -#undef EIP
>  #define EIP (env->eip)
>  #define DF  (env->df)

IIRC these #undefs were added because some system includes on some
hosts also defined them. I think they should be replaced by open coded
versions (rather than using the QEMU_ prefix). Or just leave the
#undefs in place.

>
> diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
> index c1256f4..00fc671 100644
> --- a/target-i386/op_helper.c
> +++ b/target-i386/op_helper.c
> @@ -16,7 +16,7 @@
>  * You should have received a copy of the GNU Lesser General Public
>  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>  */
> -#define CPU_NO_GLOBAL_REGS
> +
>  #include "exec.h"
>  #include "exec-all.h"
>  #include "host-utils.h"
> diff --git a/target-microblaze/exec.h b/target-microblaze/exec.h
> index 646701c..db1c99e 100644
> --- a/target-microblaze/exec.h
> +++ b/target-microblaze/exec.h
> @@ -27,8 +27,6 @@ register struct CPUMBState *env asm(AREG0);
>  #include "softmmu_exec.h"
>  #endif
>
> -void cpu_mb_flush_flags(CPUMBState *env, int cc_op);
> -
>  static inline int cpu_has_work(CPUState *env)
>  {
>     return (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI));
> diff --git a/target-mips/exec.h b/target-mips/exec.h
> index 01e9c4d..a07761d 100644
> --- a/target-mips/exec.h
> +++ b/target-mips/exec.h
> @@ -17,14 +17,6 @@ register struct CPUMIPSState *env asm(AREG0);
>  #include "softmmu_exec.h"
>  #endif /* !defined(CONFIG_USER_ONLY) */
>
> -void dump_fpu(CPUState *env);
> -void fpu_dump_state(CPUState *env, FILE *f,
> -                    int (*fpu_fprintf)(FILE *f, const char *fmt, ...),
> -                    int flags);
> -
> -void cpu_mips_clock_init (CPUState *env);
> -void cpu_mips_tlb_flush (CPUState *env, int flush_global);
> -
>  static inline int cpu_has_work(CPUState *env)
>  {
>     return (env->interrupt_request &
> diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
> index d09d6ed..344e0bd 100644
> --- a/target-mips/op_helper.c
> +++ b/target-mips/op_helper.c
> @@ -22,6 +22,11 @@
>  #include "host-utils.h"
>
>  #include "helper.h"
> +
> +#ifndef CONFIG_USER_ONLY
> +static inline void cpu_mips_tlb_flush (CPUState *env, int flush_global);
> +#endif
> +

Does 'inline' make sense with a function prototype?

Please also make the implementation of cpu_mips_tlb_flush() 'static'.

Otherwise, very nice cleanup. PARAM stuff dates from pre-TCG times.
Paolo Bonzini - June 29, 2010, 7:48 a.m.
On 06/28/2010 07:43 PM, Blue Swirl wrote:
> IIRC these #undefs were added because some system includes on some
> hosts also defined them. I think they should be replaced by open coded
> versions (rather than using the QEMU_ prefix). Or just leave the
> #undefs in place.

Right, I confused them with reg_EAX/reg_EBX/etc.  They were introduced in:

commit aba1d00a41d5aff5fc78bf924627b89a298a5a5a
Author: Blue Swirl <blauwirbel@gmail.com>
Date:   Sat Sep 12 12:36:11 2009 +0000

     Work around OpenSolaris sys/regset.h namespace pollution

     Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

Paolo

Patch

diff --git a/target-alpha/exec.h b/target-alpha/exec.h
index 66526e2..0fb459d 100644
--- a/target-alpha/exec.h
+++ b/target-alpha/exec.h
@@ -28,8 +28,6 @@ 
 
 register struct CPUAlphaState *env asm(AREG0);
 
-#define PARAM(n) ((uint64_t)PARAM##n)
-#define SPARAM(n) ((int32_t)PARAM##n)
 #define FP_STATUS (env->fp_status)
 
 #include "cpu.h"
diff --git a/target-cris/exec.h b/target-cris/exec.h
index 728aa80..55776ba 100644
--- a/target-cris/exec.h
+++ b/target-cris/exec.h
@@ -28,9 +28,6 @@  register struct CPUCRISState *env asm(AREG0);
 #include "softmmu_exec.h"
 #endif
 
-void cpu_cris_flush_flags(CPUCRISState *env, int cc_op);
-void helper_movec(CPUCRISState *env, int reg, uint32_t val);
-
 static inline int cpu_has_work(CPUState *env)
 {
     return (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI));
diff --git a/target-i386/exec.h b/target-i386/exec.h
index 4ff3c57..cb34605 100644
--- a/target-i386/exec.h
+++ b/target-i386/exec.h
@@ -33,23 +33,14 @@  register struct CPUX86State *env asm(AREG0);
 #include "qemu-common.h"
 #include "qemu-log.h"
 
-#undef EAX
 #define EAX (env->regs[R_EAX])
-#undef ECX
 #define ECX (env->regs[R_ECX])
-#undef EDX
 #define EDX (env->regs[R_EDX])
-#undef EBX
 #define EBX (env->regs[R_EBX])
-#undef ESP
 #define ESP (env->regs[R_ESP])
-#undef EBP
 #define EBP (env->regs[R_EBP])
-#undef ESI
 #define ESI (env->regs[R_ESI])
-#undef EDI
 #define EDI (env->regs[R_EDI])
-#undef EIP
 #define EIP (env->eip)
 #define DF  (env->df)
 
diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
index c1256f4..00fc671 100644
--- a/target-i386/op_helper.c
+++ b/target-i386/op_helper.c
@@ -16,7 +16,7 @@ 
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#define CPU_NO_GLOBAL_REGS
+
 #include "exec.h"
 #include "exec-all.h"
 #include "host-utils.h"
diff --git a/target-microblaze/exec.h b/target-microblaze/exec.h
index 646701c..db1c99e 100644
--- a/target-microblaze/exec.h
+++ b/target-microblaze/exec.h
@@ -27,8 +27,6 @@  register struct CPUMBState *env asm(AREG0);
 #include "softmmu_exec.h"
 #endif
 
-void cpu_mb_flush_flags(CPUMBState *env, int cc_op);
-
 static inline int cpu_has_work(CPUState *env)
 {
     return (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI));
diff --git a/target-mips/exec.h b/target-mips/exec.h
index 01e9c4d..a07761d 100644
--- a/target-mips/exec.h
+++ b/target-mips/exec.h
@@ -17,14 +17,6 @@  register struct CPUMIPSState *env asm(AREG0);
 #include "softmmu_exec.h"
 #endif /* !defined(CONFIG_USER_ONLY) */
 
-void dump_fpu(CPUState *env);
-void fpu_dump_state(CPUState *env, FILE *f,
-                    int (*fpu_fprintf)(FILE *f, const char *fmt, ...),
-                    int flags);
-
-void cpu_mips_clock_init (CPUState *env);
-void cpu_mips_tlb_flush (CPUState *env, int flush_global);
-
 static inline int cpu_has_work(CPUState *env)
 {
     return (env->interrupt_request &
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
index d09d6ed..344e0bd 100644
--- a/target-mips/op_helper.c
+++ b/target-mips/op_helper.c
@@ -22,6 +22,11 @@ 
 #include "host-utils.h"
 
 #include "helper.h"
+
+#ifndef CONFIG_USER_ONLY
+static inline void cpu_mips_tlb_flush (CPUState *env, int flush_global);
+#endif
+
 /*****************************************************************************/
 /* Exceptions processing helpers */