[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Implement PC port80 debug register.
From: |
Jordan Justen |
Subject: |
[Qemu-devel] [PATCH] Implement PC port80 debug register. |
Date: |
Mon, 29 Jun 2009 01:05:25 -0700 |
From: jljusten <address@hidden(none)>
In PC systems, the byte I/O port 0x80 is commonly made into a
read/write byte. BIOS and/or system software will often use
it as a simple checkpoint marker.
Signed-off-by: Jordan Justen <address@hidden>
---
Makefile.target | 2 +-
hw/pc.c | 6 +---
hw/pc.h | 7 ++++
hw/port80.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 96 insertions(+), 6 deletions(-)
create mode 100644 hw/port80.c
diff --git a/Makefile.target b/Makefile.target
index a0f24fa..2173ce2 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -572,7 +572,7 @@ OBJS += wdt_ib700.o wdt_i6300esb.o
ifeq ($(TARGET_BASE_ARCH), i386)
# Hardware support
OBJS+= ide.o pckbd.o vga.o $(SOUND_HW) dma.o
-OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
+OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o port80.o pc.o
OBJS+= cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
OBJS += device-hotplug.o pci-hotplug.o smbios.o
diff --git a/hw/pc.c b/hw/pc.c
index 86e5cfe..19d5017 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -84,10 +84,6 @@ static void option_rom_setup_reset(target_phys_addr_t addr,
unsigned size)
qemu_register_reset(option_rom_reset, 0, rrd);
}
-static void ioport80_write(void *opaque, uint32_t addr, uint32_t data)
-{
-}
-
/* MSDOS compatibility mode FPU exception support */
static qemu_irq ferr_irq;
/* XXX: add IGNNE support */
@@ -1011,7 +1007,7 @@ static void pc_init1(ram_addr_t ram_size,
}
/* init basic PC hardware */
- register_ioport_write(0x80, 1, 1, ioport80_write, NULL);
+ port80_init();
register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL);
diff --git a/hw/pc.h b/hw/pc.h
index 9fbae20..1d0423e 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -166,4 +166,11 @@ void pci_piix4_ide_init(PCIBus *bus, BlockDriverState
**hd_table, int devfn,
void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd);
int cpu_is_bsp(CPUState *env);
+
+/* port80.c */
+
+typedef struct Port80State Port80State;
+
+Port80State *port80_init(void);
+
#endif
diff --git a/hw/port80.c b/hw/port80.c
new file mode 100644
index 0000000..7472bad
--- /dev/null
+++ b/hw/port80.c
@@ -0,0 +1,87 @@
+/*
+ * QEMU debug port 80 emulation
+ *
+ * Copyright (c) 2003-2004 Fabrice Bellard
+ * Copyright (c) 2009 Jordan Justen
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include "hw.h"
+#include "sysemu.h"
+#include "pc.h"
+#include "isa.h"
+
+//#define DEBUG_PORT80
+
+struct Port80State {
+ uint8_t data;
+};
+
+static void port80_ioport_write(void *opaque, uint32_t addr, uint32_t data)
+{
+ Port80State *s = opaque;
+
+#ifdef DEBUG_PORT80
+ printf("port%02x: write val=0x%02x\n", addr, data);
+#endif
+ s->data = data;
+}
+
+static uint32_t port80_ioport_read(void *opaque, uint32_t addr)
+{
+ Port80State *s = opaque;
+ int ret;
+ ret = s->data;
+#ifdef DEBUG_PORT80
+ printf("port%02x: read val=0x%02x\n", addr, ret);
+#endif
+ return ret;
+}
+
+static void port80_save(QEMUFile *f, void *opaque)
+{
+ Port80State *s = opaque;
+
+ qemu_put_byte(f, s->data);
+}
+
+static int port80_load(QEMUFile *f, void *opaque, int version_id)
+{
+ Port80State *s = opaque;
+
+ if (version_id != 1)
+ return -EINVAL;
+
+ s->data = qemu_get_byte(f);
+ return 0;
+}
+
+Port80State *port80_init()
+{
+ Port80State *s;
+
+ s = qemu_mallocz(sizeof(Port80State));
+
+ register_ioport_write(0x80, 1, 1, port80_ioport_write, s);
+ register_ioport_read(0x80, 1, 1, port80_ioport_read, s);
+
+ register_savevm("port80", 0x80, 1, port80_save, port80_load, s);
+ return s;
+}
+
--
1.6.0.4
- [Qemu-devel] [PATCH] Implement PC port80 debug register.,
Jordan Justen <=
- Re: [Qemu-devel] [PATCH] Implement PC port80 debug register., Anthony Liguori, 2009/06/29
- Re: [Qemu-devel] [PATCH] Implement PC port80 debug register., Paul Brook, 2009/06/29
- Re: [Qemu-devel] [PATCH] Implement PC port80 debug register., Avi Kivity, 2009/06/29
- Re: [Qemu-devel] [PATCH] Implement PC port80 debug register., Chris Lalancette, 2009/06/29
- Re: [Qemu-devel] [PATCH] Implement PC port80 debug register., Jordan Justen, 2009/06/29
- Re: [Qemu-devel] [PATCH] Implement PC port80 debug register., Anthony Liguori, 2009/06/29
- Re: [Qemu-devel] [PATCH] Implement PC port80 debug register., Jordan Justen, 2009/06/29
- Re: [Qemu-devel] [PATCH] Implement PC port80 debug register., Avi Kivity, 2009/06/29
- Re: [Qemu-devel] [PATCH] Implement PC port80 debug register., Anthony Liguori, 2009/06/29
- Re: [Qemu-devel] [PATCH] Implement PC port80 debug register., Avi Kivity, 2009/06/29