From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Cprb1-0002DQ-Og for qemu-devel@nongnu.org; Sat, 15 Jan 2005 12:20:19 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Cprat-00029U-T2 for qemu-devel@nongnu.org; Sat, 15 Jan 2005 12:20:12 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Cprat-000290-Nt for qemu-devel@nongnu.org; Sat, 15 Jan 2005 12:20:11 -0500 Received: from [213.228.0.62] (helo=postfix4-1.free.fr) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CprNw-0000VA-WE for qemu-devel@nongnu.org; Sat, 15 Jan 2005 12:06:49 -0500 Message-ID: <41E94DA5.9030809@enix.org> Date: Sat, 15 Jan 2005 18:06:45 +0100 From: Thomas Petazzoni MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000402030506060007090703" Subject: [Qemu-devel] [PATCH] Port E9 hack, for debugging purposes 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 Cc: David Decotigny This is a multi-part message in MIME format. --------------000402030506060007090703 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello, Enclosed you'll find a patch that adds port E9 hack support for Qemu. Port E9 hack is a feature available in the Bochs emulator, which is very nice for OS developers working on their own toy OS. It simply adds a device on the I/O port 0xE9. Every character written to this device is written to the console in which Qemu is running. This allows the application running inside Qemu to output tons of debugging messages without the need to have a powerful console driver. The device also answers 0xE9 to every read on this port. This allows the application running inside Qemu to test whether the port E9 hack is enabled or not. The port E9 hack features can be enabled/disabled at compile time using the configure script. By default, it's set to off. Enclosed are : - port-e9-hack.patch, which touches Makefile.target, configure, vl.h and hw/pc.c - port-e9.c, the implementation of the port E9 device, which should be placed inside the hw/ directory. Is it possible to include this feature in Qemu ? Thanks, Thomas -- PETAZZONI Thomas - thomas.petazzoni@enix.org http://thomas.enix.org - Jabber: thomas.petazzoni@jabber.dk KOS: http://kos.enix.org/ - SOS: http://sos.enix.org Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E 1624 F653 CB30 98D3 F7A7 --------------000402030506060007090703 Content-Type: text/plain; name="port-e9-hack.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="port-e9-hack.patch" Index: Makefile.target =================================================================== RCS file: /cvsroot/qemu/qemu/Makefile.target,v retrieving revision 1.55 diff -u -u -r1.55 Makefile.target --- Makefile.target 15 Jan 2005 12:02:56 -0000 1.55 +++ Makefile.target 15 Jan 2005 17:00:17 -0000 @@ -339,6 +339,9 @@ tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) endif +ifdef CONFIG_PORT_E9_HACK +VL_OBJS+=port-e9.o +endif VL_LDFLAGS= # specific flags are needed for non soft mmu emulator Index: configure =================================================================== RCS file: /cvsroot/qemu/qemu/configure,v retrieving revision 1.51 diff -u -u -r1.51 configure --- configure 10 Jan 2005 23:18:50 -0000 1.51 +++ configure 15 Jan 2005 17:00:20 -0000 @@ -76,6 +76,7 @@ gdbstub="yes" slirp="yes" adlib="no" +port_e9_hack="no" oss="no" fmod="no" fmod_lib="" @@ -168,7 +169,9 @@ --disable-slirp) slirp="no" ;; --enable-adlib) adlib="yes" - ;; + ;; + --enable-port-e9-hack) port_e9_hack="yes" + ;; esac done @@ -310,6 +313,7 @@ echo " --enable-fmod enable FMOD audio output driver" echo " --fmod-lib path to FMOD library" echo " --fmod-inc path to FMOD includes" +echo " --enable-port-e9-hack enable port E9 hack" echo "" echo "NOTE: The object files are build at the place where configure is launched" exit 1 @@ -352,6 +356,7 @@ echo "SDL static link $sdl_static" echo "mingw32 support $mingw32" echo "Adlib support $adlib" +echo "Port E9 hack $port_e9_hack" echo -n "FMOD support $fmod" if test $fmod = "yes"; then echo -n " (lib='$fmod_lib' include='$fmod_inc')" @@ -464,6 +469,10 @@ echo "CONFIG_ADLIB=yes" >> $config_mak echo "#define CONFIG_ADLIB 1" >> $config_h fi +if test "$port_e9_hack" = "yes" ; then + echo "CONFIG_PORT_E9_HACK=yes" >> $config_mak + echo "#define CONFIG_PORT_E9_HACK 1" >> $config_h +fi if test "$oss" = "yes" ; then echo "CONFIG_OSS=yes" >> $config_mak echo "#define CONFIG_OSS 1" >> $config_h Index: vl.h =================================================================== RCS file: /cvsroot/qemu/qemu/vl.h,v retrieving revision 1.66 diff -u -u -r1.66 vl.h --- vl.h 15 Jan 2005 12:02:56 -0000 1.66 +++ vl.h 15 Jan 2005 17:00:20 -0000 @@ -828,4 +828,9 @@ int gdbserver_start(int port); +#ifdef CONFIG_PORT_E9_HACK +/* port-e9.c */ +void port_e9_init(void); +#endif /* CONFIG_PORT_E9_HACK */ + #endif /* VL_H */ Index: hw/pc.c =================================================================== RCS file: /cvsroot/qemu/qemu/hw/pc.c,v retrieving revision 1.35 diff -u -u -r1.35 pc.c --- hw/pc.c 15 Jan 2005 12:02:56 -0000 1.35 +++ hw/pc.c 15 Jan 2005 17:00:20 -0000 @@ -586,7 +586,9 @@ } floppy_controller = fdctrl_init(6, 2, 0, 0x3f0, fd_table); - +#ifdef CONFIG_PORT_E9_HACK + port_e9_init(); +#endif cmos_init(ram_size, boot_device, bs_table); /* must be done after all PCI devices are instanciated */ --------------000402030506060007090703 Content-Type: text/x-csrc; name="port-e9.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="port-e9.c" /* * 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 #include #include #include "vl.h" static void bochs_e9_write(void *opaque, uint32_t address, uint32_t data) { write(fileno(stdout), &data, 1); } static uint32_t bochs_e9_read(void *opaque, uint32_t address) { return 0xE9; } void port_e9_init () { register_ioport_write(0xe9, 1, 1, bochs_e9_write, NULL); register_ioport_read (0xe9, 1, 1, bochs_e9_read, NULL); } --------------000402030506060007090703--