[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 37/39] target/i386: move FERR handling to target/i386
From: |
Paolo Bonzini |
Subject: |
[PULL 37/39] target/i386: move FERR handling to target/i386 |
Date: |
Thu, 24 Oct 2019 16:03:53 +0200 |
Move it out of pc.c since it is strictly tied to TCG. This is
almost exclusively code movement, the next patch will implement
IGNNE.
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/i386/pc.c | 17 +++--------------
hw/i386/pc_piix.c | 2 +-
hw/i386/pc_q35.c | 2 +-
include/hw/i386/pc.h | 1 -
target/i386/cpu.h | 3 ++-
target/i386/fpu_helper.c | 26 +++++++++++++++++++++++++-
6 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 5fce60c..66d865b 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -381,23 +381,12 @@ static uint64_t ioport80_read(void *opaque, hwaddr addr,
unsigned size)
}
/* MSDOS compatibility mode FPU exception support */
-static qemu_irq ferr_irq;
-
-void pc_register_ferr_irq(qemu_irq irq)
-{
- ferr_irq = irq;
-}
-
-/* XXX: add IGNNE support */
-void cpu_set_ferr(CPUX86State *s)
-{
- qemu_irq_raise(ferr_irq);
-}
-
static void ioportF0_write(void *opaque, hwaddr addr, uint64_t data,
unsigned size)
{
- qemu_irq_lower(ferr_irq);
+ if (tcg_enabled()) {
+ cpu_clear_ferr();
+ }
}
static uint64_t ioportF0_read(void *opaque, hwaddr addr, unsigned size)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 3a4a64a..431d657 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -213,7 +213,7 @@ static void pc_init1(MachineState *machine,
ioapic_init_gsi(gsi_state, "i440fx");
}
- pc_register_ferr_irq(x86ms->gsi[13]);
+ x86_register_ferr_irq(x86ms->gsi[13]);
pc_vga_init(isa_bus, pcmc->pci_enabled ? pci_bus : NULL);
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index def3bc2..c9cdac8 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -261,7 +261,7 @@ static void pc_q35_init(MachineState *machine)
ioapic_init_gsi(gsi_state, "q35");
}
- pc_register_ferr_irq(x86ms->gsi[13]);
+ x86_register_ferr_irq(x86ms->gsi[13]);
assert(pcms->vmport != ON_OFF_AUTO__MAX);
if (pcms->vmport == ON_OFF_AUTO_AUTO) {
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 5923318..f040a72 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -176,7 +176,6 @@ void vmmouse_set_data(const uint32_t *data);
extern int fd_bootchk;
bool pc_machine_is_smm_enabled(PCMachineState *pcms);
-void pc_register_ferr_irq(qemu_irq irq);
void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp);
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index b772e82..01e052b 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1761,7 +1761,8 @@ int cpu_x86_support_mca_broadcast(CPUX86State *env);
int cpu_get_pic_interrupt(CPUX86State *s);
/* MSDOS compatibility mode FPU exception support */
-void cpu_set_ferr(CPUX86State *s);
+void x86_register_ferr_irq(qemu_irq irq);
+void cpu_clear_ferr(void);
/* mpx_helper.c */
void cpu_sync_bndcs_hflags(CPUX86State *env);
diff --git a/target/i386/fpu_helper.c b/target/i386/fpu_helper.c
index 005f1f6..4db0059 100644
--- a/target/i386/fpu_helper.c
+++ b/target/i386/fpu_helper.c
@@ -26,6 +26,10 @@
#include "exec/cpu_ldst.h"
#include "fpu/softfloat.h"
+#ifdef CONFIG_SOFTMMU
+#include "hw/irq.h"
+#endif
+
#define FPU_RC_MASK 0xc00
#define FPU_RC_NEAR 0x000
#define FPU_RC_DOWN 0x400
@@ -58,6 +62,26 @@
#define floatx80_l2e make_floatx80(0x3fff, 0xb8aa3b295c17f0bcLL)
#define floatx80_l2t make_floatx80(0x4000, 0xd49a784bcd1b8afeLL)
+#if !defined(CONFIG_USER_ONLY)
+static qemu_irq ferr_irq;
+
+void x86_register_ferr_irq(qemu_irq irq)
+{
+ ferr_irq = irq;
+}
+
+void cpu_clear_ferr(void)
+{
+ qemu_irq_lower(ferr_irq);
+}
+
+static void cpu_set_ferr(void)
+{
+ qemu_irq_raise(ferr_irq);
+}
+#endif
+
+
static inline void fpush(CPUX86State *env)
{
env->fpstt = (env->fpstt - 1) & 7;
@@ -137,7 +161,7 @@ static void fpu_raise_exception(CPUX86State *env, uintptr_t
retaddr)
}
#if !defined(CONFIG_USER_ONLY)
else {
- cpu_set_ferr(env);
+ cpu_set_ferr();
}
#endif
}
--
1.8.3.1
- [PULL 25/39] x86/cpu: Add support for UMONITOR/UMWAIT/TPAUSE, (continued)
- [PULL 25/39] x86/cpu: Add support for UMONITOR/UMWAIT/TPAUSE, Paolo Bonzini, 2019/10/24
- [PULL 29/39] hw/i386/pc: Extract pc_i8259_create(), Paolo Bonzini, 2019/10/24
- [PULL 33/39] mc146818rtc: Include mc146818rtc_regs.h directly in mc146818rtc.c, Paolo Bonzini, 2019/10/24
- [PULL 13/39] hw/i386/pc: move shared x86 functions to x86.c and export them, Paolo Bonzini, 2019/10/24
- [PULL 27/39] hw/i386/pc: Extract pc_gsi_create(), Paolo Bonzini, 2019/10/24
- [PULL 31/39] mc146818rtc: move structure to header file, Paolo Bonzini, 2019/10/24
- [PULL 35/39] audio: fix missing break, Paolo Bonzini, 2019/10/24
- [PULL 38/39] target/i386: introduce cpu_set_fpus, Paolo Bonzini, 2019/10/24
- [PULL 37/39] target/i386: move FERR handling to target/i386,
Paolo Bonzini <=
- [PULL 34/39] mc146818rtc: always register rtc to rtc list, Paolo Bonzini, 2019/10/24
- [PULL 39/39] i386: implement IGNNE, Paolo Bonzini, 2019/10/24
- [PULL 36/39] core: replace getpagesize() with qemu_real_host_page_size, Paolo Bonzini, 2019/10/24
- Re: [PULL 00/39] Misc (mostly x86) patches for 2019-10-24, no-reply, 2019/10/25
- Re: [PULL 00/39] Misc (mostly x86) patches for 2019-10-24, Peter Maydell, 2019/10/25