Re: [Qemu-devel] Tracing guest memory accesses

2006-12-18 Thread Diwaker Gupta

as far as i remember i had to put the same code into softmmu_header.h to
get "correct" results.
i found it easiest to do this in the ld/st macros in these files (~6
places in code)


This probably sounds stupid but whats the best way to get debug
output? Due to the code generation magic qemu does, simply adding
printfs doesn't seem to work well. In particular, all my attempts to
add printfs to softmmu_header.h have resulted in broken builds. Are
there any global macros I should be using?

Thanks,
Diwaker
--
Web/Blog/Gallery: http://floatingsun.net/blog


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] [Patch] qemu block-raw.c (fix needed for Windows)

2006-12-18 Thread Stefan Weil
This patch adds a dummy function which fixes a
linker error (missing symbol) for Windows.

Regards
Stefan Weil

Index: block-raw.c
===
RCS file: /sources/qemu/qemu/block-raw.c,v
retrieving revision 1.10
diff -u -b -B -r1.10 block-raw.c
--- block-raw.c 3 Sep 2006 12:08:37 -   1.10
+++ block-raw.c 18 Dec 2006 19:28:19 -
@@ -1134,6 +1134,10 @@
 {
 }

+void qemu_aio_flush(void)
+{
+}
+
 void qemu_aio_wait_start(void)
 {
 }

Paul Brook schrieb:
> CVSROOT: /sources/qemu
> Module name: qemu
> Changes by: Paul Brook  06/09/03 12:08:37
>
> Modified files:
> . : block-raw.c vl.c vl.h
>
> Log message:
> Flush IO requests before savevm (original patch by Blue Swirl).
>
> CVSWeb URLs:
> http://cvs.savannah.gnu.org/viewcvs/qemu/block-raw.c?cvsroot=qemu&r1=1.9&r2=1.10
> http://cvs.savannah.gnu.org/viewcvs/qemu/vl.c?cvsroot=qemu&r1=1.210&r2=1.211
> http://cvs.savannah.gnu.org/viewcvs/qemu/vl.h?cvsroot=qemu&r1=1.145&r2=1.146



___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] Tracing guest memory accesses

2006-12-18 Thread maestro
Am Montag, den 18.12.2006, 00:56 -0800 schrieb Diwaker Gupta:
> > as far as i remember i had to put the same code into softmmu_header.h to
> > get "correct" results.
> > i found it easiest to do this in the ld/st macros in these files (~6
> > places in code)
> 
> This probably sounds stupid but whats the best way to get debug
> output? Due to the code generation magic qemu does, simply adding
> printfs doesn't seem to work well. In particular, all my attempts to
> add printfs to softmmu_header.h have resulted in broken builds. Are
> there any global macros I should be using?
> 
hello Diwaker!

you can always call a function that is defined extern that uses fprintf
et. al. i doubt it's the prettiest way but at least it works.

cheers
m.





___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] [PATCH 3/3] [UPDATE] Add daemonize option

2006-12-18 Thread Anthony Liguori

Anthony Liguori wrote:

@@ -6826,9 +6833,59 @@ int main(int argc, char **argv)
 case QEMU_OPTION_no_reboot:
 no_reboot = 1;
 break;
+   case QEMU_OPTION_daemonize:
+   daemonize = 1;
 }
  


The indenting is off here and it's missing a break.  New patch 
attached.  Sorry 'bout that.


BTW, all of these patches are available in my QEMU patch queue 
(including a few that I haven't yet submitted here).


http://hg.codemonkey.ws/qemu-pq

Regards,

Anthony Liguori

diff -r 74a061504619 qemu-doc.texi
--- a/qemu-doc.texi	Mon Dec 18 18:39:18 2006 -0600
+++ b/qemu-doc.texi	Mon Dec 18 18:39:20 2006 -0600
@@ -308,6 +308,12 @@ Start in full screen.
 @item -pidfile file
 Store the QEMU process PID in @var{file}. It is useful if you launch QEMU
 from a script.
+
[EMAIL PROTECTED] -daemonize
+Daemonize the QEMU process after initialization.  QEMU will not detach from
+standard IO until it is ready to receive connections on any of its devices.
+This option is a useful way for external programs to launch QEMU without having
+to cope with initialization race conditions.
 
 @item -win2k-hack
 Use it when installing Windows 2000 to avoid a disk full bug. After
diff -r 74a061504619 vl.c
--- a/vl.c	Mon Dec 18 18:39:18 2006 -0600
+++ b/vl.c	Mon Dec 18 18:39:32 2006 -0600
@@ -163,6 +163,7 @@ int acpi_enabled = 1;
 int acpi_enabled = 1;
 int fd_bootchk = 1;
 int no_reboot = 0;
+int daemonize = 0;
 
 /***/
 /* x86 ISA bus support */
@@ -6018,6 +6019,9 @@ void help(void)
"-no-reboot  exit instead of rebooting\n"
"-loadvm filestart right away with a saved state (loadvm in monitor)\n"
 	   "-vnc displaystart a VNC server on display\n"
+#ifndef _WIN32
+	   "-daemonize  daemonize QEMU after initializing\n"
+#endif
"\n"
"During emulation, the following keys are useful:\n"
"ctrl-alt-f  toggle full screen\n"
@@ -6098,6 +6102,7 @@ enum {
 QEMU_OPTION_vnc,
 QEMU_OPTION_no_acpi,
 QEMU_OPTION_no_reboot,
+QEMU_OPTION_daemonize,
 };
 
 typedef struct QEMUOption {
@@ -6178,6 +6183,7 @@ const QEMUOption qemu_options[] = {
 { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
 { "no-acpi", 0, QEMU_OPTION_no_acpi },
 { "no-reboot", 0, QEMU_OPTION_no_reboot },
+{ "daemonize", 0, QEMU_OPTION_daemonize },
 { NULL },
 };
 
@@ -6408,6 +6414,7 @@ int main(int argc, char **argv)
 QEMUMachine *machine;
 char usb_devices[MAX_USB_CMDLINE][128];
 int usb_devices_index;
+int fds[2];
 
 LIST_INIT (&vm_change_state_head);
 #ifndef _WIN32
@@ -6826,9 +6833,60 @@ int main(int argc, char **argv)
 case QEMU_OPTION_no_reboot:
 no_reboot = 1;
 break;
+	case QEMU_OPTION_daemonize:
+		daemonize = 1;
+		break;
 }
 }
 }
+
+#ifndef _WIN32
+if (daemonize && !nographic && vnc_display == NULL) {
+	fprintf(stderr, "Can only daemonize if using -nographic or -vnc\n");
+	daemonize = 0;
+}
+
+if (daemonize) {
+	pid_t pid;
+
+	if (pipe(fds) == -1)
+	exit(1);
+
+	pid = fork();
+	if (pid > 0) {
+	uint8_t status;
+	ssize_t len;
+
+	close(fds[1]);
+
+	again:
+	len = read(fds[0], &status, 1);
+	if (len == -1 && (errno == EINTR))
+		goto again;
+	
+	if (len != 1 || status != 0)
+		exit(1);
+	else
+		exit(0);
+	} else if (pid < 0)
+	exit(1);
+
+	setsid();
+
+	pid = fork();
+	if (pid > 0)
+	exit(0);
+	else if (pid < 0)
+	exit(1);
+
+	umask(027);
+	chdir("/");
+
+signal(SIGTSTP, SIG_IGN);
+signal(SIGTTOU, SIG_IGN);
+signal(SIGTTIN, SIG_IGN);
+}
+#endif
 
 #ifdef USE_KQEMU
 if (smp_cpus > 1)
@@ -7028,6 +7086,30 @@ int main(int argc, char **argv)
 }
 }
 
+if (daemonize) {
+	uint8_t status = 0;
+	ssize_t len;
+	int fd;
+
+again1:
+	len = write(fds[1], &status, 1);
+	if (len == -1 && (errno == EINTR))
+	goto again1;
+
+	if (len != 1)
+	exit(1);
+
+	fd = open("/dev/null", O_RDWR);
+	if (fd == -1)
+	exit(1);
+
+	dup2(fd, 0);
+	dup2(fd, 1);
+	dup2(fd, 2);
+
+	close(fd);
+}
+
 main_loop();
 quit_timers();
 return 0;
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] [PATCH] Improve gcc 3 checking

2006-12-18 Thread Anthony Liguori
In Xen, we use a single top level Makefile to build everything.  This 
means we automatically kick off the configure script.  It would be nice 
if QEMU's configure did a better job of finding existing GCC 3.x 
installs so that the user didn't have to manually specific the location.


The attached patch adds a white list to configure to check for various 
versions of GCC 3.x.  The white list so far covers the various versions 
of GCC in recent versions of OpenSUSE, Fedora, RHEL, and Ubuntu 
(presumably also Debian).


I don't think this patch will impact any of the other platforms but 
getting some testing first on weird platforms (Solaris and Win32 
especially) would be helpful.


Regards,

Anthony Liguori
diff -r ca36b7b88df2 configure
--- a/configure	Mon Dec 18 18:57:19 2006 -0600
+++ b/configure	Mon Dec 18 20:18:01 2006 -0600
@@ -22,6 +22,7 @@ static="no"
 static="no"
 cross_prefix=""
 cc="gcc"
+gcc3_list="gcc32 gcc33 gcc34 gcc-3.2 gcc-3.3 gcc-3.4"
 host_cc="gcc"
 ar="ar"
 make="make"
@@ -311,6 +312,41 @@ if test "$mingw32" = "yes" ; then
 oss="no"
 if [ "$cpu" = "i386" ] ; then
 kqemu="yes"
+fi
+fi
+
+# Check for gcc4, error if pre-gcc4 
+if test "$check_gcc" = "yes" ; then
+cat > $TMPC <&/dev/null
+	return $?
+}
+
+if check_cc "$cc" ; then
+	echo "WARNING: \"$cc\" looks like gcc 4.x"
+	echo "Looking for gcc 3.x"
+	found_compat_cc="no"
+	for compat_cc in $gcc3_list ; do
+	if check_cc "$compat_cc" ; then
+		echo "Found \"$compat_cc\""
+		cc="$compat_cc"
+		found_compat_cc="yes"
+		break
+	fi
+	done
+	if test "$found_compat_cc" = "no" ; then
+	echo "gcc 3.x not found!"
+	echo "QEMU is known to have problems when compiled with gcc 4.x"
+	echo "It is recommended that you use gcc 3.x to build QEMU"
+	echo "To use this compiler anyway, configure with --disable-gcc-check"
+	exit 1;
+	fi
 fi
 fi
 
@@ -414,23 +450,6 @@ have_gcc3_options="no"
 have_gcc3_options="no"
 if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
have_gcc3_options="yes"
-fi
-
-# Check for gcc4, error if pre-gcc4 
-if test "$check_gcc" = "yes" ; then
-cat > $TMPC 

Re: [Qemu-devel] [PATCH] Improve gcc 3 checking

2006-12-18 Thread Paul Brook
On Tuesday 19 December 2006 02:25, Anthony Liguori wrote:
> +gcc3_list="gcc32 gcc33 gcc34 gcc-3.2 gcc-3.3 gcc-3.4"

Shouldn't we be preferring newer compilers?

> +   echo "Looking for gcc 3.x"

We shouldn't do this if if the user explicitly specified a compiler.
Replacing explicit user setting with guesses is bad.

Paul


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] [PATCH] Improve gcc 3 checking

2006-12-18 Thread Anthony Liguori

Paul Brook wrote:

On Tuesday 19 December 2006 02:25, Anthony Liguori wrote:
  

+gcc3_list="gcc32 gcc33 gcc34 gcc-3.2 gcc-3.3 gcc-3.4"



Shouldn't we be preferring newer compilers?
  


Attached patch changes order plus improves the initial GCC 4 check a bit.


+   echo "Looking for gcc 3.x"



We shouldn't do this if if the user explicitly specified a compiler.
Replacing explicit user setting with guesses is bad.
  


This stuff kicks in only if the user doesn't specific 
--disable-gcc-check and CC is not GCC 4.


So if the user specific a valid --cc=, then this check won't get triggered.

If they explicitly specific an invalid --cc=, the checks will get 
triggered (but in the past, we would have bailed).


So, if the user wants to explicitly specify a compiler, they can happily 
do that.


Regards,

Anthony Liguori



Paul


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel
  


diff -r f928121a13c1 configure
--- a/configure	Mon Dec 18 20:29:34 2006 -0600
+++ b/configure	Mon Dec 18 20:54:20 2006 -0600
@@ -22,6 +22,7 @@ static="no"
 static="no"
 cross_prefix=""
 cc="gcc"
+gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
 host_cc="gcc"
 ar="ar"
 make="make"
@@ -311,6 +312,41 @@ if test "$mingw32" = "yes" ; then
 oss="no"
 if [ "$cpu" = "i386" ] ; then
 kqemu="yes"
+fi
+fi
+
+# Check for gcc4, error if pre-gcc4 
+if test "$check_gcc" = "yes" ; then
+cat > $TMPC <&/dev/null
+	return $?
+}
+
+if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
+	echo "WARNING: \"$cc\" looks like gcc 4.x"
+	echo "Looking for gcc 3.x"
+	found_compat_cc="no"
+	for compat_cc in $gcc3_list ; do
+	if check_cc "$compat_cc" ; then
+		echo "Found \"$compat_cc\""
+		cc="$compat_cc"
+		found_compat_cc="yes"
+		break
+	fi
+	done
+	if test "$found_compat_cc" = "no" ; then
+	echo "gcc 3.x not found!"
+	echo "QEMU is known to have problems when compiled with gcc 4.x"
+	echo "It is recommended that you use gcc 3.x to build QEMU"
+	echo "To use this compiler anyway, configure with --disable-gcc-check"
+	exit 1;
+	fi
 fi
 fi
 
@@ -414,23 +450,6 @@ have_gcc3_options="no"
 have_gcc3_options="no"
 if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
have_gcc3_options="yes"
-fi
-
-# Check for gcc4, error if pre-gcc4 
-if test "$check_gcc" = "yes" ; then
-cat > $TMPC 

Re: [Qemu-devel] [PATCH] Improve gcc 3 checking

2006-12-18 Thread Paul Brook
> If they explicitly specific an invalid --cc=, the checks will get
> triggered (but in the past, we would have bailed).

That's what I'm objecting to. If I do:

./configure --cc=gcc4

I expect configure to either use gcc4 or fail with an error. Preferably the 
latter, but I'm open to persuasion.

I don't want configure to decide it knows better and use gcc3 anyway.

Paul


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] TCP_NODELAY for -redir

2006-12-18 Thread Daniel Jacobowitz
On Mon, Nov 13, 2006 at 02:30:27PM -0500, Daniel Jacobowitz wrote:
> I was trying to run GDB remote debug tests through a -redir socket
> today.  It crawled unbelievably.  Paul guessed that slirp wasn't using
> TCP_NODELAY, and Nagle was to blame.
> 
> He was even righter than usual.  Adding TCP_NODELAY speeds up this
> particular workload by (very approximately) 54x.  See trivial attached
> patch.

Ping.  I still think this patch is a good idea for the reasons
previously explained.

> Index: qemu/slirp/tcp.h
> ===
> --- qemu.orig/slirp/tcp.h 2006-11-13 14:25:24.0 -0500
> +++ qemu/slirp/tcp.h  2006-11-13 14:25:29.0 -0500
> @@ -112,7 +112,7 @@ struct tcphdr {
>  /*
>   * User-settable options (used with setsockopt).
>   */
> -/* #define   TCP_NODELAY 0x01 */ /* don't delay send to coalesce packets 
> */
> +#define  TCP_NODELAY 0x01/* don't delay send to coalesce packets 
> */
>  /* #define   TCP_MAXSEG  0x02 */ /* set maximum segment size */
>  
>  /*
> Index: qemu/slirp/tcp_subr.c
> ===
> --- qemu.orig/slirp/tcp_subr.c2006-11-13 14:22:34.0 -0500
> +++ qemu/slirp/tcp_subr.c 2006-11-13 14:23:31.0 -0500
> @@ -499,6 +499,8 @@ tcp_connect(inso)
>   setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int));
>   opt = 1;
>   setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int));
> + opt = 1;
> + setsockopt(s,IPPROTO_TCP,TCP_NODELAY,(char *)&opt,sizeof(int));
>   
>   so->so_fport = addr.sin_port;
>   so->so_faddr = addr.sin_addr;
> 
> 

-- 
Daniel Jacobowitz
CodeSourcery


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] [PATCH] Improve gcc 3 checking

2006-12-18 Thread Anthony Liguori

Paul Brook wrote:

If they explicitly specific an invalid --cc=, the checks will get
triggered (but in the past, we would have bailed).



That's what I'm objecting to. If I do:

./configure --cc=gcc4

I expect configure to either use gcc4 or fail with an error. Preferably the 
latter, but I'm open to persuasion.


I don't want configure to decide it knows better and use gcc3 anyway.
  


Okay, it now will throw an error if you specify --cc=gcc4.

Regards,

Anthony Liguori


Paul
  


diff -r f928121a13c1 configure
--- a/configure	Mon Dec 18 20:29:34 2006 -0600
+++ b/configure	Mon Dec 18 21:20:36 2006 -0600
@@ -22,6 +22,8 @@ static="no"
 static="no"
 cross_prefix=""
 cc="gcc"
+gcc3_check="yes"
+gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
 host_cc="gcc"
 ar="ar"
 make="make"
@@ -178,6 +180,7 @@ for opt do
   --cross-prefix=*) cross_prefix="$optarg"
   ;;
   --cc=*) cc="$optarg"
+  gcc3_check="no"
   ;;
   --host-cc=*) host_cc="$optarg"
   ;;
@@ -311,6 +314,45 @@ if test "$mingw32" = "yes" ; then
 oss="no"
 if [ "$cpu" = "i386" ] ; then
 kqemu="yes"
+fi
+fi
+
+# Check for gcc4, error if pre-gcc4 
+if test "$check_gcc" = "yes" ; then
+cat > $TMPC <&/dev/null
+	return $?
+}
+
+if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
+	echo "WARNING: \"$cc\" looks like gcc 4.x"
+	found_compat_cc="no"
+	if test "$gcc3_check" = "yes" ; then
+	echo "Looking for gcc 3.x"
+	for compat_cc in $gcc3_list ; do
+		if check_cc "$compat_cc" ; then
+		echo "Found \"$compat_cc\""
+		cc="$compat_cc"
+		found_compat_cc="yes"
+		break
+		fi
+	done
+	if test "$found_compat_cc" = "no" ; then
+		echo "gcc 3.x not found!"
+	fi
+	fi
+	if test "$found_compat_cc" = "no" ; then
+	echo "QEMU is known to have problems when compiled with gcc 4.x"
+	echo "It is recommended that you use gcc 3.x to build QEMU"
+	echo "To use this compiler anyway, configure with --disable-gcc-check"
+	exit 1;
+	fi
 fi
 fi
 
@@ -414,23 +456,6 @@ have_gcc3_options="no"
 have_gcc3_options="no"
 if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
have_gcc3_options="yes"
-fi
-
-# Check for gcc4, error if pre-gcc4 
-if test "$check_gcc" = "yes" ; then
-cat > $TMPC 

[Qemu-devel] qemu configure

2006-12-18 Thread Paul Brook
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Paul Brook  06/12/19 03:31:34

Modified files:
.  : configure 

Log message:
Look for gcc3 (Anthony Liguori).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/configure?cvsroot=qemu&r1=1.112&r2=1.113


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] More PCI ethernet emulations

2006-12-18 Thread Huang, Xinmei

Hello,

Hi Stefan,

I have applied  your eepro100 emulator for vitsta RTM guest, and met
some problems.

Vista complaints :
 The device is not configured correctly.(Code 1). There is no
driver selected for the device information set or element.
 And Hardware Ids in device manager
is:PCI\VEN_8086&DEV_1209&SUBSYS_&REV_09

I 've searched in C:\Windows\inf and got no driver information of
PCI device id=1209, i.e. Vista could not confirgure this device
correctly as it believes this device is unsupported.

So  I made a tiny change in your code, i.e. let PCI device ID=1229
and tried several sub system id, neither of vista's driver could start
eepro100 unfortunately. There's a yellow exclamation mark in device
manager. Eventually, I installed intel's eepro100 driver for vista, this
issue remains ;-(.

Can you help to give me any comment or suggestion?
  
   Thanks a lot


Your original mail:

these new PCI ethernet drivers for QEMU are now available:

* Intel 8255x ("E100", "EEPRO100")

* National Semiconductor DP83815/DP83816

* Both drivers use a new EEPROM driver.

This EEPROM driver can be shared by any other device which needs
an EEPROM, for example replace the driver for RTL8139 or add an
EEPROM to cirrus vga or other ethernet cards.

I estimate the status of the EEPROM driver to be stable.
Fabrice, maybe this part can be integrated in QEMU head.

Both ethernet drivers work with QEMU head and Linux on x86 host / guest,
but have known endianess issues (they will at least need fixes for big
endian hosts) and are experimental. I am still working on them.

Feedback and bug fixes are welcome.

Regards
Stefan Weil

PS. I tried to send this mail several times using a URL for each
new driver file, but these mails did not reach the mailing list.
Are mails with URLs blocked by some mechanism?
Now all new source files are in the tar archive appended to the mail.


> Hello,
>
> I want to run QEMU with disk images of existing PC hardware.
> These PC hardware uses ethernet cards which are not emulated
> by QEMU, and because the disk images only support these cards,
> the current QEMU won't work. So I have to write new emulation
> drivers for QEMU...
>
> These are the emulations needed:
> Intel 8255xER PCI (Linux driver: eepro100)
> Realtek RTL8168/8111 PCI (Linux driver: r1000)
> National Semiconductor DP83815/DP83816 (Linux driver: natsemi)
>
> If somebody already started to write any of these emulations
> this would be really helpful. Any other kind of help is welcome, too.
>
> Regards
> Stefan
>
>

Best Regards
Xinmei.Huang


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel