[SOS] Hack qemu 0xe9: vs 0.8.2
Nicolas Martyanoff
khaelin at gmail.com
Dim 24 Sep 00:50:04 CEST 2006
Je viens de mettre à jour le patch e9 pour qemu 0.8.2 à partir du patch
pour 0.8.1 présenté sur la mailing-liste.
Le tout compile très bien, mais il semble qu'il y ait un petit problème.
Je lance qemu avec:
qemu -fda osb_image_disk.bin -k fr -no-kqemu -port-e9 vc
Et rien ne sort, alors que mon kernel qui ne fait rien d'autre
qu'envoyer des messages sur ce port e9, fonctionnait très bien sur
un qemu 0.7.2 avec le patch d'origine.
Si quelqu'un voit ce qui ne va pas, et peut tester, ça interessera
peut-être du monde :)
diff -Npur qemu-0.8.2/Makefile.target qemu-e9-0.8.2/Makefile.target
--- qemu-0.8.2/Makefile.target 2006-07-22 19:23:34.000000000 +0200
+++ qemu-e9-0.8.2/Makefile.target 2006-09-24 00:03:24.000000000
+0200
@@ -336,7 +336,7 @@ VL_OBJS+= ne2000.o rtl8139.o pcnet.o
ifeq ($(TARGET_BASE_ARCH), i386)
# Hardware support
VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
-VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
+VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
port_e9.o
VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
VL_OBJS+= usb-uhci.o
DEFINES += -DHAS_AUDIO
diff -Npur qemu-0.8.2/port_e9.c qemu-e9-0.8.2/port_e9.c
--- qemu-0.8.2/port_e9.c 1970-01-01 01:00:00.000000000 +0100
+++ qemu-e9-0.8.2/port_e9.c 2006-09-23 23:58:47.000000000 +0200
@@ -0,0 +1,51 @@
+/*
+ * QEMU Port 0xe9 hack
+ *
+ * Copyright (c) 2000-2004 E. Marty, the bochs team, D.Decotigny
+ *
+ * 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 <stdio.h>
+#include <unistd.h>
+#include <inttypes.h>
+
+#include "vl.h"
+
+static void port_e9_write(void *opaque, uint32_t address, uint32_t
data)
+{
+ CharDriverState *chr;
+ chr = opaque;
+
+ qemu_chr_write(chr, & data, 1);
+}
+
+static uint32_t port_e9_read(void *opaque, uint32_t address)
+{
+ return 0xE9;
+}
+
+CharDriverState *port_e9_init (CharDriverState *chr)
+{
+ register_ioport_write(0xe9, 1, 1, port_e9_write, chr);
+ register_ioport_read (0xe9, 1, 1, port_e9_read, chr);
+
+ return chr;
+}
+
diff -Npur qemu-0.8.2/vl.c qemu-e9-0.8.2/vl.c
--- qemu-0.8.2/vl.c 2006-07-22 19:23:34.000000000 +0200
+++ qemu-e9-0.8.2/vl.c 2006-09-24 00:13:20.000000000 +0200
@@ -139,6 +139,7 @@ int graphic_height = 600;
int graphic_depth = 15;
int full_screen = 0;
CharDriverState *serial_hds[MAX_SERIAL_PORTS];
+CharDriverState *port_e9_hds[MAX_PORT_E9_PORTS];
CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
#ifdef TARGET_I386
int win2k_install_hack = 0;
@@ -5291,6 +5292,7 @@ enum {
QEMU_OPTION_monitor,
QEMU_OPTION_serial,
QEMU_OPTION_parallel,
+ QEMU_OPTION_port_e9,
QEMU_OPTION_loadvm,
QEMU_OPTION_full_screen,
QEMU_OPTION_pidfile,
@@ -5366,6 +5368,7 @@ const QEMUOption qemu_options[] = {
{ "monitor", 1, QEMU_OPTION_monitor },
{ "serial", 1, QEMU_OPTION_serial },
{ "parallel", 1, QEMU_OPTION_parallel },
+ { "port-e9", 1, QEMU_OPTION_port_e9 },
{ "loadvm", HAS_ARG, QEMU_OPTION_loadvm },
{ "full-screen", 0, QEMU_OPTION_full_screen },
{ "pidfile", HAS_ARG, QEMU_OPTION_pidfile },
@@ -5601,6 +5604,8 @@ int main(int argc, char **argv)
char monitor_device[128];
char serial_devices[MAX_SERIAL_PORTS][128];
int serial_device_index;
+ char port_e9_devices[MAX_PORT_E9_PORTS][128];
+ int port_e9_device_index;
char parallel_devices[MAX_PARALLEL_PORTS][128];
int parallel_device_index;
const char *loadvm = NULL;
@@ -5675,6 +5680,11 @@ int main(int argc, char **argv)
for(i = 1; i < MAX_PARALLEL_PORTS; i++)
parallel_devices[i][0] = '\0';
parallel_device_index = 0;
+
+ pstrcpy(port_e9_devices[0], sizeof(port_e9_devices[0]), "vc");
+ for(i = 1; i < MAX_PORT_E9_PORTS; i++)
+ port_e9_devices[i][0] = '\0';
+ port_e9_device_index = 0;
usb_devices_index = 0;
@@ -5968,6 +5978,15 @@ int main(int argc, char **argv)
sizeof(parallel_devices[0]), optarg);
parallel_device_index++;
break;
+ case QEMU_OPTION_port_e9:
+ if (port_e9_device_index >= MAX_PORT_E9_PORTS) {
+ fprintf(stderr, "qemu: too many port e9
ports\n");
+ exit(1);
+ }
+ pstrcpy(port_e9_devices[port_e9_device_index],
+ sizeof(port_e9_devices[0]), optarg);
+ port_e9_device_index++;
+ break;
case QEMU_OPTION_loadvm:
loadvm = optarg;
break;
@@ -6179,6 +6198,19 @@ int main(int argc, char **argv)
qemu_chr_printf(parallel_hds[i], "parallel%d
console\r\n", i);
}
}
+
+ for (i=0 ; i<MAX_PORT_E9_PORTS ; i++) {
+ if (port_e9_devices[i][0] != '\0') {
+ port_e9_hds[i] = qemu_chr_open(port_e9_devices[i]);
+ if (!port_e9_hds[i]) {
+ fprintf(stderr, "qemu: could not open port e9
device '%s'\n", port_e9_devices[i]);
+ exit(1);
+ }
+ if (!strcmp(port_e9_devices[i], "vc"))
+ qemu_chr_printf(port_e9_hds[i], "port_e9_%d
console\n", i);
+ }
+ }
+
machine->init(ram_size, vga_ram_size, boot_device,
ds, fd_filename, snapshot,
diff -Npur qemu-0.8.2/vl.h qemu-e9-0.8.2/vl.h
--- qemu-0.8.2/vl.h 2006-07-22 19:23:34.000000000 +0200
+++ qemu-e9-0.8.2/vl.h 2006-09-23 23:58:47.000000000 +0200
@@ -313,6 +313,15 @@ extern CharDriverState *serial_hds[MAX_S
extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
+/* port E9 ports */
+#define MAX_PORT_E9_PORTS 1
+
+#if (MAX_PORT_E9_PORTS != 1)
+ #error "No more than one port E9 is supported"
+#endif
+
+extern CharDriverState *port_e9_hds[MAX_PORT_E9_PORTS];
+
/* VLANs support */
typedef struct VLANClientState VLANClientState;
@@ -859,6 +868,9 @@ SerialState *serial_mm_init (SetIRQFunc
typedef struct ParallelState ParallelState;
ParallelState *parallel_init(int base, int irq, CharDriverState *chr);
+/* port-e9.c */
+CharDriverState *port_e9_init(CharDriverState *chr);
+
/* i8259.c */
typedef struct PicState2 PicState2;
--
+-----------------------------+
| Nicolas 'galdor' Martyanoff |
| khaelin at gmail.com |
| galdor at jabber.org |
+-----------------------------+
Plus d'informations sur la liste de diffusion Sos