Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KDMHX-0008Il-Ds for qemu-devel@nongnu.org; Mon, 30 Jun 2008 12:31:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KDMHX-0008ID-21 for qemu-devel@nongnu.org; Mon, 30 Jun 2008 12:31:11 -0400 Received: from [199.232.76.173] (port=48282 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KDMHW-0008I2-LX for qemu-devel@nongnu.org; Mon, 30 Jun 2008 12:31:10 -0400 Received: from savannah.gnu.org ([199.232.41.3]:46987 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KDMHW-000345-8Z for qemu-devel@nongnu.org; Mon, 30 Jun 2008 12:31:10 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KDMHS-00034i-56 for qemu-devel@nongnu.org; Mon, 30 Jun 2008 16:31:06 +0000 Received: from pbrook by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KDMHR-00034e-Fj for qemu-devel@nongnu.org; Mon, 30 Jun 2008 16:31:05 +0000 MIME-Version: 1.0 Errors-To: pbrook Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Paul Brook Message-Id: Date: Mon, 30 Jun 2008 16:31:05 +0000 Subject: [Qemu-devel] [4808] Move CPU save/load registration to common code. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4808 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4808 Author: pbrook Date: 2008-06-30 16:31:04 +0000 (Mon, 30 Jun 2008) Log Message: ----------- Move CPU save/load registration to common code. Modified Paths: -------------- trunk/exec.c trunk/hw/etraxfs.c trunk/hw/mips_jazz.c trunk/hw/mips_malta.c trunk/hw/mips_mipssim.c trunk/hw/mips_r4k.c trunk/hw/pc.c trunk/hw/ppc4xx_devs.c trunk/hw/ppc_chrp.c trunk/hw/ppc_oldworld.c trunk/hw/ppc_prep.c trunk/hw/pxa2xx.c trunk/hw/sun4m.c trunk/hw/sun4u.c trunk/qemu-common.h trunk/sysemu.h trunk/target-arm/cpu.h trunk/target-arm/machine.c trunk/target-cris/cpu.h trunk/target-i386/cpu.h trunk/target-mips/cpu.h trunk/target-ppc/cpu.h trunk/target-sparc/cpu.h Modified: trunk/exec.c =================================================================== --- trunk/exec.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/exec.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -37,6 +37,7 @@ #include "exec-all.h" #include "qemu-common.h" #include "tcg.h" +#include "hw/hw.h" #if defined(CONFIG_USER_ONLY) #include #endif @@ -457,6 +458,10 @@ env->cpu_index = cpu_index; env->nb_watchpoints = 0; *penv = env; +#if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY) + register_savevm("cpu", cpu_index, CPU_SAVE_VERSION, + cpu_save, cpu_load, env); +#endif } static inline void invalidate_page_bitmap(PageDesc *p) Modified: trunk/hw/etraxfs.c =================================================================== --- trunk/hw/etraxfs.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/etraxfs.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -67,7 +67,6 @@ cpu_model = "crisv32"; } env = cpu_init(cpu_model); - register_savevm("cpu", 0, 1, cpu_save, cpu_load, env); qemu_register_reset(main_cpu_reset, env); /* allocate RAM */ Modified: trunk/hw/mips_jazz.c =================================================================== --- trunk/hw/mips_jazz.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/mips_jazz.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -146,7 +146,6 @@ fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } - register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); qemu_register_reset(main_cpu_reset, env); /* allocate RAM */ Modified: trunk/hw/mips_malta.c =================================================================== --- trunk/hw/mips_malta.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/mips_malta.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -802,7 +802,6 @@ fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } - register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); qemu_register_reset(main_cpu_reset, env); /* allocate RAM */ Modified: trunk/hw/mips_mipssim.c =================================================================== --- trunk/hw/mips_mipssim.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/mips_mipssim.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -129,7 +129,6 @@ fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } - register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); qemu_register_reset(main_cpu_reset, env); /* Allocate RAM. */ Modified: trunk/hw/mips_r4k.c =================================================================== --- trunk/hw/mips_r4k.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/mips_r4k.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -175,7 +175,6 @@ fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } - register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); qemu_register_reset(main_cpu_reset, env); /* allocate RAM */ Modified: trunk/hw/pc.c =================================================================== --- trunk/hw/pc.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/pc.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -764,7 +764,6 @@ /* XXX: enable it in all cases */ env->cpuid_features |= CPUID_APIC; } - register_savevm("cpu", i, 5, cpu_save, cpu_load, env); qemu_register_reset(main_cpu_reset, env); if (pci_enabled) { apic_init(env); Modified: trunk/hw/ppc4xx_devs.c =================================================================== --- trunk/hw/ppc4xx_devs.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/ppc4xx_devs.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -56,7 +56,6 @@ ppc_dcr_init(env, NULL, NULL); /* Register qemu callbacks */ qemu_register_reset(&cpu_ppc_reset, env); - register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); return env; } Modified: trunk/hw/ppc_chrp.c =================================================================== --- trunk/hw/ppc_chrp.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/ppc_chrp.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -103,7 +103,6 @@ env->osi_call = vga_osi_call; #endif qemu_register_reset(&cpu_ppc_reset, env); - register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); envs[i] = env; } if (env->nip < 0xFFF80000) { Modified: trunk/hw/ppc_oldworld.c =================================================================== --- trunk/hw/ppc_oldworld.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/ppc_oldworld.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -143,7 +143,6 @@ cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); env->osi_call = vga_osi_call; qemu_register_reset(&cpu_ppc_reset, env); - register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); envs[i] = env; } if (env->nip < 0xFFF80000) { Modified: trunk/hw/ppc_prep.c =================================================================== --- trunk/hw/ppc_prep.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/ppc_prep.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -580,7 +580,6 @@ cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); } qemu_register_reset(&cpu_ppc_reset, env); - register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); envs[i] = env; } Modified: trunk/hw/pxa2xx.c =================================================================== --- trunk/hw/pxa2xx.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/pxa2xx.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -2046,9 +2046,6 @@ fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } - register_savevm("cpu", 0, ARM_CPU_SAVE_VERSION, cpu_save, cpu_load, - s->env); - s->reset = qemu_allocate_irqs(pxa2xx_reset, s, 1)[0]; /* SDRAM & Internal Memory Storage */ @@ -2173,9 +2170,6 @@ fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } - register_savevm("cpu", 0, ARM_CPU_SAVE_VERSION, cpu_save, cpu_load, - s->env); - s->reset = qemu_allocate_irqs(pxa2xx_reset, s, 1)[0]; /* SDRAM & Internal Memory Storage */ Modified: trunk/hw/sun4m.c =================================================================== --- trunk/hw/sun4m.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/sun4m.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -426,7 +426,6 @@ qemu_register_reset(secondary_cpu_reset, env); env->halted = 1; } - register_savevm("cpu", i, 4, cpu_save, cpu_load, env); cpu_irqs[i] = qemu_allocate_irqs(cpu_set_irq, envs[i], MAX_PILS); env->prom_addr = hwdef->slavio_base; } @@ -601,7 +600,6 @@ cpu_sparc_set_id(env, 0); qemu_register_reset(main_cpu_reset, env); - register_savevm("cpu", 0, 4, cpu_save, cpu_load, env); cpu_irqs = qemu_allocate_irqs(cpu_set_irq, env, MAX_PILS); env->prom_addr = hwdef->slavio_base; @@ -1413,7 +1411,6 @@ qemu_register_reset(secondary_cpu_reset, env); env->halted = 1; } - register_savevm("cpu", i, 4, cpu_save, cpu_load, env); cpu_irqs[i] = qemu_allocate_irqs(cpu_set_irq, envs[i], MAX_PILS); env->prom_addr = hwdef->slavio_base; } Modified: trunk/hw/sun4u.c =================================================================== --- trunk/hw/sun4u.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/hw/sun4u.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -282,7 +282,6 @@ bh = qemu_bh_new(hstick_irq, env); env->hstick = ptimer_init(bh); ptimer_set_period(env->hstick, 1ULL); - register_savevm("cpu", 0, 4, cpu_save, cpu_load, env); qemu_register_reset(main_cpu_reset, env); main_cpu_reset(env); Modified: trunk/qemu-common.h =================================================================== --- trunk/qemu-common.h 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/qemu-common.h 2008-06-30 16:31:04 UTC (rev 4808) @@ -132,4 +132,8 @@ typedef struct IRQState *qemu_irq; struct pcmcia_card_s; +/* CPU save/load. */ +void cpu_save(QEMUFile *f, void *opaque); +int cpu_load(QEMUFile *f, void *opaque, int version_id); + #endif Modified: trunk/sysemu.h =================================================================== --- trunk/sysemu.h 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/sysemu.h 2008-06-30 16:31:04 UTC (rev 4808) @@ -41,9 +41,6 @@ #endif void qemu_system_reset(void); -void cpu_save(QEMUFile *f, void *opaque); -int cpu_load(QEMUFile *f, void *opaque, int version_id); - void do_savevm(const char *name); void do_loadvm(const char *name); void do_delvm(const char *name); Modified: trunk/target-arm/cpu.h =================================================================== --- trunk/target-arm/cpu.h 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/target-arm/cpu.h 2008-06-30 16:31:04 UTC (rev 4808) @@ -397,7 +397,7 @@ #define cpu_signal_handler cpu_arm_signal_handler #define cpu_list arm_cpu_list -#define ARM_CPU_SAVE_VERSION 1 +#define CPU_SAVE_VERSION 1 /* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel Modified: trunk/target-arm/machine.c =================================================================== --- trunk/target-arm/machine.c 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/target-arm/machine.c 2008-06-30 16:31:04 UTC (rev 4808) @@ -120,7 +120,7 @@ CPUARMState *env = (CPUARMState *)opaque; int i; - if (version_id != ARM_CPU_SAVE_VERSION) + if (version_id != CPU_SAVE_VERSION) return -EINVAL; for (i = 0; i < 16; i++) { Modified: trunk/target-cris/cpu.h =================================================================== --- trunk/target-cris/cpu.h 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/target-cris/cpu.h 2008-06-30 16:31:04 UTC (rev 4808) @@ -210,6 +210,8 @@ #define cpu_gen_code cpu_cris_gen_code #define cpu_signal_handler cpu_cris_signal_handler +#define CPU_SAVE_VERSION 1 + /* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel #define MMU_MODE1_SUFFIX _user Modified: trunk/target-i386/cpu.h =================================================================== --- trunk/target-i386/cpu.h 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/target-i386/cpu.h 2008-06-30 16:31:04 UTC (rev 4808) @@ -726,6 +726,8 @@ #define cpu_signal_handler cpu_x86_signal_handler #define cpu_list x86_cpu_list +#define CPU_SAVE_VERSION 5 + /* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel #define MMU_MODE1_SUFFIX _user Modified: trunk/target-mips/cpu.h =================================================================== --- trunk/target-mips/cpu.h 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/target-mips/cpu.h 2008-06-30 16:31:04 UTC (rev 4808) @@ -489,6 +489,8 @@ #define cpu_signal_handler cpu_mips_signal_handler #define cpu_list mips_cpu_list +#define CPU_SAVE_VERSION 3 + /* MMU modes definitions. We carefully match the indices with our hflags layout. */ #define MMU_MODE0_SUFFIX _kernel Modified: trunk/target-ppc/cpu.h =================================================================== --- trunk/target-ppc/cpu.h 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/target-ppc/cpu.h 2008-06-30 16:31:04 UTC (rev 4808) @@ -813,6 +813,8 @@ #define cpu_signal_handler cpu_ppc_signal_handler #define cpu_list ppc_cpu_list +#define CPU_SAVE_VERSION 3 + /* MMU modes definitions */ #define MMU_MODE0_SUFFIX _user #define MMU_MODE1_SUFFIX _kernel Modified: trunk/target-sparc/cpu.h =================================================================== --- trunk/target-sparc/cpu.h 2008-06-30 15:27:47 UTC (rev 4807) +++ trunk/target-sparc/cpu.h 2008-06-30 16:31:04 UTC (rev 4808) @@ -388,6 +388,8 @@ #define cpu_signal_handler cpu_sparc_signal_handler #define cpu_list sparc_cpu_list +#define CPU_SAVE_VERSION 4 + /* MMU modes definitions */ #define MMU_MODE0_SUFFIX _user #define MMU_MODE1_SUFFIX _kernel