aboutsummaryrefslogtreecommitdiff
path: root/hw/pc.c
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2010-05-14 16:29:04 +0900
committerBlue Swirl <blauwirbel@gmail.com>2010-05-15 15:33:08 +0000
commitf885f1eaa8711c06033ceb1599e3750fb37c306f (patch)
treef03808086454c9bd232ec4e2d948a93fe43d6b55 /hw/pc.c
parentb8d6f53986c56dfcffe1961cb01877e81d0f8bb5 (diff)
pc, i440fx: Make smm enable/disable function i440fx independent.
make cpu_smm_update() generic to be independent on i440fx by registering a callback. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/pc.c')
-rw-r--r--hw/pc.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/hw/pc.c b/hw/pc.c
index 8842766313..691803f11e 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -68,7 +68,6 @@
static FDCtrl *floppy_controller;
static RTCState *rtc_state;
static PITState *pit;
-static PCII440FXState *i440fx_state;
#define E820_NR_ENTRIES 16
@@ -125,10 +124,22 @@ uint64_t cpu_get_tsc(CPUX86State *env)
}
/* SMM support */
+
+static cpu_set_smm_t smm_set;
+static void *smm_arg;
+
+void cpu_smm_register(cpu_set_smm_t callback, void *arg)
+{
+ assert(smm_set == NULL);
+ assert(smm_arg == NULL);
+ smm_set = callback;
+ smm_arg = arg;
+}
+
void cpu_smm_update(CPUState *env)
{
- if (i440fx_state && env == first_cpu)
- i440fx_set_smm(i440fx_state, (env->hflags >> HF_SMM_SHIFT) & 1);
+ if (smm_set && smm_arg && env == first_cpu)
+ smm_set(!!(env->hflags & HF_SMM_MASK), smm_arg);
}
@@ -813,6 +824,7 @@ static void pc_init1(ram_addr_t ram_size,
ram_addr_t below_4g_mem_size, above_4g_mem_size = 0;
int bios_size, isa_bios_size;
PCIBus *pci_bus;
+ PCII440FXState *i440fx_state;
int piix3_devfn = -1;
qemu_irq *cpu_irq;
qemu_irq *isa_irq;