qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Michael Walle" <michael@walle.cc>, "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH v5 16/43] target-lm32: Don't overuse CPUState
Date: Wed, 14 Mar 2012 22:42:29 +0100	[thread overview]
Message-ID: <1331761376-20362-17-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1331761376-20362-1-git-send-email-afaerber@suse.de>

Scripted conversion:
  sed -i "s/CPUState/CPULM32State/g" target-lm32/*.[hc]
  sed -i "s/#define CPULM32State/#define CPUState/" target-lm32/cpu.h

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
---
 target-lm32/cpu.h       |   28 ++++++++++++++--------------
 target-lm32/helper.c    |   16 ++++++++--------
 target-lm32/machine.c   |   22 +++++++++++-----------
 target-lm32/op_helper.c |    4 ++--
 target-lm32/translate.c |   38 +++++++++++++++++++-------------------
 5 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/target-lm32/cpu.h b/target-lm32/cpu.h
index cc9b53b..684b2fa 100644
--- a/target-lm32/cpu.h
+++ b/target-lm32/cpu.h
@@ -36,7 +36,7 @@ typedef struct CPULM32State CPULM32State;
 
 #define NB_MMU_MODES 1
 #define TARGET_PAGE_BITS 12
-static inline int cpu_mmu_index(CPUState *env)
+static inline int cpu_mmu_index(CPULM32State *env)
 {
     return 0;
 }
@@ -185,18 +185,18 @@ typedef struct CPULM32State {
 } CPULM32State;
 
 
-CPUState *cpu_lm32_init(const char *cpu_model);
+CPULM32State *cpu_lm32_init(const char *cpu_model);
 void cpu_lm32_list(FILE *f, fprintf_function cpu_fprintf);
-int cpu_lm32_exec(CPUState *s);
-void cpu_lm32_close(CPUState *s);
-void do_interrupt(CPUState *env);
+int cpu_lm32_exec(CPULM32State *s);
+void cpu_lm32_close(CPULM32State *s);
+void do_interrupt(CPULM32State *env);
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
 int cpu_lm32_signal_handler(int host_signum, void *pinfo,
                           void *puc);
 void lm32_translate_init(void);
-void cpu_lm32_set_phys_msb_ignore(CPUState *env, int value);
+void cpu_lm32_set_phys_msb_ignore(CPULM32State *env, int value);
 
 #define cpu_list cpu_lm32_list
 #define cpu_init cpu_lm32_init
@@ -206,12 +206,12 @@ void cpu_lm32_set_phys_msb_ignore(CPUState *env, int value);
 
 #define CPU_SAVE_VERSION 1
 
-int cpu_lm32_handle_mmu_fault(CPUState *env, target_ulong address, int rw,
+int cpu_lm32_handle_mmu_fault(CPULM32State *env, target_ulong address, int rw,
                               int mmu_idx);
 #define cpu_handle_mmu_fault cpu_lm32_handle_mmu_fault
 
 #if defined(CONFIG_USER_ONLY)
-static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
+static inline void cpu_clone_regs(CPULM32State *env, target_ulong newsp)
 {
     if (newsp) {
         env->regs[R_SP] = newsp;
@@ -220,23 +220,23 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
 }
 #endif
 
-static inline void cpu_set_tls(CPUState *env, target_ulong newtls)
+static inline void cpu_set_tls(CPULM32State *env, target_ulong newtls)
 {
 }
 
-static inline int cpu_interrupts_enabled(CPUState *env)
+static inline int cpu_interrupts_enabled(CPULM32State *env)
 {
     return env->ie & IE_IE;
 }
 
 #include "cpu-all.h"
 
-static inline target_ulong cpu_get_pc(CPUState *env)
+static inline target_ulong cpu_get_pc(CPULM32State *env)
 {
     return env->pc;
 }
 
-static inline void cpu_get_tb_cpu_state(CPUState *env, target_ulong *pc,
+static inline void cpu_get_tb_cpu_state(CPULM32State *env, target_ulong *pc,
                                         target_ulong *cs_base, int *flags)
 {
     *pc = env->pc;
@@ -244,14 +244,14 @@ static inline void cpu_get_tb_cpu_state(CPUState *env, target_ulong *pc,
     *flags = 0;
 }
 
-static inline bool cpu_has_work(CPUState *env)
+static inline bool cpu_has_work(CPULM32State *env)
 {
     return env->interrupt_request & CPU_INTERRUPT_HARD;
 }
 
 #include "exec-all.h"
 
-static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
+static inline void cpu_pc_from_tb(CPULM32State *env, TranslationBlock *tb)
 {
     env->pc = tb->pc;
 }
diff --git a/target-lm32/helper.c b/target-lm32/helper.c
index 6834401..5db8f8d 100644
--- a/target-lm32/helper.c
+++ b/target-lm32/helper.c
@@ -20,7 +20,7 @@
 #include "cpu.h"
 #include "host-utils.h"
 
-int cpu_lm32_handle_mmu_fault(CPUState *env, target_ulong address, int rw,
+int cpu_lm32_handle_mmu_fault(CPULM32State *env, target_ulong address, int rw,
                               int mmu_idx)
 {
     int prot;
@@ -37,12 +37,12 @@ int cpu_lm32_handle_mmu_fault(CPUState *env, target_ulong address, int rw,
     return 0;
 }
 
-target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
+target_phys_addr_t cpu_get_phys_page_debug(CPULM32State *env, target_ulong addr)
 {
     return addr & TARGET_PAGE_MASK;
 }
 
-void do_interrupt(CPUState *env)
+void do_interrupt(CPULM32State *env)
 {
     qemu_log_mask(CPU_LOG_INT,
             "exception at pc=%x type=%x\n", env->pc, env->exception_index);
@@ -192,9 +192,9 @@ static uint32_t cfg_by_def(const LM32Def *def)
     return cfg;
 }
 
-CPUState *cpu_lm32_init(const char *cpu_model)
+CPULM32State *cpu_lm32_init(const char *cpu_model)
 {
-    CPUState *env;
+    CPULM32State *env;
     const LM32Def *def;
     static int tcg_initialized;
 
@@ -203,7 +203,7 @@ CPUState *cpu_lm32_init(const char *cpu_model)
         return NULL;
     }
 
-    env = g_malloc0(sizeof(CPUState));
+    env = g_malloc0(sizeof(CPULM32State));
 
     env->features = def->features;
     env->num_bps = def->num_breakpoints;
@@ -226,7 +226,7 @@ CPUState *cpu_lm32_init(const char *cpu_model)
 /* Some soc ignores the MSB on the address bus. Thus creating a shadow memory
  * area. As a general rule, 0x00000000-0x7fffffff is cached, whereas
  * 0x80000000-0xffffffff is not cached and used to access IO devices. */
-void cpu_lm32_set_phys_msb_ignore(CPUState *env, int value)
+void cpu_lm32_set_phys_msb_ignore(CPULM32State *env, int value)
 {
     if (value) {
         env->flags |= LM32_FLAG_IGNORE_MSB;
@@ -235,7 +235,7 @@ void cpu_lm32_set_phys_msb_ignore(CPUState *env, int value)
     }
 }
 
-void cpu_state_reset(CPUState *env)
+void cpu_state_reset(CPULM32State *env)
 {
     if (qemu_loglevel_mask(CPU_LOG_RESET)) {
         qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
diff --git a/target-lm32/machine.c b/target-lm32/machine.c
index 70ca52a..6802e81 100644
--- a/target-lm32/machine.c
+++ b/target-lm32/machine.c
@@ -7,17 +7,17 @@ static const VMStateDescription vmstate_cpu = {
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields      = (VMStateField[]) {
-        VMSTATE_UINT32_ARRAY(regs, CPUState, 32),
-        VMSTATE_UINT32(pc, CPUState),
-        VMSTATE_UINT32(ie, CPUState),
-        VMSTATE_UINT32(icc, CPUState),
-        VMSTATE_UINT32(dcc, CPUState),
-        VMSTATE_UINT32(cc, CPUState),
-        VMSTATE_UINT32(eba, CPUState),
-        VMSTATE_UINT32(dc, CPUState),
-        VMSTATE_UINT32(deba, CPUState),
-        VMSTATE_UINT32_ARRAY(bp, CPUState, 4),
-        VMSTATE_UINT32_ARRAY(wp, CPUState, 4),
+        VMSTATE_UINT32_ARRAY(regs, CPULM32State, 32),
+        VMSTATE_UINT32(pc, CPULM32State),
+        VMSTATE_UINT32(ie, CPULM32State),
+        VMSTATE_UINT32(icc, CPULM32State),
+        VMSTATE_UINT32(dcc, CPULM32State),
+        VMSTATE_UINT32(cc, CPULM32State),
+        VMSTATE_UINT32(eba, CPULM32State),
+        VMSTATE_UINT32(dc, CPULM32State),
+        VMSTATE_UINT32(deba, CPULM32State),
+        VMSTATE_UINT32_ARRAY(bp, CPULM32State, 4),
+        VMSTATE_UINT32_ARRAY(wp, CPULM32State, 4),
         VMSTATE_END_OF_LIST()
     }
 };
diff --git a/target-lm32/op_helper.c b/target-lm32/op_helper.c
index 02be134..e9c9638 100644
--- a/target-lm32/op_helper.c
+++ b/target-lm32/op_helper.c
@@ -75,11 +75,11 @@ uint32_t helper_rcsr_jrx(void)
    NULL, it means that the function was called in C code (i.e. not
    from generated code or from helper.c) */
 /* XXX: fix it to restore all registers */
-void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
+void tlb_fill(CPULM32State *env1, target_ulong addr, int is_write, int mmu_idx,
               void *retaddr)
 {
     TranslationBlock *tb;
-    CPUState *saved_env;
+    CPULM32State *saved_env;
     unsigned long pc;
     int ret;
 
diff --git a/target-lm32/translate.c b/target-lm32/translate.c
index c80e48b..872a2ba 100644
--- a/target-lm32/translate.c
+++ b/target-lm32/translate.c
@@ -64,7 +64,7 @@ enum {
 
 /* This is the state at translation time.  */
 typedef struct DisasContext {
-    CPUState *env;
+    CPULM32State *env;
     target_ulong pc;
 
     /* Decoder.  */
@@ -987,7 +987,7 @@ static inline void decode(DisasContext *dc)
     decinfo[dc->opcode](dc);
 }
 
-static void check_breakpoint(CPUState *env, DisasContext *dc)
+static void check_breakpoint(CPULM32State *env, DisasContext *dc)
 {
     CPUBreakpoint *bp;
 
@@ -1003,7 +1003,7 @@ static void check_breakpoint(CPUState *env, DisasContext *dc)
 }
 
 /* generate intermediate code for basic block 'tb'.  */
-static void gen_intermediate_code_internal(CPUState *env,
+static void gen_intermediate_code_internal(CPULM32State *env,
         TranslationBlock *tb, int search_pc)
 {
     struct DisasContext ctx, *dc = &ctx;
@@ -1129,17 +1129,17 @@ static void gen_intermediate_code_internal(CPUState *env,
 #endif
 }
 
-void gen_intermediate_code(CPUState *env, struct TranslationBlock *tb)
+void gen_intermediate_code(CPULM32State *env, struct TranslationBlock *tb)
 {
     gen_intermediate_code_internal(env, tb, 0);
 }
 
-void gen_intermediate_code_pc(CPUState *env, struct TranslationBlock *tb)
+void gen_intermediate_code_pc(CPULM32State *env, struct TranslationBlock *tb)
 {
     gen_intermediate_code_internal(env, tb, 1);
 }
 
-void cpu_dump_state(CPUState *env, FILE *f, fprintf_function cpu_fprintf,
+void cpu_dump_state(CPULM32State *env, FILE *f, fprintf_function cpu_fprintf,
                      int flags)
 {
     int i;
@@ -1171,7 +1171,7 @@ void cpu_dump_state(CPUState *env, FILE *f, fprintf_function cpu_fprintf,
     cpu_fprintf(f, "\n\n");
 }
 
-void restore_state_to_opc(CPUState *env, TranslationBlock *tb, int pc_pos)
+void restore_state_to_opc(CPULM32State *env, TranslationBlock *tb, int pc_pos)
 {
     env->pc = gen_opc_pc[pc_pos];
 }
@@ -1184,48 +1184,48 @@ void lm32_translate_init(void)
 
     for (i = 0; i < ARRAY_SIZE(cpu_R); i++) {
         cpu_R[i] = tcg_global_mem_new(TCG_AREG0,
-                          offsetof(CPUState, regs[i]),
+                          offsetof(CPULM32State, regs[i]),
                           regnames[i]);
     }
 
     for (i = 0; i < ARRAY_SIZE(cpu_bp); i++) {
         cpu_bp[i] = tcg_global_mem_new(TCG_AREG0,
-                          offsetof(CPUState, bp[i]),
+                          offsetof(CPULM32State, bp[i]),
                           regnames[32+i]);
     }
 
     for (i = 0; i < ARRAY_SIZE(cpu_wp); i++) {
         cpu_wp[i] = tcg_global_mem_new(TCG_AREG0,
-                          offsetof(CPUState, wp[i]),
+                          offsetof(CPULM32State, wp[i]),
                           regnames[36+i]);
     }
 
     cpu_pc = tcg_global_mem_new(TCG_AREG0,
-                    offsetof(CPUState, pc),
+                    offsetof(CPULM32State, pc),
                     "pc");
     cpu_ie = tcg_global_mem_new(TCG_AREG0,
-                    offsetof(CPUState, ie),
+                    offsetof(CPULM32State, ie),
                     "ie");
     cpu_icc = tcg_global_mem_new(TCG_AREG0,
-                    offsetof(CPUState, icc),
+                    offsetof(CPULM32State, icc),
                     "icc");
     cpu_dcc = tcg_global_mem_new(TCG_AREG0,
-                    offsetof(CPUState, dcc),
+                    offsetof(CPULM32State, dcc),
                     "dcc");
     cpu_cc = tcg_global_mem_new(TCG_AREG0,
-                    offsetof(CPUState, cc),
+                    offsetof(CPULM32State, cc),
                     "cc");
     cpu_cfg = tcg_global_mem_new(TCG_AREG0,
-                    offsetof(CPUState, cfg),
+                    offsetof(CPULM32State, cfg),
                     "cfg");
     cpu_eba = tcg_global_mem_new(TCG_AREG0,
-                    offsetof(CPUState, eba),
+                    offsetof(CPULM32State, eba),
                     "eba");
     cpu_dc = tcg_global_mem_new(TCG_AREG0,
-                    offsetof(CPUState, dc),
+                    offsetof(CPULM32State, dc),
                     "dc");
     cpu_deba = tcg_global_mem_new(TCG_AREG0,
-                    offsetof(CPUState, deba),
+                    offsetof(CPULM32State, deba),
                     "deba");
 }
 
-- 
1.7.7

  parent reply	other threads:[~2012-03-14 21:43 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-14 21:42 [Qemu-devel] [PULL] QOM CPUState v5 Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 01/43] PPC: 405: Use proper CPU reset Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 02/43] Rename cpu_reset() to cpu_state_reset() Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 03/43] monitor: Don't access registers through CPUState Andreas Färber
2012-03-15 16:15   ` Lluís Vilanova
2012-03-15 18:12     ` Andreas Färber
2012-03-15 21:35       ` Lluís Vilanova
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 04/43] monitor: Avoid CPUState in read/write functions Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 05/43] target-lm32/microblaze: Typedef struct CPU{MB, LM32}State Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 06/43] target-sparc: Typedef struct CPUSPARCState early Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 07/43] target-unicore32: Rename to CPUUniCore32State Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 08/43] hw/mc146818: Drop unneeded #includes Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 09/43] linux-user: Don't overuse CPUState Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 10/43] darwin-user: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 11/43] bsd-user: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 12/43] target-alpha: " Andreas Färber
2012-03-17 19:20   ` Richard Henderson
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 13/43] target-arm: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 14/43] target-cris: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 15/43] target-i386: " Andreas Färber
2012-03-14 21:42 ` Andreas Färber [this message]
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 17/43] target-m68k: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 18/43] target-microblaze: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 19/43] target-mips: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 20/43] target-ppc: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 21/43] target-s390x: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 22/43] target-sh4: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 23/43] target-sparc: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 24/43] target-unicore32: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 25/43] target-xtensa: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 26/43] arm-semi: Don't use CPUState Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 27/43] m68k-semi: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 28/43] xtensa-semi: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 29/43] alpha hw/: " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 30/43] arm " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 31/43] cris " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 32/43] i386 " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 33/43] lm32 " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 34/43] m68k " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 35/43] microblaze " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 36/43] mips " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 37/43] ppc " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 38/43] s390x " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 39/43] sh4 " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 40/43] sparc " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 41/43] xtensa " Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 42/43] Rename CPUState -> CPUArchState Andreas Färber
2012-03-14 21:42 ` [Qemu-devel] [PATCH v5 43/43] qom: Introduce CPU class Andreas Färber
2012-03-15  0:49 ` [Qemu-devel] [PULL] QOM CPUState v5 Anthony Liguori
2012-03-15 10:16   ` [Qemu-devel] [PULL] QOM CPUState v5 - conflict resolution info Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331761376-20362-17-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=michael@walle.cc \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).