Re: [Qemu-devel] [PATCH] VNC display support for QEMU

2006-05-01 Thread Brad Campbell

Brad Campbell wrote:

Also I can't access the monitor (which I can with the other vnc patch) 
... again, when I get a chance.


Oh how I wish I'd read the todo carefully.. thumps head on desk

--
Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so. -- Douglas Adams


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


Re: [Qemu-devel] [PATCH] VNC display support for QEMU

2006-05-01 Thread Johannes Schindelin
Hi,

On Mon, 1 May 2006, Brad Campbell wrote:

 I need to look at the protocol and see if there is a way to instruct the 
 client to change its size on the fly also.. at the moment booting win2k 
 I have three different client sizes and need to close/reopen the client 
 for each change.

rfbEncodingNewFBSize. You can find example code in the current CVS of 
LibVNCServer.

Hth,
Dscho



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


[Qemu-devel] qemu vnc.c

2006-05-01 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Branch: 
Changes by: Fabrice Bellard [EMAIL PROTECTED] 06/05/01 10:38:19

Modified files:
.  : vnc.c 

Log message:
copyright

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/vnc.c.diff?tr1=1.2tr2=1.3r1=textr2=text


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


[Qemu-devel] Re: [PATCH] Work around VNC clients that do not transmit shifts for uppercase characters

2006-05-01 Thread Fabrice Bellard
Does it mean that the caps lock keysym is not transmitted by RealVNC ? 
Otherwise converting the upper case to case lower case would suffice.


Fabrice.

Anthony Liguori wrote:
The spec isn't really clear about what a client should do.  This patch 
is needed for RealVNC clients (at least).


Regards,

Anthony Liguori




# HG changeset patch
# User Anthony Liguori [EMAIL PROTECTED]
# Node ID 8a71740fc36fcaf97e126e581847983cb2a4324d
# Parent  a9314fc39a5e3d78d80d385f560c922c3ce0e82b
Fix for VNC clients that do not send Shift's for uppercase characters

diff -r a9314fc39a5e -r 8a71740fc36f vnc.c
--- a/vnc.c Sun Apr 30 19:04:17 2006 -0500
+++ b/vnc.c Sun Apr 30 23:12:48 2006 -0500
@@ -591,11 +591,11 @@ static void pointer_event(VncState *vs, 
 }

 }
 
-static void key_event(VncState *vs, int down, uint32_t sym)

+static void key_event_post(kbd_layout_t *kbd_layout, int down, uint32_t sym)
 {
 int keycode;
 
-keycode = keysym2scancode(vs-kbd_layout, sym  0x);

+keycode = keysym2scancode(kbd_layout, sym  0x);
 
 if (keycode  0x80)

kbd_put_keycode(0xe0);
@@ -603,6 +603,22 @@ static void key_event(VncState *vs, int 
 	kbd_put_keycode(keycode  0x7f);

 else
kbd_put_keycode(keycode | 0x80);
+}
+
+static void key_event(VncState *vs, int down, uint32_t sym)
+{
+
+if (sym = 'A'  sym = 'Z') {
+   sym = (sym - 'A') + 'a';
+   if (down) {
+   key_event_post(vs-kbd_layout, 1, 0xffe1);
+   key_event_post(vs-kbd_layout, 1, sym);
+   key_event_post(vs-kbd_layout, 0, 0xffe1);
+   return;
+   }
+}
+
+key_event_post(vs-kbd_layout, down, sym);
 }
 
 static void framebuffer_update_request(VncState *vs, int incremental,




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


Re: [Qemu-devel] [PATCH] Always use 10.0.2.2 as host addr for -net user (slirp)

2006-05-01 Thread Fabrice Bellard
I am not sure this patch is sufficient: sometimes our_addr is used to 
open socket on the host side and 10.0.2.2 has a meanning only on the VM 
side.


Fabrice.

Ed Swierk wrote:

A couple of serious problems remain in the slirp redirection code
after the patch Paul applied on 23 April.

* If the IP address returned by gethostbyname(gethostname()) is the
address of one of the host's Ethernet interfaces, bringing down that
interface or changing its IP address disrupts redir connections
between the host and VM.

* If the IP address returned by gethostbyname(gethostname()) is
outside the 10.0.2.0/24 subnet, and the user has not manually added
this address to the routing table within the VM (in addition to the
10.0.2.0/24 route added by DHCP), TCP connections from the host to the
VM are never answered, because the response packets are dropped on the
floor.

The attached patch solves both of these problems simply by always
using 10.0.2.2 as our_addr. There seems to be no value in exposing the
host's real address to the VM; thanks to NAT, 10.0.2.2 always works.

--Ed




diff -BurN qemu-snapshot-2006-04-27_23.orig/slirp/misc.c 
qemu-snapshot-2006-04-27_23/slirp/misc.c
--- qemu-snapshot-2006-04-27_23.orig/slirp/misc.c   2006-04-23 
19:41:17.0 +
+++ qemu-snapshot-2006-04-27_23/slirp/misc.c2006-04-27 22:19:40.0 
+
@@ -87,17 +87,7 @@
 void
 getouraddr()
 {
-   char buff[256];
-   struct hostent *he = NULL;
-   
-   if (gethostname(buff,256) == 0)
-he = gethostbyname(buff);
-if (he)
-our_addr = *(struct in_addr *)he-h_addr;
-/* If the host doesn't have a useful IP address then use the
-   guest side address.  */
-if (our_addr.s_addr == 0 || our_addr.s_addr == loopback_addr.s_addr)
-our_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS);
+   our_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS);
 }
 
 #if SIZEOF_CHAR_P == 8





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




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


[Qemu-devel] qemu/slirp mbuf.c

2006-05-01 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Branch: 
Changes by: Fabrice Bellard [EMAIL PROTECTED] 06/05/01 10:59:02

Modified files:
slirp  : mbuf.c 

Log message:
fixed realloc logic (Ed Swierk)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/slirp/mbuf.c.diff?tr1=1.1tr2=1.2r1=textr2=text


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


Re: [Qemu-devel] [PATCH] Fix scrambling of 32KB packets in slirp

2006-05-01 Thread Fabrice Bellard

Ed Swierk wrote:

In several places in qemu's slirp code, signed and unsigned ints are
used interchangeably when dealing with IP packet lengths and offsets.
This causes IP packets greater than 32K in length to be scrambled in
various interesting ways that are extremely difficult to troubleshoot.

Although large IP packets are fairly rare in practice, certain
UDP-based protocols like NFS use them extensively.

The attached patch wraps IP packet lengths and offsets in macros that
ensure they are always properly treated as unsigned values.


Why not changing the definition itself to uint16_t and verifying each 
occurence of ip_off and ip_len ?


Fabrice.


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


[Qemu-devel] qemu/slirp tcp.h

2006-05-01 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Branch: 
Changes by: Fabrice Bellard [EMAIL PROTECTED] 06/05/01 11:17:27

Modified files:
slirp  : tcp.h 

Log message:
set TCP_MSS to 1460 (Ed Swierk)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/slirp/tcp.h.diff?tr1=1.1tr2=1.2r1=textr2=text


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


[Qemu-devel] qemu/slirp tcp_input.c

2006-05-01 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Branch: 
Changes by: Fabrice Bellard [EMAIL PROTECTED] 06/05/01 11:18:01

Modified files:
slirp  : tcp_input.c 

Log message:
do not delay TCP acks (Ed Swierk)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/slirp/tcp_input.c.diff?tr1=1.4tr2=1.5r1=textr2=text


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


Re: [Qemu-devel] [PATCH] Improve -net user (slirp) performance by 4x

2006-05-01 Thread Fabrice Bellard

Ed Swierk wrote:


3. qemu sleeps soundly while packets back up in slirp's buffers. slirp
socket fds should be added to the main qemu select() loop to avoid
unnecessary delays.


I agree, but your patch does not suppress the slirp select(). I tried to 
do it with the following patch but slirp becomes twice slower and I 
cannot get a good explanation. Maybe you could look at that problem so 
that a real correction can be commited.


Regards,

Fabrice.

Index: vl.c
===
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.180
diff -u -w -r1.180 vl.c
--- vl.c30 Apr 2006 22:53:25 -  1.180
+++ vl.c1 May 2006 12:17:36 -
@@ -4361,7 +4361,7 @@
 void main_loop_wait(int timeout)
 {
 IOHandlerRecord *ioh, *ioh_next;
-fd_set rfds, wfds;
+fd_set rfds, wfds, xfds;
 int ret, nfds;
 struct timeval tv;
 PollingEntry *pe;
@@ -4382,6 +4382,7 @@
 nfds = -1;
 FD_ZERO(rfds);
 FD_ZERO(wfds);
+FD_ZERO(xfds);
 for(ioh = first_io_handler; ioh != NULL; ioh = ioh-next) {
 if (ioh-fd_read 
 (!ioh-fd_read_poll ||
@@ -4403,7 +4404,12 @@
 #else
 tv.tv_usec = timeout * 1000;
 #endif
-ret = select(nfds + 1, rfds, wfds, NULL, tv);
+#if defined(CONFIG_SLIRP)
+if (slirp_inited) {
+slirp_select_fill(nfds, rfds, wfds, xfds);
+}
+#endif
+ret = select(nfds + 1, rfds, wfds, xfds, tv);
 if (ret  0) {
 /* XXX: better handling of removal */
 for(ioh = first_io_handler; ioh != NULL; ioh = ioh_next) {
@@ -4416,29 +4422,13 @@
 }
 }
 }
-#ifdef _WIN32
-tap_win32_poll();
-#endif
-
 #if defined(CONFIG_SLIRP)
-/* XXX: merge with the previous select() */
-if (slirp_inited) {
-fd_set rfds, wfds, xfds;
-int nfds;
-struct timeval tv;
-
-nfds = -1;
-FD_ZERO(rfds);
-FD_ZERO(wfds);
-FD_ZERO(xfds);
-slirp_select_fill(nfds, rfds, wfds, xfds);
-tv.tv_sec = 0;
-tv.tv_usec = 0;
-ret = select(nfds + 1, rfds, wfds, xfds, tv);
-if (ret = 0) {
+if (slirp_inited  ret = 0) {
 slirp_select_poll(rfds, wfds, xfds);
 }
-}
+#endif
+#ifdef _WIN32
+tap_win32_poll();
 #endif

 if (vm_running) {


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


Re: [Qemu-devel] [PATCH] Allow -kernel without -hda

2006-05-01 Thread Fabrice Bellard
I agree that the feature is useful, but your patch is incomplete: 
without bs_table[0], the boot sector cannot be created and the Linux 
kernel cannot be launched. Maybe you have a specific Ethernet BIOS to 
enable that ? Someone submitted a new block driver which simulated 
/dev/zero and it may be another solution.


Regards,

Fabrice.

Ed Swierk wrote:

The qemu -kernel option currently requires specifying a hard disk
image with -hda. Ostensibly at least one hard disk is needed for
qemu's boot loader to populate the partition table in its array of
boot sectors.

Passing -hda /dev/zero tricks qemu into booting, which demonstrates
that the requirement is unnecessary. Booting with no disk image is
needed to support diskless configurations where a remote NFS directory
is used as the root filesystem. In this scenario, the user invokes
qemu with -kernel and -initrd options, with a specially configured
initrd that NFS-mounts a filesystem on / before passing control to the
real init.

The attached patch permits using the -kernel option with no disk
images, and skips copying the partition table in this case.

--Ed




diff -BurN qemu-snapshot-2006-03-27_23.orig/hw/pc.c 
qemu-snapshot-2006-03-27_23/hw/pc.c
--- qemu-snapshot-2006-03-27_23.orig/hw/pc.c2006-04-05 13:05:17.0 
+
+++ qemu-snapshot-2006-03-27_23/hw/pc.c 2006-04-05 13:12:40.0 +
@@ -707,10 +707,6 @@
 uint8_t bootsect[512];
 uint8_t old_bootsect[512];
 
-if (bs_table[0] == NULL) {

-fprintf(stderr, A disk image must be given for 'hda' when booting a 
Linux kernel\n);
-exit(1);
-}
 snprintf(buf, sizeof(buf), %s/%s, bios_dir, LINUX_BOOT_FILENAME);
 ret = load_image(buf, bootsect);
 if (ret != sizeof(bootsect)) {
@@ -719,12 +715,14 @@
 exit(1);
 }
 
-if (bdrv_read(bs_table[0], 0, old_bootsect, 1) = 0) {

-/* copy the MSDOS partition table */
-memcpy(bootsect + 0x1be, old_bootsect + 0x1be, 0x40);
-}
+if (bs_table[0]) {
+if (bdrv_read(bs_table[0], 0, old_bootsect, 1) = 0) {
+/* copy the MSDOS partition table */
+memcpy(bootsect + 0x1be, old_bootsect + 0x1be, 0x40);
+}
 
-bdrv_set_boot_sector(bs_table[0], bootsect, sizeof(bootsect));

+bdrv_set_boot_sector(bs_table[0], bootsect, sizeof(bootsect));
+}
 
 /* now we can load the kernel */
 ret = load_kernel(kernel_filename, 





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




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


[Qemu-devel] qemu/hw pc.c

2006-05-01 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Branch: 
Changes by: Fabrice Bellard [EMAIL PROTECTED] 06/05/01 12:31:24

Modified files:
hw : pc.c 

Log message:
increase max kernel size with initrd

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/hw/pc.c.diff?tr1=1.52tr2=1.53r1=textr2=text


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


[Qemu-devel] qemu vl.c

2006-05-01 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Branch: 
Changes by: Fabrice Bellard [EMAIL PROTECTED] 06/05/01 12:43:29

Modified files:
.  : vl.c 

Log message:
fix for hosts resuming from software suspend (initial patch by John 
Coiner)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/vl.c.diff?tr1=1.180tr2=1.181r1=textr2=text


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


[Qemu-devel] solaris configure and fpu/softfloat-native.h

2006-05-01 Thread Ben Taylor
This is a minimal patch to configure and fpu/softfloat-native.h to get qemu to
compile and run on Solaris 10.

Compile support for Solaris 9 and Sparc will be updated in a different patch.

Bendiff -ruN qemu/configure qemu-solaris/configure
--- qemu/configure	2006-04-29 19:05:22.0 -0400
+++ qemu-solaris/configure	2006-05-01 08:37:36.435003000 -0400
@@ -148,9 +148,6 @@
 make=gmake
 install=ginstall
 solarisrev=`uname -r | cut -f2 -d.`
-if test $solarisrev -lt 10 ; then
-  presolaris10=yes
-fi
 fi
 
 # find source path
@@ -640,9 +637,7 @@
 fi
 if test $solaris = yes ; then
   echo CONFIG_SOLARIS=yes  $config_mak
-  if test $presolaris10 = yes ; then
-echo #define _PRESOLARIS10 1  $config_h
-  fi
+  echo #define HOST_SOLARIS $solarisrev  $config_h
 fi
 if test $gdbstub = yes ; then
   echo CONFIG_GDBSTUB=yes  $config_mak
diff -ruN qemu/fpu/softfloat-native.h qemu-solaris/fpu/softfloat-native.h
--- qemu/fpu/softfloat-native.h	2006-05-01 08:41:49.61416 -0400
+++ qemu-solaris/fpu/softfloat-native.h	2006-05-01 08:42:07.850655000 -0400
@@ -1,11 +1,36 @@
 /* Native implementation of soft float functions */
 #include math.h
-#if defined(_BSD)  !defined(__APPLE__)
+
+#if (defined(_BSD)  !defined(__APPLE__)) || defined(HOST_SOLARIS)
 #include ieeefp.h
+#define fabsf(f) ((float)fabs(f))
 #else
-#if !defined(_PRESOLARIS10)
 #include fenv.h
 #endif
+
+/*
+ * Define some C99-7.12.3 classification macros and
+ *some C99-.12.4 for Solaris systems OS less than 10,
+ *or Solaris 10 systems running GCC 3.x or less.
+ *   Solaris 10 with GCC4 does not need these macros as they
+ *   are defined in iso/math_c99.h with a compiler directive
+ */
+#if defined(HOST_SOLARIS)  (( HOST_SOLARIS = 9 ) || ( ( HOST_SOLARIS = 10 )  ( __GNUC__ = 4) ))
+/*
+ * C99 7.12.3 classification macros
+ * and
+ * C99 7.12.14 comparison macros
+ *
+ * ... do not work on Solaris 10 using GNU CC 3.4.x.
+ * Try to workaround the missing / broken C99 math macros.
+ */
+
+#define isnormal(x) (fpclass(x) = FP_NZERO)
+#define isgreater(x, y) ((!unordered(x, y))  ((x)  (y)))
+#define isgreaterequal(x, y)((!unordered(x, y))  ((x) = (y)))
+#define isless(x, y)((!unordered(x, y))  ((x)  (y)))
+#define islessequal(x, y)   ((!unordered(x, y))  ((x) = (y)))
+#define isunordered(x,y)unordered(x, y)
 #endif
 
 typedef float float32;
@@ -35,7 +60,7 @@
 /*
 | Software IEC/IEEE floating-point rounding mode.
 **/
-#if defined(_BSD)  !defined(__APPLE__)
+#if (defined(_BSD)  !defined(__APPLE__)) || defined(HOST_SOLARIS)
 enum {
 float_round_nearest_even = FP_RN,
 float_round_down = FP_RM,
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] qemu vl.c

2006-05-01 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Branch: 
Changes by: Fabrice Bellard [EMAIL PROTECTED] 06/05/01 13:23:04

Modified files:
.  : vl.c 

Log message:
better win32 timers - use win32 event to wake up cpu in idle mode (kazu)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/vl.c.diff?tr1=1.181tr2=1.182r1=textr2=text


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


[Qemu-devel] qemu vl.c

2006-05-01 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Branch: 
Changes by: Fabrice Bellard [EMAIL PROTECTED] 06/05/01 13:28:36

Modified files:
.  : vl.c 

Log message:
workaround: force /dev/rtc usage on Linux

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/vl.c.diff?tr1=1.182tr2=1.183r1=textr2=text


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


[Qemu-devel] qemu vl.c

2006-05-01 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Branch: 
Changes by: Fabrice Bellard [EMAIL PROTECTED] 06/05/01 13:33:02

Modified files:
.  : vl.c 

Log message:
use a single select for slirp and qemu sockets

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/vl.c.diff?tr1=1.183tr2=1.184r1=textr2=text


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


[Qemu-devel] [PATCH]USB tablet auto grab and ungrab

2006-05-01 Thread Scipio
With this patch, automatic grab keyboard and mouse when the mouse enters the 
window, and ungrab when the mouse reachs the window edge.

I created this beacuse I want to close a window with ALT+F4 inside qemu, but I 
closed qemu window, because qemu is not grabbed.

Scipio
diff -u qemu.orig/sdl.c qemu/sdl.c
--- qemu.orig/sdl.c	2006-04-12 23:09:08.0 +0200
+++ qemu/sdl.c	2006-05-01 15:52:43.0 +0200
@@ -330,6 +330,11 @@
 	}
 
 	SDL_GetMouseState(dx, dy);
+	if( dx==0 || dx==width-1 || dy==0 || dy==height-1 ) {
+	if(gui_grab) sdl_grab_end();
+	} else {
+	if(!gui_grab) sdl_grab_start();
+}
 	dx = dx * 0x7FFF / width;
 	dy = dy * 0x7FFF / height;
 }
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] [PATCH] Fix scrambling of 32KB packets in slirp

2006-05-01 Thread Kenneth Duda

Well that is a good question.  When I made this patch, I wanted to
respect the comment in the code that the author felt that using a
signed data type was safer in some cases.  However, I will admit that
I do not understand this reasoning, and I agree that switching to an
unsigned data type would be better.  Would you like us to resubmit
this patch in that form?

   -Ken

On 5/1/06, Fabrice Bellard [EMAIL PROTECTED] wrote:

Ed Swierk wrote:
 In several places in qemu's slirp code, signed and unsigned ints are
 used interchangeably when dealing with IP packet lengths and offsets.
 This causes IP packets greater than 32K in length to be scrambled in
 various interesting ways that are extremely difficult to troubleshoot.

 Although large IP packets are fairly rare in practice, certain
 UDP-based protocols like NFS use them extensively.

 The attached patch wraps IP packet lengths and offsets in macros that
 ensure they are always properly treated as unsigned values.

Why not changing the definition itself to uint16_t and verifying each
occurence of ip_off and ip_len ?

Fabrice.


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




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


Re: [Qemu-devel] PATCH: Solaris 9/sparc host patches

2006-05-01 Thread Ben Taylor

The attachment included this time...

 Ben Taylor [EMAIL PROTECTED] wrote: 
 
 Here is a patch for qemu-CVS to allow qemu to be compiled under Solaris 
 9/Sparc.
 
 the fixes are the following:
 
 vl.c:  add a rtc for sparc (previously Unsupported CPU)
 Makefile/Makefile.target: compile flags to enable proper compilation
 fpu/softfloat-native.c: extension of the _BSD functions and adding Solaris 
 support to that
 target-mips/cpu.h: support for uint_fast8_t and uint_fast16_t  not in Solaris 
 9 and earlier
 dyngen-exec.h: correct register allocation for Solaris/Sparc
 dyngen.c: fix a problem with the size of a label variable (used 
 sizeof(variable) instead
   of namesize,  make the handing of address values use logicals, and add an 
 additioinal
   assembler construct.
 dyngen.h: change the op_gen_labels to (void) instead of (int) for sparc
 cpu-exec.c: change how solaris sparc gets temporary registers
 
 
 
 
 
 ___
 Qemu-devel mailing list
 Qemu-devel@nongnu.org
 http://lists.nongnu.org/mailman/listinfo/qemu-devel
diff -ruN qemu/Makefile qemu-solaris/Makefile
--- qemu/Makefile	2006-04-30 19:54:18.0 -0400
+++ qemu-solaris/Makefile	2006-05-01 10:57:10.174522000 -0400
@@ -4,6 +4,9 @@
 ifdef CONFIG_DARWIN
 CFLAGS+= -mdynamic-no-pic
 endif
+ifeq ($(ARCH),sparc)
+CFLAGS+=-mcpu=ultrasparc
+endif
 LDFLAGS=-g
 LIBS=
 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
diff -ruN qemu/Makefile.target qemu-solaris/Makefile.target
--- qemu/Makefile.target	2006-04-30 17:28:35.0 -0400
+++ qemu-solaris/Makefile.target	2006-05-01 10:57:14.549634000 -0400
@@ -107,6 +107,11 @@
 endif
 
 ifeq ($(ARCH),sparc)
+ifeq ($(CONFIG_SOLARIS),yes)
+CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
+LDFLAGS+=-m32
+OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
+else
 CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
 LDFLAGS+=-m32
 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
@@ -114,6 +119,7 @@
 # -static is used to avoid g1/g3 usage by the dynamic linker
 LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
 endif
+endif
 
 ifeq ($(ARCH),sparc64)
 CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
diff -ruN qemu/cpu-exec.c qemu-solaris/cpu-exec.c
--- qemu/cpu-exec.c	2006-04-27 17:05:14.0 -0400
+++ qemu-solaris/cpu-exec.c	2006-05-01 10:57:44.611665000 -0400
@@ -253,7 +253,7 @@
 uint32_t *saved_regwptr;
 #endif
 #endif
-#ifdef __sparc__
+#if defined(__sparc__)  !defined(HOST_SOLARIS)
 int saved_i7, tmp_T0;
 #endif
 int ret, interrupt_request;
@@ -323,7 +323,7 @@
 #if defined(reg_T2)
 saved_T2 = T2;
 #endif
-#ifdef __sparc__
+#if defined(__sparc__)  !defined(HOST_SOLARIS)
 /* we also save i7 because longjmp may not restore it */
 asm volatile (mov %%i7, %0 : =r (saved_i7));
 #endif
@@ -447,7 +447,7 @@
 
 T0 = 0; /* force lookup of first TB */
 for(;;) {
-#ifdef __sparc__
+#if defined(__sparc__)  !defined(HOST_SOLARIS)
 /* g1 can be modified by some libc? functions */ 
 tmp_T0 = T0;
 #endif	
@@ -467,7 +467,7 @@
 do_interrupt(intno, 0, 0, 0, 1);
 /* ensure that no TB jump will be modified as
the program flow was changed */
-#ifdef __sparc__
+#if defined(__sparc__)  !defined(HOST_SOLARIS)
 tmp_T0 = 0;
 #else
 T0 = 0;
@@ -486,7 +486,7 @@
 			env-error_code = 0;
 do_interrupt(env);
 env-interrupt_request = ~CPU_INTERRUPT_HARD;
-#ifdef __sparc__
+#if defined(__sparc__)  !defined(HOST_SOLARIS)
 tmp_T0 = 0;
 #else
 T0 = 0;
@@ -497,7 +497,7 @@
 env-error_code = 0;
 do_interrupt(env);
 env-interrupt_request = ~CPU_INTERRUPT_TIMER;
-#ifdef __sparc__
+#if defined(__sparc__)  !defined(HOST_SOLARIS)
 tmp_T0 = 0;
 #else
 T0 = 0;
@@ -516,7 +516,7 @@
 env-error_code = 0;
 do_interrupt(env);
 env-interrupt_request = ~CPU_INTERRUPT_HARD;
-#ifdef __sparc__
+#if defined(__sparc__)  !defined(HOST_SOLARIS)
 tmp_T0 = 0;
 #else
 T0 = 0;
@@ -534,7 +534,7 @@
 			env-interrupt_request = ~CPU_INTERRUPT_HARD;
 			do_interrupt(env-interrupt_index);
 			env-interrupt_index = 0;
-#ifdef __sparc__
+#if defined(__sparc__)  !defined(HOST_SOLARIS)
 tmp_T0 = 0;
 #else
 T0 = 0;
@@ -565,7 +565,7 @@
 env-interrupt_request = ~CPU_INTERRUPT_EXITTB;
 /* ensure that no TB jump will be modified as
the program flow was changed */
-#ifdef 

Re: [Qemu-devel] [PATCH] Fix memory leaks in ELF loader

2006-05-01 Thread Fabrice Bellard
Why adding several labels ? qemu_free(NULL) is perfectly valid. I would 
just add the missing qemu_free(phdr) ...


Fabrice.

Dirk Behme wrote:


Fix memory leaks in ELF loader.

Regards

Dirk




--- elf_ops.h_orig  2006-05-01 09:01:47.0 +0200
+++ elf_ops.h   2006-05-01 09:09:34.0 +0200
@@ -148,7 +148,7 @@ int glue(load_elf, SZ)(int fd, int64_t v
 uint8_t *data = NULL;
 
 if (read(fd, ehdr, sizeof(ehdr)) != sizeof(ehdr))

-goto fail;
+goto fail1;
 if (must_swab) {
 glue(bswap_ehdr, SZ)(ehdr);
 }
@@ -162,9 +162,9 @@ int glue(load_elf, SZ)(int fd, int64_t v
 lseek(fd, ehdr.e_phoff, SEEK_SET);
 phdr = qemu_mallocz(size);
 if (!phdr)
-goto fail;
+goto fail2;
 if (read(fd, phdr, size) != size)
-goto fail;
+goto fail2;
 if (must_swab) {
 for(i = 0; i  ehdr.e_phnum; i++) {
 ph = phdr[i];
@@ -181,9 +181,9 @@ int glue(load_elf, SZ)(int fd, int64_t v
 data = qemu_mallocz(mem_size);
 if (ph-p_filesz  0) {
 if (lseek(fd, ph-p_offset, SEEK_SET)  0)
-goto fail;
+goto fail3;
 if (read(fd, data, ph-p_filesz) != ph-p_filesz)
-goto fail;
+goto fail3;
 }
 addr = ph-p_vaddr + virt_to_phys_addend;
 
@@ -195,10 +195,13 @@ int glue(load_elf, SZ)(int fd, int64_t v

 data = NULL;
 }
 }
+qemu_free(phdr);
 return total_size;
- fail:
+ fail3:
 qemu_free(data);
+ fail2:
 qemu_free(phdr);
+ fail1:
 return -1;
 }
 







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




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


Re: [Qemu-devel] PATCH: solaris-sparc-slirp fix

2006-05-01 Thread Leonardo E. Reiter
Ben,

You can use the patch I posted here recently to get QEMU to fix the BGR
problem internally.  It doesn't have to be done at the VNC level - and
in fact, this way, you can use it on the Solaris native X server (or
even SunRays) in 24-bit color mode.  I am attaching a new version of the
patch, complete with the detection logic (to make it automatic), against
today's CVS.

My original post:

http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00181.html

The last (and fast) version:

http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00195.html

An additional hack to get SDL to configure this automatically, without
needing the -bgr option on the command-line:

http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00230.html

Maybe Fabrice or Paul can commit this since I addressed all the original
issues, but have yet to hear feedback on it.  It's working fine for
myself and for my customers using SunRays for several weeks now.  The
only issue is cirrus VGA in 16-bit mode seems to do some optimization
that bypasses the swapping code.  regular VGA or cirrus VGA in 24-bit
mode (on the guest) works fine.

Regards,

Leo Reiter

Ben Taylor wrote:
 snip
 Other than the colors being GBR instead of RGB (and I hear a fix for that in 
 the vnc
 code is in development) it works.
 snip

-- 
Leonardo E. Reiter
Vice President of Product Development, CTO

Win4Lin, Inc.
Virtual Computing that means Business
Main: +1 512 339 7979
Fax: +1 512 532 6501
http://www.win4lin.com
Index: sdl.c
===
RCS file: /cvsroot/qemu/qemu/sdl.c,v
retrieving revision 1.26
diff -a -u -r1.26 sdl.c
--- sdl.c	12 Apr 2006 21:09:08 -	1.26
+++ sdl.c	1 May 2006 18:18:32 -
@@ -548,4 +548,9 @@
 gui_fullscreen_initial_grab = 1;
 sdl_grab_start();
 }
+
+/* guess to use BGR mode by seeing if the blue color mask is greater than
+ * the red color mask, indicating that blue comes before red */
+if (screen-format-Bmask  screen-format-Rmask)
+bgr_display_enabled = 1;
 }
Index: vl.c
===
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.184
diff -a -u -r1.184 vl.c
--- vl.c	1 May 2006 13:33:02 -	1.184
+++ vl.c	1 May 2006 18:18:33 -
@@ -130,6 +130,7 @@
 int vm_running;
 int rtc_utc = 1;
 int cirrus_vga_enabled = 1;
+int bgr_display_enabled = 0;
 #ifdef TARGET_SPARC
 int graphic_width = 1024;
 int graphic_height = 768;
@@ -4603,6 +4604,7 @@
-m megs set virtual RAM size to megs MB [default=%d]\n
-smp n  set the number of CPUs to 'n' [default=1]\n
-nographic  disable graphical output and redirect serial I/Os to console\n
+   -bgrinvert colors for HOSTS using certain SPARC frame buffers\n
 #ifndef _WIN32
 	   -k language use keyboard layout (for example \fr\ for French)\n
 #endif
@@ -4757,6 +4759,7 @@
 QEMU_OPTION_cirrusvga,
 QEMU_OPTION_g,
 QEMU_OPTION_std_vga,
+QEMU_OPTION_bgr,
 QEMU_OPTION_monitor,
 QEMU_OPTION_serial,
 QEMU_OPTION_parallel,
@@ -4835,6 +4838,7 @@
 { full-screen, 0, QEMU_OPTION_full_screen },
 { pidfile, HAS_ARG, QEMU_OPTION_pidfile },
 { win2k-hack, 0, QEMU_OPTION_win2k_hack },
+{ bgr, 0, QEMU_OPTION_bgr },
 { usbdevice, HAS_ARG, QEMU_OPTION_usbdevice },
 { smp, HAS_ARG, QEMU_OPTION_smp },
 { vnc, HAS_ARG, QEMU_OPTION_vnc },
@@ -5338,6 +5342,9 @@
 case QEMU_OPTION_std_vga:
 cirrus_vga_enabled = 0;
 break;
+case QEMU_OPTION_bgr:
+bgr_display_enabled = 1;
+break;
 case QEMU_OPTION_g:
 {
 const char *p;
Index: vl.h
===
RCS file: /cvsroot/qemu/qemu/vl.h,v
retrieving revision 1.116
diff -a -u -r1.116 vl.h
--- vl.h	30 Apr 2006 21:28:36 -	1.116
+++ vl.h	1 May 2006 18:18:33 -
@@ -135,6 +135,7 @@
 extern int bios_size;
 extern int rtc_utc;
 extern int cirrus_vga_enabled;
+extern int bgr_display_enabled;
 extern int graphic_width;
 extern int graphic_height;
 extern int graphic_depth;
Index: hw/vga.c
===
RCS file: /cvsroot/qemu/qemu/hw/vga.c,v
retrieving revision 1.42
diff -a -u -r1.42 vga.c
--- hw/vga.c	9 Apr 2006 01:06:34 -	1.42
+++ hw/vga.c	1 May 2006 18:18:33 -
@@ -810,15 +810,27 @@
 
 #define DEPTH 8
 #include vga_template.h
+#define BGR_DISPLAY_TYPE
+#define DEPTH 8
+#include vga_template.h
 
 #define DEPTH 15
 #include vga_template.h
+#define BGR_DISPLAY_TYPE
+#define DEPTH 15
+#include vga_template.h
 
 #define DEPTH 16
 #include vga_template.h
+#define BGR_DISPLAY_TYPE
+#define DEPTH 16
+#include vga_template.h
 
 #define DEPTH 32
 #include vga_template.h
+#define BGR_DISPLAY_TYPE
+#define DEPTH 32
+#include vga_template.h
 
 static unsigned 

Re: [Qemu-devel] PATCH: solaris-sparc-slirp fix

2006-05-01 Thread Leonardo E. Reiter
Sorry,

I should add that the automatic detection is only done for SDL.  It
should be easy enough to add to the VNC side of things, but I didn't get
around to it yet.  You can use the -bgr command-line option to qemu in
the VNC case to set it manually.

- Leo Reiter

Leonardo E. Reiter wrote:
 Ben,
 
 You can use the patch I posted here recently to get QEMU to fix the BGR
 problem internally.  It doesn't have to be done at the VNC level - and
 in fact, this way, you can use it on the Solaris native X server (or
 even SunRays) in 24-bit color mode.  I am attaching a new version of the
 patch, complete with the detection logic (to make it automatic), against
 today's CVS.

-- 
Leonardo E. Reiter
Vice President of Product Development, CTO

Win4Lin, Inc.
Virtual Computing that means Business
Main: +1 512 339 7979
Fax: +1 512 532 6501
http://www.win4lin.com


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


Re: [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add/subtract

2006-05-01 Thread Stefan Weil

Dirk Behme schrieb:


 Fix overflow conditions for MIPS add/subtract as proposed by
 Daniel Jacobowitz.

 http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00538.html

 Regards

 Dirk



--- target-mips/op.c_orig 2006-04-30 09:40:46.0 +0200
+++ target-mips/op.c 2006-04-30 09:41:52.0 +0200
@@ -206,7 +206,7 @@ void op_addo (void)

 tmp = T0;
 T0 += T1;
- if (((tmp ^ T1 ^ (-1))  (T0 ^ T1))  31) {
+ if (~(T0 ^ T1)  (T0 ^ tmp)  0x8000) {
 /* operands of same sign, result different sign */
 CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
 }
@@ -225,7 +225,7 @@ void op_subo (void)

 tmp = T0;
 T0 = (int32_t)T0 - (int32_t)T1;
- if (((tmp ^ T1)  (tmp ^ T0))  31) {
+ if ((T0 ^ T1)  (T0 ^ tmp)  0x8000) {
 /* operands of different sign, first operand and result different sign */
 CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
 }






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



Hello Dirk,

which additions / subtractions are handled incorrectly by the current code?
Here is the result of a test which shows that the current code (which is
based on my patch)
raises an exception for 0x8000 + 0x8000.

Daniel, perhaps you could sent the code you used to check overflow
conditions?
Maybe there is no need to change functions op_addo and op_subo for MIPS.

Regards
Stefan

IN:
0x9400: lui v0,0x8000
0x9404: lui v1,0x8000
0x9408: add a0,v0,v1
0x940c: b 0x940c
0x9410: nop

 2 0002
do_raise_exception_err: 19 0
do_interrupt enter: PC 9408 EPC  cause -1 excp 19
do_interrupt: PC bfc00380 EPC 9408 cause 12 excp 19
S 1040 C 0030 A  D 
cpu_mips_handle_mmu_fault pc bfc00380 ad bfc00380 rw 2 is_user 0 smmu 1
cpu_mips_handle_mmu_fault address=bfc00380 ret 0 physical 1fc00380 prot 1

pc=0xbfc00380 HI=0x LO=0x ds 0006  0
GPR00: r0  at  v0 8000 v1 8000
GPR04: a0  a1  a2  a3 
GPR08: t0  t1  t2  t3 
GPR12: t4  t5  t6  t7 
GPR16: s0  s1  s2  s3 
GPR20: s4  s5  s6  s7 
GPR24: t8  t9  k0  k1 
GPR28: gp  sp 94001040 s8  ra 
CP0 Status 0x1046 Cause 0x0030 EPC 0x9408
Config0 0x80008090 Config1 0x1e9b4d8a LLAddr 0x




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


Re: [Qemu-devel] PATCH: solaris-sparc-slirp fix

2006-05-01 Thread Fabrice Bellard

Hi,

I did not accept your patch for two reasons:

1) You changed the guest vga frame buffer format and I don't think this 
is what you wanted (it can be useful to emulate VGA on big endian guests 
though - the current implementation for ppc guests is a hack). What is 
needed is to swap the host pixel format.


2) You added support for RGB swapping for 8/15/16 depths and I am not 
sure this is useful. Endianness swapping would be more useful for 15/16 
depths.


Fabrice.

Leonardo E. Reiter wrote:

Ben,

You can use the patch I posted here recently to get QEMU to fix the BGR
problem internally.  It doesn't have to be done at the VNC level - and
in fact, this way, you can use it on the Solaris native X server (or
even SunRays) in 24-bit color mode.  I am attaching a new version of the
patch, complete with the detection logic (to make it automatic), against
today's CVS.

My original post:

http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00181.html

The last (and fast) version:

http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00195.html

An additional hack to get SDL to configure this automatically, without
needing the -bgr option on the command-line:

http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00230.html

Maybe Fabrice or Paul can commit this since I addressed all the original
issues, but have yet to hear feedback on it.  It's working fine for
myself and for my customers using SunRays for several weeks now.  The
only issue is cirrus VGA in 16-bit mode seems to do some optimization
that bypasses the swapping code.  regular VGA or cirrus VGA in 24-bit
mode (on the guest) works fine.

Regards,

Leo Reiter

Ben Taylor wrote:



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


Re: [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add/subtract

2006-05-01 Thread Fabrice Bellard

OK. I hope this is correct now :-)

Just a note : there is already a lot of code in QEMU to compute 
correctly the overflow and carry flags (for example in the i386 
target)... don't spend your time on reinventing them !


Fabrice.

Dirk Behme wrote:


Fix overflow conditions for MIPS add/subtract as proposed by
Daniel Jacobowitz.

http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00538.html

Regards

Dirk




--- target-mips/op.c_orig   2006-04-30 09:40:46.0 +0200
+++ target-mips/op.c2006-04-30 09:41:52.0 +0200
@@ -206,7 +206,7 @@ void op_addo (void)
 
 tmp = T0;

 T0 += T1;
-if (((tmp ^ T1 ^ (-1))  (T0 ^ T1))  31) {
+if (~(T0 ^ T1)  (T0 ^ tmp)  0x8000) {
/* operands of same sign, result different sign */
 CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
 }
@@ -225,7 +225,7 @@ void op_subo (void)
 
 tmp = T0;

 T0 = (int32_t)T0 - (int32_t)T1;
-if (((tmp ^ T1)  (tmp ^ T0))  31) {
+if ((T0 ^ T1)  (T0 ^ tmp)  0x8000) {
/* operands of different sign, first operand and result different sign 
*/
 CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
 }






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




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


Re: [Qemu-devel] [PATCH] Fix scrambling of 32KB packets in slirp

2006-05-01 Thread Fabrice Bellard

Yes, I would prefer that you resubmit a patch using unsigned types.

Fabrice.

Kenneth Duda wrote:

Well that is a good question.  When I made this patch, I wanted to
respect the comment in the code that the author felt that using a
signed data type was safer in some cases.  However, I will admit that
I do not understand this reasoning, and I agree that switching to an
unsigned data type would be better.  Would you like us to resubmit
this patch in that form?

   -Ken

On 5/1/06, Fabrice Bellard [EMAIL PROTECTED] wrote:


Ed Swierk wrote:
 In several places in qemu's slirp code, signed and unsigned ints are
 used interchangeably when dealing with IP packet lengths and offsets.
 This causes IP packets greater than 32K in length to be scrambled in
 various interesting ways that are extremely difficult to troubleshoot.

 Although large IP packets are fairly rare in practice, certain
 UDP-based protocols like NFS use them extensively.

 The attached patch wraps IP packet lengths and offsets in macros that
 ensure they are always properly treated as unsigned values.

Why not changing the definition itself to uint16_t and verifying each
occurence of ip_off and ip_len ?

Fabrice.


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




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






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


Re: [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add/subtract

2006-05-01 Thread Daniel Jacobowitz
On Mon, May 01, 2006 at 08:42:08PM +0200, Stefan Weil wrote:
 - if (((tmp ^ T1 ^ (-1))  (T0 ^ T1))  31) {
 + if (~(T0 ^ T1)  (T0 ^ tmp)  0x8000) {

 Hello Dirk,
 
 which additions / subtractions are handled incorrectly by the current code?
 Here is the result of a test which shows that the current code (which is
 based on my patch)
 raises an exception for 0x8000 + 0x8000.
 
 Daniel, perhaps you could sent the code you used to check overflow
 conditions?

I used GDB.

(gdb) set $T0 = 0x8000
(gdb) set $T1 = 0x8000
(gdb) set $tmp = $T0 + $T1
(gdb) p (($tmp ^ $T1 ^ (-1))  ($T0 ^ $T1))  31
$1 = 0

I see no reason why it should be wrong.  $tmp is of course zero.
The high bit of tmp is not the same as the high bit of T1, therefore
$tmp ^ $T1 ^ (-1) == 0.  Therefore the if is false.  I even compiled
and ran the sample - no exception.

Oh, damn!  tmp is not the result, T0 is the result.  No wonder this
didn't make any sense.  I apologize, I'm really batting zero today.


-- 
Daniel Jacobowitz
CodeSourcery


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


[Qemu-devel] Patch submission policy? (was Re: [PATCH] SAMBA multi-share support

2006-05-01 Thread Stealth Dave
Is there a patch submission policy for QEMU?  I see a lot of patches 
posted to this list.  Some get accepted, some get rejected with 
comments, and others seem to be ignored.  Back in February, I submitted 
a patch which expands the SAMBA capabilities of QEMU to allow multiple 
folders to be shared, and was backwards compatible with the old syntax. 
 I resubmitted the patch via private email to the lead devs (Fabrice 
and Paul, the latter I presume can be considered a lead dev as he 
appears to have CVS commit access), but again got no feedback.


I'm perfectly willing to accept that my patch isn't good enough for 
inclusion, or even that the new functionality is not wanted (although, 
I'd be dissappointed).  But without any feedback whatsoever, I can't 
make improvements and, quite frankly, am feeling a little bit left out 
in the cold.


So, I've decided to be the squeaky wheel.  I've attached an updated 
patch the cleanly applies to current CVS.  Please feel free to attach 
whatever license is necessary for distribution with QEMU.  I welcome 
any feedback, and await an oil can or the junkyard. :)


Regards,
- Dave


smb-multishare-20060501.patch
Description: Binary data
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] bug report : kqemu and self-writing code

2006-05-01 Thread Even Rouault
Guest OS : Linux 2.6.15-1.2054_FC5 i686 (Fedora Core 5 i386)
Host OS: Linux 2.6.12-10-amd64-k8 #1 x86_64 (Ubuntu 5.10 amd64)
QEMU Version : today CVS compiled with kqemu support
KQEMU : 1.3.0pre6
Binary used : qemu-system-x86-64 (so kqemu user-mode is used)

I'm running the simple C code attached. With kqemu user-mode, this fails 
(sigsegv) with the following warning in dmesg :

audit(1146505373.813:12): avc:  denied { execheap } for pid=1860 
comm=selfmodifying scontext=user_u:system_r:unconfined_t:s0 
tcontext=user_u:system_r:unconfined_t:s0 tclass=process
Erreur de segmentation

Without kqemu enabled, it runs fine.

#define _XOPEN_SOURCE 600
#include sys/mman.h
#include unistd.h
#include stdlib.h
#include stdio.h

int main(int argc, char** argv)
{
  int pagesize = getpagesize();
  unsigned char* addr = NULL;
  posix_memalign((void**)addr, pagesize, pagesize);
  mprotect(addr, pagesize, PROT_WRITE | PROT_READ | PROT_EXEC);
  addr[0] = 0x8b; addr[1] = 0x44; addr[2] = 0x24; addr[3] = 0x04; /* mov0x4(%esp),%eax */
  addr[4] = 0x83; addr[5] = 0xc0; addr[6] = 0x01; /* add$0x1,%eax */
  addr[7] = 0xc3; /* ret */
  
  printf(10+1=%d\n, ((int (*)(int))addr)(10));
  free(addr);
  return 0;
}
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] Feature request: -hda image file locks, and warnings for readonly

2006-05-01 Thread Troy Benjegerdes
I managed to make the mistake of starting up two instances of qemu using
the same '-hda' win2k guest. Needless to say this rendered the image
unbootable.

What I'd like is for qemu to do some sort of optional (but default
behavior) file lock on the disk image, and spit out a warning and refuse
to start if another qemu process already locked the image. This would be
something you should be able to override if you really know what you are
doing.

I also managed to cause myself confusion by having an earlier image file
set mode '444' and the windows error messages didn't make much sense,
and I never got any sort of error indication out of qemu that the writes
had been failing.

-- 
--
Troy Benjegerdes'da hozer'[EMAIL PROTECTED]  

Somone asked me why I work on this free (http://www.fsf.org/philosophy/)
software stuff and not get a real job. Charles Shultz had the best answer:

Why do musicians compose symphonies and poets write poems? They do it
because life wouldn't have any meaning for them if they didn't. That's why
I draw cartoons. It's my life. -- Charles Shultz


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


Re: [Qemu-devel] PATCH: solaris-sparc-slirp fix

2006-05-01 Thread Leonardo E. Reiter
Thanks for the explanation Fabrice...  I guess I am not sure how to swap
the host pixel format without taking a performance penalty.  So for now
I just offer the patch I made in case anyone else finds it useful for
their own needs.  Maybe I'll revisit this in the future when I have more
time and come up with something more general.  Right now, it does the
job with no performance hit for guests running on little Endian hosts,
trying to blit on to Sun X servers in 24-bit mode.

I agree that the 8/15/16 bit stuff is probably not too relevant - I just
implemented it since it was implemented in the original patch (written
by someone else) that I adapted.

- Leo Reiter

Fabrice Bellard wrote:
 Hi,
 
 I did not accept your patch for two reasons:
 
 1) You changed the guest vga frame buffer format and I don't think this
 is what you wanted (it can be useful to emulate VGA on big endian guests
 though - the current implementation for ppc guests is a hack). What is
 needed is to swap the host pixel format.
 
 2) You added support for RGB swapping for 8/15/16 depths and I am not
 sure this is useful. Endianness swapping would be more useful for 15/16
 depths.
 
 Fabrice.
 
 Leonardo E. Reiter wrote:
 
 Ben,

 You can use the patch I posted here recently to get QEMU to fix the BGR
 problem internally.  It doesn't have to be done at the VNC level - and
 in fact, this way, you can use it on the Solaris native X server (or
 even SunRays) in 24-bit color mode.  I am attaching a new version of the
 patch, complete with the detection logic (to make it automatic), against
 today's CVS.

 My original post:

 http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00181.html

 The last (and fast) version:

 http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00195.html

 An additional hack to get SDL to configure this automatically, without
 needing the -bgr option on the command-line:

 http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00230.html

 Maybe Fabrice or Paul can commit this since I addressed all the original
 issues, but have yet to hear feedback on it.  It's working fine for
 myself and for my customers using SunRays for several weeks now.  The
 only issue is cirrus VGA in 16-bit mode seems to do some optimization
 that bypasses the swapping code.  regular VGA or cirrus VGA in 24-bit
 mode (on the guest) works fine.

 Regards,

 Leo Reiter

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

-- 
Leonardo E. Reiter
Vice President of Product Development, CTO

Win4Lin, Inc.
Virtual Computing that means Business
Main: +1 512 339 7979
Fax: +1 512 532 6501
http://www.win4lin.com


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


Re: [Qemu-devel] bug report : kqemu and self-writing code

2006-05-01 Thread Fabrice Bellard
Are you sure that the bug is really in kqemu ? It is possible that your 
guest kernel implements a security system which prevents self modifying 
code using segment limits which QEMU does not check (but kqemu checks 
them !).


Regards,

Fabrice.

Even Rouault wrote:

Guest OS : Linux 2.6.15-1.2054_FC5 i686 (Fedora Core 5 i386)
Host OS: Linux 2.6.12-10-amd64-k8 #1 x86_64 (Ubuntu 5.10 amd64)
QEMU Version : today CVS compiled with kqemu support
KQEMU : 1.3.0pre6
Binary used : qemu-system-x86-64 (so kqemu user-mode is used)

I'm running the simple C code attached. With kqemu user-mode, this fails 
(sigsegv) with the following warning in dmesg :


audit(1146505373.813:12): avc:  denied { execheap } for pid=1860 
comm=selfmodifying scontext=user_u:system_r:unconfined_t:s0 
tcontext=user_u:system_r:unconfined_t:s0 tclass=process

Erreur de segmentation

Without kqemu enabled, it runs fine.





#define _XOPEN_SOURCE 600
#include sys/mman.h
#include unistd.h
#include stdlib.h
#include stdio.h

int main(int argc, char** argv)
{
  int pagesize = getpagesize();
  unsigned char* addr = NULL;
  posix_memalign((void**)addr, pagesize, pagesize);
  mprotect(addr, pagesize, PROT_WRITE | PROT_READ | PROT_EXEC);
  addr[0] = 0x8b; addr[1] = 0x44; addr[2] = 0x24; addr[3] = 0x04; /* mov
0x4(%esp),%eax */
  addr[4] = 0x83; addr[5] = 0xc0; addr[6] = 0x01; /* add$0x1,%eax */
  addr[7] = 0xc3; /* ret */
  
  printf(10+1=%d\n, ((int (*)(int))addr)(10));

  free(addr);
  return 0;
}




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




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


Re: [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add/subtract

2006-05-01 Thread Fabrice Bellard
The current code seems correct to me too (it is the same as the x86 
reference).


Fabrice.

Stefan Weil wrote:

Dirk Behme schrieb:

 
  Fix overflow conditions for MIPS add/subtract as proposed by
  Daniel Jacobowitz.
 
  http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00538.html
 
  Regards
 
  Dirk
 
 
 
 --- target-mips/op.c_orig 2006-04-30 09:40:46.0 +0200
 +++ target-mips/op.c 2006-04-30 09:41:52.0 +0200
 @@ -206,7 +206,7 @@ void op_addo (void)
 
  tmp = T0;
  T0 += T1;
 - if (((tmp ^ T1 ^ (-1))  (T0 ^ T1))  31) {
 + if (~(T0 ^ T1)  (T0 ^ tmp)  0x8000) {
  /* operands of same sign, result different sign */
  CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
  }
 @@ -225,7 +225,7 @@ void op_subo (void)
 
  tmp = T0;
  T0 = (int32_t)T0 - (int32_t)T1;
 - if (((tmp ^ T1)  (tmp ^ T0))  31) {
 + if ((T0 ^ T1)  (T0 ^ tmp)  0x8000) {
  /* operands of different sign, first operand and result different 
sign */

  CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
  }
 
 
 
 
 
 
 ___
 Qemu-devel mailing list
 Qemu-devel@nongnu.org
 http://lists.nongnu.org/mailman/listinfo/qemu-devel
 
 

Hello Dirk,

which additions / subtractions are handled incorrectly by the current code?
Here is the result of a test which shows that the current code (which is
based on my patch)
raises an exception for 0x8000 + 0x8000.

Daniel, perhaps you could sent the code you used to check overflow
conditions?
Maybe there is no need to change functions op_addo and op_subo for MIPS.

Regards
Stefan

IN:
0x9400: lui v0,0x8000
0x9404: lui v1,0x8000
0x9408: add a0,v0,v1
0x940c: b 0x940c
0x9410: nop

 2 0002
do_raise_exception_err: 19 0
do_interrupt enter: PC 9408 EPC  cause -1 excp 19
do_interrupt: PC bfc00380 EPC 9408 cause 12 excp 19
S 1040 C 0030 A  D 
cpu_mips_handle_mmu_fault pc bfc00380 ad bfc00380 rw 2 is_user 0 smmu 1
cpu_mips_handle_mmu_fault address=bfc00380 ret 0 physical 1fc00380 prot 1

pc=0xbfc00380 HI=0x LO=0x ds 0006  0
GPR00: r0  at  v0 8000 v1 8000
GPR04: a0  a1  a2  a3 
GPR08: t0  t1  t2  t3 
GPR12: t4  t5  t6  t7 
GPR16: s0  s1  s2  s3 
GPR20: s4  s5  s6  s7 
GPR24: t8  t9  k0  k1 
GPR28: gp  sp 94001040 s8  ra 
CP0 Status 0x1046 Cause 0x0030 EPC 0x9408
Config0 0x80008090 Config1 0x1e9b4d8a LLAddr 0x




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






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


[Qemu-devel] qemu vnc.c

2006-05-01 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Branch: 
Changes by: Fabrice Bellard [EMAIL PROTECTED] 06/05/01 21:44:22

Modified files:
.  : vnc.c 

Log message:
uppercase fix (Anthony Liguori)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/vnc.c.diff?tr1=1.3tr2=1.4r1=textr2=text


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


Re: [Qemu-devel] [PATCH] Separate alias_addr (10.0.2.2) from our_addr in slirp

2006-05-01 Thread Ed Swierk

On 5/1/06, Ben Taylor [EMAIL PROTECTED] wrote:

Am I seeing a problem in line 98 of slirp/misc.c?


Yes--thanks for finding that.

An amended patch is attached.

--Ed
diff -BurN qemu.orig/slirp/ip_icmp.c qemu/slirp/ip_icmp.c
--- qemu.orig/slirp/ip_icmp.c	2004-04-22 00:10:47.0 +
+++ qemu/slirp/ip_icmp.c	2006-05-01 22:05:05.0 +
@@ -114,8 +114,7 @@
   case ICMP_ECHO:
 icp-icmp_type = ICMP_ECHOREPLY;
 ip-ip_len += hlen;	 /* since ip_input subtracts this */
-if (ip-ip_dst.s_addr == our_addr.s_addr || 
-	(ip-ip_dst.s_addr == (special_addr.s_addr|htonl(CTL_ALIAS))) ) {
+if (ip-ip_dst.s_addr == alias_addr.s_addr) {
   icmp_reflect(m);
 } else {
   struct socket *so;
@@ -161,7 +160,7 @@
 	icmp_error(m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno)); 
 	udp_detach(so);
   }
-} /* if ip-ip_dst.s_addr == our_addr.s_addr */
+} /* if ip-ip_dst.s_addr == alias_addr.s_addr */
 break;
   case ICMP_UNREACH:
 /* XXX? report error? close socket? */
@@ -311,7 +310,7 @@
   ip-ip_ttl = MAXTTL;
   ip-ip_p = IPPROTO_ICMP;
   ip-ip_dst = ip-ip_src;/* ip adresses */
-  ip-ip_src = our_addr;
+  ip-ip_src = alias_addr;
 
   (void ) ip_output((struct socket *)NULL, m);
   
diff -BurN qemu.orig/slirp/main.h qemu/slirp/main.h
--- qemu.orig/slirp/main.h	2004-07-12 22:33:04.0 +
+++ qemu/slirp/main.h	2006-05-01 22:05:05.0 +
@@ -34,6 +34,7 @@
 extern fd_set *global_readfds, *global_writefds, *global_xfds;
 extern struct in_addr ctl_addr;
 extern struct in_addr special_addr;
+extern struct in_addr alias_addr;
 extern struct in_addr our_addr;
 extern struct in_addr loopback_addr;
 extern struct in_addr dns_addr;
diff -BurN qemu.orig/slirp/misc.c qemu/slirp/misc.c
--- qemu.orig/slirp/misc.c	2006-04-23 19:41:17.0 +
+++ qemu/slirp/misc.c	2006-05-01 22:06:08.0 +
@@ -94,10 +94,8 @@
 he = gethostbyname(buff);
 if (he)
 our_addr = *(struct in_addr *)he-h_addr;
-/* If the host doesn't have a useful IP address then use the
-   guest side address.  */
-if (our_addr.s_addr == 0 || our_addr.s_addr == loopback_addr.s_addr)
-our_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS);
+if (our_addr.s_addr == 0)
+our_addr.s_addr = loopback_addr.s_addr;
 }
 
 #if SIZEOF_CHAR_P == 8
diff -BurN qemu.orig/slirp/slirp.c qemu/slirp/slirp.c
--- qemu.orig/slirp/slirp.c	2006-05-01 16:05:27.0 +
+++ qemu/slirp/slirp.c	2006-05-01 22:05:05.0 +
@@ -9,6 +9,8 @@
 
 /* address for slirp virtual addresses */
 struct in_addr special_addr;
+/* virtual address alias for host */
+struct in_addr alias_addr;
 
 const uint8_t special_ethaddr[6] = { 
 0x52, 0x54, 0x00, 0x12, 0x35, 0x00
@@ -154,6 +156,7 @@
 }
 
 inet_aton(CTL_SPECIAL, special_addr);
+alias_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS);
 getouraddr();
 }
 
diff -BurN qemu.orig/slirp/socket.c qemu/slirp/socket.c
--- qemu.orig/slirp/socket.c	2006-04-25 22:36:06.0 +
+++ qemu/slirp/socket.c	2006-05-01 22:05:05.0 +
@@ -596,7 +596,7 @@
 	getsockname(s,(struct sockaddr *)addr,addrlen);
 	so-so_fport = addr.sin_port;
 	if (addr.sin_addr.s_addr == 0 || addr.sin_addr.s_addr == loopback_addr.s_addr)
-	   so-so_faddr = our_addr;
+	   so-so_faddr = alias_addr;
 	else
 	   so-so_faddr = addr.sin_addr;
 
diff -BurN qemu.orig/slirp/tcp_subr.c qemu/slirp/tcp_subr.c
--- qemu.orig/slirp/tcp_subr.c	2004-09-18 19:33:56.0 +
+++ qemu/slirp/tcp_subr.c	2006-05-01 22:05:05.0 +
@@ -504,7 +504,7 @@
 	so-so_faddr = addr.sin_addr;
 	/* Translate connections from localhost to the real hostname */
 	if (so-so_faddr.s_addr == 0 || so-so_faddr.s_addr == loopback_addr.s_addr)
-	   so-so_faddr = our_addr;
+	   so-so_faddr = alias_addr;
 	
 	/* Close the accept() socket, set right state */
 	if (inso-so_state  SS_FACCEPTONCE) {
@@ -840,7 +840,7 @@
 
 if (ns-so_faddr.s_addr == 0 || 
 	ns-so_faddr.s_addr == loopback_addr.s_addr)
-  ns-so_faddr = our_addr;
+  ns-so_faddr = alias_addr;
 
 ns-so_iptos = tcp_tos(ns);
 tp = sototcpcb(ns);
diff -BurN qemu.orig/slirp/udp.c qemu/slirp/udp.c
--- qemu.orig/slirp/udp.c	2005-07-03 17:08:43.0 +
+++ qemu/slirp/udp.c	2006-05-01 22:05:05.0 +
@@ -657,7 +657,7 @@
 	getsockname(so-s,(struct sockaddr *)addr,addrlen);
 	so-so_fport = addr.sin_port;
 	if (addr.sin_addr.s_addr == 0 || addr.sin_addr.s_addr == loopback_addr.s_addr)
-	   so-so_faddr = our_addr;
+	   so-so_faddr = alias_addr;
 	else
 	   so-so_faddr = addr.sin_addr;
 	
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel