Re: [Qemu-devel] Windows build broken

2007-12-12 Thread C.W. Betts
Same problem with cygwin.  I think it's a problem with BlockInterfaceType not 
being correctly parsed on mingw-gcc for some odd reason.
- Original Message - 
From: Balazs Attila-Mihaly (Cd-MaN) [EMAIL PROTECTED]
To: Qemu Devel qemu-devel@nongnu.org
Sent: Tuesday, December 11, 2007 8:05 PM
Subject: [Qemu-devel] Windows build broken


Trying to build the current CVS Head with Mingw under windows, the result is 
the following error message:

In file included from tap-win32.c:31:
sysemu.h:125: error: syntax error before ';' token
sysemu.h:137: error: syntax error before ',' token
sysemu.h:138: error: syntax error before ')' token
make: *** [tap-win32.o] Error 1





  __
Sent from Yahoo! - the World's favourite mail http://uk.mail.yahoo.com








Re: [Qemu-devel] Mac OS X build failure (qemu-img)

2007-12-12 Thread Andreas Färber


Am 11.11.2007 um 13:40 schrieb Andreas Färber:

Building CVS HEAD on OS X (here sparc-softmmu) currently results in  
unresolved symbols:


gcc-3.3 -g-o qemu-img qemu-img.o qemu-img-block.o qemu-img-block- 
raw.o cutils.o block-cow.o block-qcow.o aes.o block-vmdk.o block- 
cloop.o block-dmg.o block-bochs.o block-vpc.o block-vvfat.o block- 
qcow2.o block-parallels.o -lz

ld: Undefined symbols:
_CFDictionarySetValue
_CFRelease
_CFStringGetCString
_IOIteratorNext
_IOMasterPort
_IOObjectRelease
_IORegistryEntryCreateCFProperty
_IOServiceGetMatchingServices
_IOServiceMatching
___CFStringMakeConstantString
_kCFAllocatorDefault
_kCFBooleanTrue
make: *** [qemu-img] Error 1

It seems to be unrelated to Fabrice's Cocoa changes and unrelated to  
the AIO reversion. My guess is that the CoreFoundation framework or  
something needs to be linked in. Any idea which commit might have  
caused this or where to fix?


Any hints, anyone? Still haven't figured out where this breakage is  
coming from, didn't notice any relevant changes in Makefile or  
configure...


Andreas



[Qemu-devel] [PATCH] ioemu/qemu vga: save and restore vram buffer (revised)

2007-12-12 Thread Ian Jackson
andrzej zaborowski writes (Re: [Qemu-devel] [PATCH] ioemu/qemu vga: save and 
restore vram buffer):
 On 10/12/2007, Ian Jackson [EMAIL PROTECTED] wrote:
  I have reinterpreted the `is_vbe' byte, which is related to
  CONFIG_BOCHS_VBE, as a general flags word.  This enables my code to
  allow old images to be restored (albeit with loss of VGA memory), by
  using another bit in that word to indicate whether the VGA memory dump
  is present.
 
 You can use the version_id parameter for that. Increase the value
 passed to register_savevm and load the vram only if version_id = 2.

Oh!  That's much better.  Thanks.  Below are two patches:

The first one (stdvga-save-vram-update.patch) is against current
xen-unstable tip (which now includes my previous version) and should
be applied there.

The second (stdvga-save-vram-take2.patch) is a fresh diff against the
same qemu as before and should be regarded as replacing my previous
submission.

Signed-off-by: Ian Jackson [EMAIL PROTECTED]

Ian.

diff -r f2f7c92bf1c1 tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c  Wed Dec 12 11:08:21 2007 +
+++ b/tools/ioemu/hw/vga.c  Wed Dec 12 11:27:24 2007 +
@@ -1742,7 +1742,6 @@ static void vga_save(QEMUFile *f, void *
 static void vga_save(QEMUFile *f, void *opaque)
 {
 VGAState *s = opaque;
-unsigned save_format_flags;
 uint32_t vram_size;
 #ifdef CONFIG_BOCHS_VBE
 int i;
@@ -1774,9 +1773,8 @@ static void vga_save(QEMUFile *f, void *
 qemu_put_buffer(f, s-palette, 768);
 
 qemu_put_be32s(f, s-bank_offset);
-save_format_flags = VGA_SAVE_FORMAT_FLAG_VRAM_DATA;
 #ifdef CONFIG_BOCHS_VBE
-qemu_put_byte(f, save_format_flags | VGA_SAVE_FORMAT_FLAG_BOCHS_VBE);
+qemu_put_byte(f, 1);
 qemu_put_be16s(f, s-vbe_index);
 for(i = 0; i  VBE_DISPI_INDEX_NB; i++)
 qemu_put_be16s(f, s-vbe_regs[i]);
@@ -1784,7 +1782,7 @@ static void vga_save(QEMUFile *f, void *
 qemu_put_be32s(f, s-vbe_line_offset);
 qemu_put_be32s(f, s-vbe_bank_mask);
 #else
-qemu_put_byte(f, save_format_flags);
+qemu_put_byte(f, 0);
 #endif
 vram_size = s-vram_size;
 qemu_put_be32s(f, vram_size); 
@@ -1794,11 +1792,13 @@ static int vga_load(QEMUFile *f, void *o
 static int vga_load(QEMUFile *f, void *opaque, int version_id)
 {
 VGAState *s = opaque;
-int ret;
-unsigned int save_format_flags;
+int is_vbe, ret;
 uint32_t vram_size;
-
-if (version_id  2)
+#ifdef CONFIG_BOCHS_VBE
+int i;
+#endif
+
+if (version_id  3)
 return -EINVAL;
 
 if (s-pci_dev  version_id = 2) {
@@ -1830,9 +1830,9 @@ static int vga_load(QEMUFile *f, void *o
 qemu_get_buffer(f, s-palette, 768);
 
 qemu_get_be32s(f, s-bank_offset);
-save_format_flags = qemu_get_byte(f);
+is_vbe = qemu_get_byte(f);
 #ifdef CONFIG_BOCHS_VBE
-if (!(save_format_flags  VGA_SAVE_FORMAT_FLAG_BOCHS_VBE))
+if (!is_vbe)
 return -EINVAL;
 qemu_get_be16s(f, s-vbe_index);
 for(i = 0; i  VBE_DISPI_INDEX_NB; i++)
@@ -1841,10 +1841,10 @@ static int vga_load(QEMUFile *f, void *o
 qemu_get_be32s(f, s-vbe_line_offset);
 qemu_get_be32s(f, s-vbe_bank_mask);
 #else
-if (save_format_flags  VGA_SAVE_FORMAT_FLAG_BOCHS_VBE)
+if (is_vbe)
 return -EINVAL;
 #endif
-if (save_format_flags  VGA_SAVE_FORMAT_FLAG_VRAM_DATA) {
+if (version_id = 3) {
/* people who restore old images may be lucky ... */
qemu_get_be32s(f, vram_size);
if (vram_size != s-vram_size)
@@ -2064,7 +2064,7 @@ static void vga_init(VGAState *s)
 {
 int vga_io_memory;
 
-register_savevm(vga, 0, 2, vga_save, vga_load, s);
+register_savevm(vga, 0, 3, vga_save, vga_load, s);
 
 register_ioport_write(0x3c0, 16, 1, vga_ioport_write, s);
 
diff -r f2f7c92bf1c1 tools/ioemu/hw/vga_int.h
--- a/tools/ioemu/hw/vga_int.h  Wed Dec 12 11:08:21 2007 +
+++ b/tools/ioemu/hw/vga_int.h  Wed Dec 12 11:27:54 2007 +
@@ -157,9 +157,6 @@ static inline int c6_to_8(int v)
 return (v  2) | (b  1) | b;
 }
 
-#define VGA_SAVE_FORMAT_FLAG_BOCHS_VBE  0x01
-#define VGA_SAVE_FORMAT_FLAG_VRAM_DATA  0x02
-
 void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, 
  unsigned long vga_ram_offset, int vga_ram_size);
 uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr);

h--99eSOG+WoR
Content-Type: text/plain
Content-Description: vga save vram (revised)
Content-Disposition: inline;
filename=stdvga-save-vram-take2.patch
Content-Transfer-Encoding: 7bit

diff -r 4054cd60895b tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c  Mon Dec 10 13:49:22 2007 +
+++ b/tools/ioemu/hw/vga.c  Wed Dec 12 11:27:24 2007 +
@@ -1742,6 +1742,7 @@ static void vga_save(QEMUFile *f, void *
 static void vga_save(QEMUFile *f, void *opaque)
 {
 VGAState *s = opaque;
+uint32_t vram_size;
 #ifdef CONFIG_BOCHS_VBE
 int i;
 #endif
@@ -1783,17 +1784,21 @@ static void vga_save(QEMUFile *f, void *
 #else
 qemu_put_byte(f, 0);
 

[Qemu-devel] [PATCH] x86_64 Linux gcc4 support

2007-12-12 Thread Alexander Graf

Hi,

by mere accident I fixed the gcc4 Linux x86_64 support. Originally I  
was tracking down a bug in the Mac OS version and wanted to compare  
the outputs of the Linux version with the Mac one when I realized that  
a gcc4 compiled qemu does not work on x86_64 Linux.
The symptoms were very similar to those I saw on Darwin though (TB  
jumping), so I transferred the MACH-O / Apple patch to ELF / Linux and  
it just worked. Basically this enables USE_DIRECt_JUMP for x86_64. I  
have no clue why the default case breaks, but DIRECT_JUMP is faster  
anyway, so I don't really care.


Tested with openSUSE 10.3 (gcc 4.3) and x86_64-softmmu.

If this patch breaks any other platform that works with x86_64, please  
say so and exclude that one from the #ifdef or implement __op_jmp in  
dyngen.
Nevertheless this should give a nice speedup for x86_64 hosts and  
enables recent gcc4-only (-march) optimizer flags.


Cheers,

Alex

qemu-x86_64-gcc4.patch
Description: Binary data


Re: [Qemu-devel] Windows build broken

2007-12-12 Thread C.W. Betts
Could you perhaps give a patch?  I don't feel like going through and changing 
every instance of BlockInterfaceType to something else.
  - Original Message - 
  From: Eduardo Felipe 
  To: qemu-devel@nongnu.org 
  Sent: Wednesday, December 12, 2007 3:41 AM
  Subject: Re: [Qemu-devel] Windows build broken




  2007/12/12, C.W. Betts [EMAIL PROTECTED]:
Same problem with cygwin.  I think it's a problem with BlockInterfaceType 
not being correctly parsed on mingw-gcc for some odd reason.



  Hi,

  I don't think it is related with BlockInterfaceType itself. The problem is to 
use interface as a variable or parameter name, which seems to be confused 
with a reserved keyword, type or something like that. I was able to compile 
with mingw changing that variable name and all its references along the code. 

  Regards.


[Qemu-devel] Windows build crash problem

2007-12-12 Thread 武田 俊也
Hi all.

I encountered the crash problem with windows build on Core-Duo host.
Qemu crashes in cpu_interrupt() called from host_alarm_handler() in vl.c
because CPUState *env = next_cpu is null.

I tried the patch to check env is not null in host_alarm_handler()
and now qemu does not crash.

CPUState *env = next_cpu;
+   if(env) {
/* stop the currently executing cpu because a timer occured */
cpu_interrupt(env, CPU_INTERRUPT_EXIT);
#ifdef USE_KQEMU
if (env-kqemu_enabled) {
kqemu_cpu_interrupt(env);
}
#endif
+   }
event_pending = 1;
}

This is very temporary patch and I need to investigate
why next_cpu is null but sorry now I dont have enough time.

Thanks,
TAKEDA, toshiya





Re: [Qemu-devel] Windows build crash problem

2007-12-12 Thread Filip Navara
Actually  somebody has already described the problem on the mailing list and
Paul Brook replied to that message. Hopefully you can find it in the
archives.

F.

On Dec 12, 2007 5:25 PM, 武田 俊也 [EMAIL PROTECTED] wrote:

 Hi all.

 I encountered the crash problem with windows build on Core-Duo host.
 Qemu crashes in cpu_interrupt() called from host_alarm_handler() in vl.c
 because CPUState *env = next_cpu is null.

 I tried the patch to check env is not null in host_alarm_handler()
 and now qemu does not crash.

CPUState *env = next_cpu;
 +   if(env) {
/* stop the currently executing cpu because a timer occured */
cpu_interrupt(env, CPU_INTERRUPT_EXIT);
 #ifdef USE_KQEMU
if (env-kqemu_enabled) {
kqemu_cpu_interrupt(env);
}
 #endif
 +   }
event_pending = 1;
 }

 This is very temporary patch and I need to investigate
 why next_cpu is null but sorry now I dont have enough time.

 Thanks,
 TAKEDA, toshiya






[Qemu-devel] [PATCH] m68k missing get_sp_from_cpustate()

2007-12-12 Thread Thayne Harbaugh
This patch adds the missing get_sp_from_cpustate() for m68k.
Index: qemu/linux-user/m68k/target_signal.h
===
--- qemu.orig/linux-user/m68k/target_signal.h	2007-12-11 10:33:23.0 -0700
+++ qemu/linux-user/m68k/target_signal.h	2007-12-11 10:33:54.0 -0700
@@ -21,4 +21,9 @@
 #define TARGET_MINSIGSTKSZ	2048
 #define TARGET_SIGSTKSZ	8192
 
+static inline abi_ulong get_sp_from_cpustate(CPUM68KState *state)
+{
+return state-aregs[7];
+}
+
 #endif /* TARGET_SIGNAL_H */


Re: [Qemu-devel] [Bug][PATCH] Fatal error caused by wrong memory access

2007-12-12 Thread Stefan Weil
andrzej zaborowski schrieb:
 On 30/11/2007, Stefan Weil [EMAIL PROTECTED] wrote:
   
 What about my bug report? Up to now I got no replies.

 Please include the patch in CVS HEAD - or tell me why you won't do so.
 

 Please check that you can still reproduce the error. pbrook explains
 that tb-size cannot be zero unless there's a bug elsewhere, and there
 was such a bug on MIPS but only until r97 of target-mips/translate.c.

 Regards
Thank you for your answer. I checked with current HEAD (1) and
with HEAD + reversed patch from r96-r97 (2). Only (2) is buggy,
so it was this bug on MIPS which was fixed five months after my
first bug report.

Regards
Stefan





[Qemu-devel] [BUG][PATCH] signal translation (48_signal_xlate.ptach)

2007-12-12 Thread Thayne Harbaugh
There are some places where target signals and host signals aren't
correctly differentiated.  This patch addresses proper signal
translation between target and host.

* Changes variable names to be more explicit about target and host
signals.

* Calls target_to_host_signal() and host_to_target_signal() when
appropriate.

* Adds the TARGET_ prefix to locations that were incorrectly using
host signal names.

* Moves target_to_host_signal() and host_to_target_signal() to qsignal.h
to make them available to syscall.c.
Index: qemu/linux-user/signal.c
===
--- qemu.orig/linux-user/signal.c	2007-12-12 07:12:00.0 -0700
+++ qemu/linux-user/signal.c	2007-12-12 11:17:26.0 -0700
@@ -28,6 +28,7 @@
 
 #include qemu.h
 #include target_signal.h
+#include qsignal.h
 
 /*
  * Enable the DEBUG define and then set the individual DEBUG_*
@@ -66,7 +67,7 @@
 static void host_signal_handler(int host_signum, siginfo_t *info,
 void *puc);
 
-static uint8_t host_to_target_signal_table[65] = {
+uint8_t host_to_target_signal_table[65] = {
 [SIGHUP] = TARGET_SIGHUP,
 [SIGINT] = TARGET_SIGINT,
 [SIGQUIT] = TARGET_SIGQUIT,
@@ -103,7 +104,7 @@
 [SIGSYS] = TARGET_SIGSYS,
 /* next signals stay the same */
 };
-static uint8_t target_to_host_signal_table[65];
+uint8_t target_to_host_signal_table[65];
 
 static inline int on_sig_stack(unsigned long sp)
 {
@@ -117,16 +118,6 @@
 : on_sig_stack(sp) ? SS_ONSTACK : 0);
 }
 
-static inline int host_to_target_signal(int sig)
-{
-return host_to_target_signal_table[sig];
-}
-
-static inline int target_to_host_signal(int sig)
-{
-return target_to_host_signal_table[sig];
-}
-
 static void host_to_target_sigset_internal(target_sigset_t *d,
const sigset_t *s)
 {
@@ -334,13 +325,13 @@
 first_free = q;
 }
 
-/* abort execution with signal */
-void __attribute((noreturn)) force_sig(int sig)
+/* abort execution with target signal */
+void __attribute((noreturn)) force_sig(int target_sig)
 {
 int host_sig;
-host_sig = target_to_host_signal(sig);
+host_sig = target_to_host_signal(target_sig);
 fprintf(stderr, qemu: uncaught target signal %d (%s) - exiting\n,
-sig, strsignal(host_sig));
+target_sig, strsignal(host_sig));
 #if 1
 _exit(-host_sig);
 #else
@@ -355,23 +346,23 @@
 #endif
 }
 
-/* queue a signal so that it will be send to the virtual CPU as soon
-   as possible */
-int queue_signal(int sig, target_siginfo_t *info)
+/* queue a target signal so that it will be sent to the virtual CPU as
+   soon as possible */
+int queue_signal(int target_sig, target_siginfo_t *info)
 {
 struct emulated_sigaction *k;
 struct sigqueue *q, **pq;
 abi_ulong handler;
 
-debugf(DEBUG_SIGNAL, queue_signal: sig=%d\n, sig);
-k = sigact_table[sig - 1];
+debugf(DEBUG_SIGNAL, queue_signal: target_sig=%d\n, target_sig);
+k = sigact_table[target_sig - 1];
 handler = k-sa._sa_handler;
 if (handler == TARGET_SIG_DFL) {
 /* default handler : ignore some signal. The other are fatal */
-if (sig != TARGET_SIGCHLD 
-sig != TARGET_SIGURG 
-sig != TARGET_SIGWINCH) {
-force_sig(sig);
+if (target_sig != TARGET_SIGCHLD 
+target_sig != TARGET_SIGURG 
+target_sig != TARGET_SIGWINCH) {
+force_sig(target_sig);
 } else {
 return 0; /* indicate ignored */
 }
@@ -379,10 +370,10 @@
 /* ignore signal */
 return 0;
 } else if (handler == TARGET_SIG_ERR) {
-force_sig(sig);
+force_sig(target_sig);
 } else {
 pq = k-first;
-if (sig  TARGET_SIGRTMIN) {
+if (target_sig  TARGET_SIGRTMIN) {
 /* if non real time signal, we queue exactly one signal */
 if (!k-pending)
 q = k-info;
@@ -413,7 +404,7 @@
 static void host_signal_handler(int host_signum, siginfo_t *info,
 void *puc)
 {
-int sig;
+int target_sig;
 target_siginfo_t tinfo;
 
 /* the CPU emulator uses some host signals to detect exceptions,
@@ -424,12 +415,12 @@
 }
 
 /* get target signal number */
-sig = host_to_target_signal(host_signum);
-if (sig  1 || sig  TARGET_NSIG)
+target_sig = host_to_target_signal(host_signum);
+if (target_sig  1 || target_sig  TARGET_NSIG)
 return;
-debugf(DEBUG_SIGNAL, qemu: got signal %d\n, sig);
+debugf(DEBUG_SIGNAL, qemu: got target signal %d\n, target_sig);
 host_to_target_siginfo_noswap(tinfo, info);
-if (queue_signal(sig, tinfo) == 1) {
+if (queue_signal(target_sig, tinfo) == 1) {
 /* interrupt the virtual CPU as soon as possible */
 cpu_interrupt(global_env, CPU_INTERRUPT_EXIT);
 }
@@ -1343,7 +1334,7 @@
 
 badframe:
 	unlock_user_struct(frame, 

[Qemu-devel] qemu-forum.ipi.fi down?

2007-12-12 Thread Robert Nestor
It seems qemu-forum.ipi.fi is down.  Is there an alternate place one  
can obtain source snapshots or browse the user forums?





Re: [Qemu-devel] Windows build broken

2007-12-12 Thread Eduardo Felipe
2007/12/12, C.W. Betts [EMAIL PROTECTED]:

  Could you perhaps give a patch?  I don't feel like going through and
 changing every instance of BlockInterfaceType to something else.


Having a closer look I think the underlying problem is a name conflict with
a #define in Mingw's header file basetyps.h, so renaming variables looks
right to me. Patch attached.

Regards,

*** sysemu.h
--- sysemu.h
--- sysemu.h	2 Dec 2007 04:51:08 -	1.2
+++ sysemu.h	12 Dec 2007 19:17:47 -
@@ -122,7 +122,7 @@
 
 typedef struct DriveInfo {
 BlockDriverState *bdrv;
-BlockInterfaceType interface;
+BlockInterfaceType binterface;
 int bus;
 int unit;
 } DriveInfo;
@@ -134,8 +134,8 @@
 int nb_drives;
 DriveInfo drives_table[MAX_DRIVES+1];
 
-extern int drive_get_index(BlockInterfaceType interface, int bus, int unit);
-extern int drive_get_max_bus(BlockInterfaceType interface);
+extern int drive_get_index(BlockInterfaceType binterface, int bus, int unit);
+extern int drive_get_max_bus(BlockInterfaceType binterface);
 
 /* serial ports */
 

*** vl.c
--- vl.c
--- vl.c	10 Dec 2007 20:00:10 -	1.378
+++ vl.c	12 Dec 2007 19:17:09 -
@@ -4811,14 +4811,14 @@
 return nb_drives_opt++;
 }
 
-int drive_get_index(BlockInterfaceType interface, int bus, int unit)
+int drive_get_index(BlockInterfaceType binterface, int bus, int unit)
 {
 int index;
 
 /* seek interface, bus and unit */
 
 for (index = 0; index  nb_drives; index++)
-if (drives_table[index].interface == interface 
+if (drives_table[index].binterface == binterface 
 	drives_table[index].bus == bus 
 	drives_table[index].unit == unit)
 return index;
@@ -4826,14 +4826,14 @@
 return -1;
 }
 
-int drive_get_max_bus(BlockInterfaceType interface)
+int drive_get_max_bus(BlockInterfaceType binterface)
 {
 int max_bus;
 int index;
 
 max_bus = -1;
 for (index = 0; index  nb_drives; index++) {
-if(drives_table[index].interface == interface 
+if(drives_table[index].binterface == binterface 
drives_table[index].bus  max_bus)
 max_bus = drives_table[index].bus;
 }
@@ -4846,7 +4846,7 @@
 char file[1024];
 char devname[128];
 const char *mediastr = ;
-BlockInterfaceType interface;
+BlockInterfaceType binterface;
 enum { MEDIA_DISK, MEDIA_CDROM } media;
 int bus_id, unit_id;
 int cyls, heads, secs, translation;
@@ -4875,11 +4875,11 @@
 !strcmp(machine-name, SS-600MP) ||
 !strcmp(machine-name, versatilepb) ||
 !strcmp(machine-name, versatileab)) {
-interface = IF_SCSI;
+binterface = IF_SCSI;
 max_devs = MAX_SCSI_DEVS;
 strcpy(devname, scsi);
 } else {
-interface = IF_IDE;
+binterface = IF_IDE;
 max_devs = MAX_IDE_DEVS;
 strcpy(devname, ide);
 }
@@ -4906,22 +4906,22 @@
 if (get_param_value(buf, sizeof(buf), if, str)) {
 strncpy(devname, buf, sizeof(devname));
 if (!strcmp(buf, ide)) {
-	interface = IF_IDE;
+	binterface = IF_IDE;
 max_devs = MAX_IDE_DEVS;
 } else if (!strcmp(buf, scsi)) {
-	interface = IF_SCSI;
+	binterface = IF_SCSI;
 max_devs = MAX_SCSI_DEVS;
 } else if (!strcmp(buf, floppy)) {
-	interface = IF_FLOPPY;
+	binterface = IF_FLOPPY;
 max_devs = 0;
 } else if (!strcmp(buf, pflash)) {
-	interface = IF_PFLASH;
+	binterface = IF_PFLASH;
 max_devs = 0;
 	} else if (!strcmp(buf, mtd)) {
-	interface = IF_MTD;
+	binterface = IF_MTD;
 max_devs = 0;
 	} else if (!strcmp(buf, sd)) {
-	interface = IF_SD;
+	binterface = IF_SD;
 max_devs = 0;
 	} else {
 fprintf(stderr, qemu: '%s' unsupported bus type '%s'\n, str, buf);
@@ -5036,7 +5036,7 @@
 
 if (unit_id == -1) {
unit_id = 0;
-   while (drive_get_index(interface, bus_id, unit_id) != -1) {
+   while (drive_get_index(binterface, bus_id, unit_id) != -1) {
unit_id++;
if (max_devs  unit_id = max_devs) {
unit_id -= max_devs;
@@ -5057,23 +5057,23 @@
  * ignore multiple definitions
  */
 
-if (drive_get_index(interface, bus_id, unit_id) != -1)
+if (drive_get_index(binterface, bus_id, unit_id) != -1)
 return 0;
 
 /* init */
 
-if (interface == IF_IDE || interface == IF_SCSI)
+if (binterface == IF_IDE || binterface == IF_SCSI)
 mediastr = (media == MEDIA_CDROM) ? -cd : -hd;
 snprintf(buf, sizeof(buf), max_devs ? %1$s%4$i%2$s%3$i : %s%s%i,
  devname, mediastr, unit_id, bus_id);
 bdrv = bdrv_new(buf);
 drives_table[nb_drives].bdrv = bdrv;
-drives_table[nb_drives].interface = interface;
+drives_table[nb_drives].binterface = binterface;
 drives_table[nb_drives].bus = bus_id;
 drives_table[nb_drives].unit = unit_id;
 nb_drives++;
 
-switch(interface) {
+

[Qemu-devel] lock cmpxchg %edx,%ecx bug?

2007-12-12 Thread lgj1106
sorry my english poor.
 
lock cmpxchg %edx,%ecx is Invalid instruction but qemu-0.9.0 can execute

[Qemu-devel] [BUG][PATCH] signal termination (48_signal_terminate.patch)

2007-12-12 Thread Thayne Harbaugh
Qemu doesn't exit with the proper code when dieing from an uncaught
signal.  Exit codes for uncaught signals are -signum.  Unfortunately
the kernel filters values from exit() and _exit().

A solution is to actually die from an uncaught signal.  This patch
detects an uncaught signal, installs the default handler, and then sends
itself the signal and waits for it.  It depends on the previous
48_signal_xlate.patch that I sent.
Index: qemu/linux-user/signal.c
===
--- qemu.orig/linux-user/signal.c	2007-12-12 11:17:26.0 -0700
+++ qemu/linux-user/signal.c	2007-12-12 11:26:42.0 -0700
@@ -330,20 +330,31 @@
 {
 int host_sig;
 host_sig = target_to_host_signal(target_sig);
+struct sigaction act;
 fprintf(stderr, qemu: uncaught target signal %d (%s) - exiting\n,
 target_sig, strsignal(host_sig));
-#if 1
-_exit(-host_sig);
-#else
-{
-struct sigaction act;
-sigemptyset(act.sa_mask);
-act.sa_flags = SA_SIGINFO;
-act.sa_sigaction = SIG_DFL;
-sigaction(SIGABRT, act, NULL);
-abort();
-}
-#endif
+
+/* The proper exit code for dieing from an uncaught signal is
+ * -signal.  The kernel doesn't allow exit() or _exit() to pass
+ * a negative value.  To get the proper exit code we need to
+ * actually die from an uncaught signal.  Here the default signal
+ * handler is installed, we send ourself a signal and we wait for
+ * it to arrive. */
+sigfillset(act.sa_mask);
+act.sa_handler = SIG_DFL;
+sigaction(host_sig, act, NULL);
+
+/* For some reason raise(host_sig) doesn't send the signal when
+ * statically linked on x86-64. */
+kill(getpid(), host_sig);
+
+/* Make sure the signal isn't masked (just reuse the mask inside
+of act) */
+sigdelset(act.sa_mask, host_sig);
+sigsuspend(act.sa_mask);
+
+/* unreachable */
+assert(0);
 }
 
 /* queue a target signal so that it will be sent to the virtual CPU as


Re: [Qemu-devel] Windows build broken

2007-12-12 Thread Stefan Weil
basetyps.h is included by windows.h / rpc.h. QEMU does not need it, so
you can avoid it like this:

#define WIN32_LEAN_AND_MEAN
#include windows.h

WIN32_LEAN_AND_MEAN reduces the number of includes in windows.h
and increases compilation speed. And you don't have to rename
variables like interface :-)

Regards,
Stefan

Eduardo Felipe schrieb:

 2007/12/12, C.W. Betts [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]:

 Could you perhaps give a patch?  I don't feel like going through
 and changing every instance of BlockInterfaceType to something else.


 Having a closer look I think the underlying problem is a name conflict
 with a #define in Mingw's header file basetyps.h, so renaming
 variables looks right to me. Patch attached.

 Regards,




 


 *** sysemu.h
 --- sysemu.h
 --- sysemu.h 2 Dec 2007 04:51:08 - 1.2
 +++ sysemu.h 12 Dec 2007 19:17:47 -
 @@ -122,7 +122,7 @@

 typedef struct DriveInfo {
 BlockDriverState *bdrv;
 - BlockInterfaceType interface;
 + BlockInterfaceType binterface;
 int bus;
 int unit;
 } DriveInfo;
 @@ -134,8 +134,8 @@
 int nb_drives;
 DriveInfo drives_table[MAX_DRIVES+1];

 -extern int drive_get_index(BlockInterfaceType interface, int bus, int
 unit);
 -extern int drive_get_max_bus(BlockInterfaceType interface);
 +extern int drive_get_index(BlockInterfaceType binterface, int bus,
 int unit);
 +extern int drive_get_max_bus(BlockInterfaceType binterface);

 /* serial ports */


 *** vl.c
 --- vl.c
 --- vl.c 10 Dec 2007 20:00:10 - 1.378
 +++ vl.c 12 Dec 2007 19:17:09 -
 @@ -4811,14 +4811,14 @@
 return nb_drives_opt++;
 }

 -int drive_get_index(BlockInterfaceType interface, int bus, int unit)
 +int drive_get_index(BlockInterfaceType binterface, int bus, int unit)
 {
 int index;

 /* seek interface, bus and unit */

 for (index = 0; index  nb_drives; index++)
 - if (drives_table[index].interface == interface 
 + if (drives_table[index].binterface == binterface 
 drives_table[index].bus == bus 
 drives_table[index].unit == unit)
 return index;
 @@ -4826,14 +4826,14 @@
 return -1;
 }

 -int drive_get_max_bus(BlockInterfaceType interface)
 +int drive_get_max_bus(BlockInterfaceType binterface)
 {
 int max_bus;
 int index;

 max_bus = -1;
 for (index = 0; index  nb_drives; index++) {
 - if(drives_table[index].interface == interface 
 + if(drives_table[index].binterface == binterface 
 drives_table[index].bus  max_bus)
 max_bus = drives_table[index].bus;
 }
 @@ -4846,7 +4846,7 @@
 char file[1024];
 char devname[128];
 const char *mediastr = ;
 - BlockInterfaceType interface;
 + BlockInterfaceType binterface;
 enum { MEDIA_DISK, MEDIA_CDROM } media;
 int bus_id, unit_id;
 int cyls, heads, secs, translation;
 @@ -4875,11 +4875,11 @@
 !strcmp(machine-name, SS-600MP) ||
 !strcmp(machine-name, versatilepb) ||
 !strcmp(machine-name, versatileab)) {
 - interface = IF_SCSI;
 + binterface = IF_SCSI;
 max_devs = MAX_SCSI_DEVS;
 strcpy(devname, scsi);
 } else {
 - interface = IF_IDE;
 + binterface = IF_IDE;
 max_devs = MAX_IDE_DEVS;
 strcpy(devname, ide);
 }
 @@ -4906,22 +4906,22 @@
 if (get_param_value(buf, sizeof(buf), if, str)) {
 strncpy(devname, buf, sizeof(devname));
 if (!strcmp(buf, ide)) {
 - interface = IF_IDE;
 + binterface = IF_IDE;
 max_devs = MAX_IDE_DEVS;
 } else if (!strcmp(buf, scsi)) {
 - interface = IF_SCSI;
 + binterface = IF_SCSI;
 max_devs = MAX_SCSI_DEVS;
 } else if (!strcmp(buf, floppy)) {
 - interface = IF_FLOPPY;
 + binterface = IF_FLOPPY;
 max_devs = 0;
 } else if (!strcmp(buf, pflash)) {
 - interface = IF_PFLASH;
 + binterface = IF_PFLASH;
 max_devs = 0;
 } else if (!strcmp(buf, mtd)) {
 - interface = IF_MTD;
 + binterface = IF_MTD;
 max_devs = 0;
 } else if (!strcmp(buf, sd)) {
 - interface = IF_SD;
 + binterface = IF_SD;
 max_devs = 0;
 } else {
 fprintf(stderr, qemu: '%s' unsupported bus type '%s'\n, str, buf);
 @@ -5036,7 +5036,7 @@

 if (unit_id == -1) {
 unit_id = 0;
 - while (drive_get_index(interface, bus_id, unit_id) != -1) {
 + while (drive_get_index(binterface, bus_id, unit_id) != -1) {
 unit_id++;
 if (max_devs  unit_id = max_devs) {
 unit_id -= max_devs;
 @@ -5057,23 +5057,23 @@
 * ignore multiple definitions
 */

 - if (drive_get_index(interface, bus_id, unit_id) != -1)
 + if (drive_get_index(binterface, bus_id, unit_id) != -1)
 return 0;

 /* init */

 - if (interface == IF_IDE || interface == IF_SCSI)
 + if (binterface == IF_IDE || binterface == IF_SCSI)
 mediastr = (media == MEDIA_CDROM) ? -cd : -hd;
 snprintf(buf, sizeof(buf), max_devs ? %1$s%4$i%2$s%3$i : %s%s%i,
 devname, mediastr, unit_id, bus_id);
 bdrv = bdrv_new(buf);
 drives_table[nb_drives].bdrv = bdrv;
 - drives_table[nb_drives].interface = interface;
 + drives_table[nb_drives].binterface = binterface;
 drives_table[nb_drives].bus = bus_id;
 drives_table[nb_drives].unit = unit_id;
 nb_drives++;

 - switch(interface) {
 + switch(binterface) {
 case IF_IDE:
 case IF_SCSI:
 switch(media) {






Re: [Qemu-devel] qemu-forum.ipi.fi down?

2007-12-12 Thread Ben Taylor

 Robert Nestor [EMAIL PROTECTED] wrote: 
 It seems qemu-forum.ipi.fi is down.  Is there an alternate place one  
 can obtain source snapshots or browse the user forums?

I mentioned something to Pablo, and he said he could see it
from where he was, but he suspected there's some DNS problem
that needs resolving.  Give it a few days, as it sounded like
he was out of town.

Ben





[Qemu-devel] Will QEUM work for me?

2007-12-12 Thread Dvorak DDV

Hi all,

	I'm trying to find out a virtualization solution to fit our project.  
Do you think QEUM is the right choice for me?


Host OS: Windows, Max OS X (Intel), Linux (x86 or x86_64), Solaris  
(Optional)


Guest OS: Scientific Linux 3 or 4 (x86, the option to support 64bit  
and SMP in the future will be good). It should be enough if the users  
can only see text GUI of the guest os.


UseCases:
	Basic: centrally generated images are distributed to the end users  
running different Host OS. End users run the OS on this image to do  
their work. (Order of thousands of users)
	The reason we are seeking virtualization is that the code (Linux) is  
not easily portable to Windows and Mac OS while the users need to do  
their work on their own laptops.


	Grid: Centrally generated images are distributed to different nodes  
on the GRID. Computing jobs are run on these GRID of virtual  
machines (Order of tens of thousands of CPUs)




Many thanks for any income.

-Dvorak





Re: [Qemu-devel] [PATCH 2 of 3] Optionally link against libuuid if present

2007-12-12 Thread Fabrice Bellard
Filip Navara wrote:
 Hi Ryan  others,
 
 now I have been holding a SMBIOS patch on my hard disk for way to long it
 seems. I used a different approach from yours, so I decided to publish it
 for review or further ideas. What I did was to modify the bochs bios to
 produce the SMBIOS tables and I get the UUID using VMware backdoor port from
 the virtual machine.
 
 Attached are just the changed files, creating a patch will take a while
 because it's against VERY OLD version of the sources.
 
 Oh, it also contains ACPI patch for the processor descriptors which was
 needed for some Windows versions and Darwin. Similar patch was used in KVM
 before, but this one dynamically detects the number of CPUs.

I strongly prefer your solution (Bochs BIOS) compared to modifying QEMU:
I already spent a lot of time moving the ACPI tables and other stuff to
the Bochs BIOS just for that !

Regards,

Fabrice.




Re: [Qemu-devel] [PATCH] arm eabi TLS

2007-12-12 Thread Fabrice Bellard
Thayne Harbaugh wrote:
 I believe Paul Brook did the original patch for arm eabi TLS.  The patch
 has bounced around for a bit but hasn't been applied.  We've been using
 this patch for a while and have tweaked it to be a bit more correct as
 far as code organization.
 
 Please let me know what else should be improved for this so that it can
 be applied.

- the clone() syscall must be disabled when it is used to create a
thread because it cannot work reliably in its current state.

- the system to intercept calls to the syscall page must be made more
generic to be used at least by arm user and x86_64 user.

- It would be good to limit the changes in the CPU emulation code to
handle the TLS. For example, on MIPS, the TLS register must not be
stored in the CPU state. Same for ARM.

Regards,

Fabrice.




Re: [Qemu-devel] Windows build broken

2007-12-12 Thread JonY

Stefan Weil wrote:

basetyps.h is included by windows.h / rpc.h. QEMU does not need it, so
you can avoid it like this:

#define WIN32_LEAN_AND_MEAN
#include windows.h

WIN32_LEAN_AND_MEAN reduces the number of includes in windows.h
and increases compilation speed. And you don't have to rename
variables like interface :-)

Regards,
Stefan

Eduardo Felipe schrieb:

2007/12/12, C.W. Betts [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]:

Could you perhaps give a patch?  I don't feel like going through
and changing every instance of BlockInterfaceType to something else.


Having a closer look I think the underlying problem is a name conflict
with a #define in Mingw's header file basetyps.h, so renaming
variables looks right to me. Patch attached.

Regards,




Hi,

I would prefer Eduardo's patch, defining WIN32_LEAN_AND_MEAN breaks dsound.

Thanks.




Re: [Qemu-devel] [PATCH] arm eabi TLS

2007-12-12 Thread Thayne Harbaugh

On Thu, 2007-12-13 at 01:21 +, Paul Brook wrote:
  - It would be good to limit the changes in the CPU emulation code to
  handle the TLS. For example, on MIPS, the TLS register must not be
  stored in the CPU state. Same for ARM.
 
 I disagree. The TLS register is part of the CPU state. On many machines 
 (including ARMv6 CPUs) it's an actual CPU register. I'm fairly sure the same 
 is true for recent MIPS revisions.

I agree with Paul.  Some archs actually use a CPU register and require
the kernel to help manage TLS.  Other archs can manage TLS completely in
user space.  It's been a while since I've investigated all the details
for each arch but I'll go review it.





[Qemu-devel] [Patch 1/2v2][PXA27x] initial keypad support

2007-12-12 Thread Armin

Hello,
Here is a new series of keypad support patches for the PXA27x.
I believe I have addressed all the concerns from my first set of patch.

Feedback and comment welcome.
-Armin
Index: qemu/hw/pxa.h
===
--- qemu.orig/hw/pxa.h
+++ qemu/hw/pxa.h
@@ -13,6 +13,7 @@
 # define PXA2XX_PIC_SSP3	0
 # define PXA2XX_PIC_USBH2	2
 # define PXA2XX_PIC_USBH1	3
+# define PXA2XX_PIC_KEYPAD	4
 # define PXA2XX_PIC_PWRI2C	6
 # define PXA25X_PIC_HWUART	7
 # define PXA27X_PIC_OST_4_11	7
@@ -120,6 +121,17 @@ i2c_bus *pxa2xx_i2c_bus(struct pxa2xx_i2
 struct pxa2xx_i2s_s;
 struct pxa2xx_fir_s;
 
+/* pxa2xx_kpad.c */
+struct  keymap {
+int column;
+int row;
+};
+struct pxa2xx_keypad_s;
+struct pxa2xx_keypad_s *pxa27x_keypad_init(target_phys_addr_t base,
+qemu_irq irq);
+void pxa27x_register_keypad(struct pxa2xx_keypad_s *kp, struct keymap *map,
+int size);
+
 struct pxa2xx_state_s {
 CPUState *env;
 qemu_irq *pic;
@@ -133,6 +145,7 @@ struct pxa2xx_state_s {
 struct pxa2xx_pcmcia_s *pcmcia[2];
 struct pxa2xx_i2s_s *i2s;
 struct pxa2xx_fir_s *fir;
+struct pxa2xx_keypad_s *kp;
 
 /* Power management */
 target_phys_addr_t pm_base;
Index: qemu/hw/pxa2xx.c
===
--- qemu.orig/hw/pxa2xx.c
+++ qemu/hw/pxa2xx.c
@@ -2156,6 +2156,7 @@ struct pxa2xx_state_s *pxa270_init(unsig
 /* GPIO1 resets the processor */
 /* The handler can be overridden by board-specific code */
 pxa2xx_gpio_out_set(s-gpio, 1, s-reset);
+	s-kp = pxa27x_keypad_init(0x4150, s-pic[PXA2XX_PIC_KEYPAD]);
 return s;
 }
 
Index: qemu/hw/pxa2xx_keypad.c
===
--- /dev/null
+++ qemu/hw/pxa2xx_keypad.c
@@ -0,0 +1,344 @@
+/*
+ * Intel PXA27X Keypad Controller emulation.
+ *
+ * Copyright (c) 2007 MontaVista Software, Inc
+ * Written by Armin Kuster [EMAIL PROTECTED]
+ *  or  [EMAIL PROTECTED]
+ *
+ * This code is licensed under the GPLv2.
+ */
+
+#include hw.h
+#include pxa.h
+#include console.h
+
+/*
+ * Keypad
+ */
+#define KPC 0x00/* Keypad Interface Control register */
+#define KPDK0x08/* Keypad Interface Direct Key register */
+#define KPREC   0x10/* Keypad Interface Rotary Encoder register */
+#define KPMK0x18/* Keypad Interface Matrix Key register */
+#define KPAS0x20/* Keypad Interface Automatic Scan register */
+#define KPASMKP00x28/* Keypad Interface Automatic Scan Multiple
+Key Presser register 0 */
+#define KPASMKP10x30/* Keypad Interface Automatic Scan Multiple
+Key Presser register 1 */
+#define KPASMKP20x38/* Keypad Interface Automatic Scan Multiple
+Key Presser register 2 */
+#define KPASMKP30x40/* Keypad Interface Automatic Scan Multiple
+Key Presser register 3 */
+#define KPKDI   0x48/* Keypad Interface Key Debounce Interval
+register */
+
+/* Keypad defines */
+#define KPC_AS  (0x1  30)  /* Automatic Scan bit */
+#define KPC_ASACT   (0x1  29)  /* Automatic Scan on Activity */
+#define KPC_MI  (0x1  22)  /* Matrix interrupt bit */
+#define KPC_IMKP(0x1  21)  /* Ignore Multiple Key Press */
+#define KPC_MS7 (0x1  20)  /* Matrix scan line 7 */
+#define KPC_MS6 (0x1  19)  /* Matrix scan line 6 */
+#define KPC_MS5 (0x1  18)  /* Matrix scan line 5 */
+#define KPC_MS4 (0x1  17)  /* Matrix scan line 4 */
+#define KPC_MS3 (0x1  16)  /* Matrix scan line 3 */
+#define KPC_MS2 (0x1  15)  /* Matrix scan line 2 */
+#define KPC_MS1 (0x1  14)  /* Matrix scan line 1 */
+#define KPC_MS0 (0x1  13)  /* Matrix scan line 0 */
+#define KPC_ME  (0x1  12)  /* Matrix Keypad Enable */
+#define KPC_MIE (0x1  11)  /* Matrix Interrupt Enable */
+#define KPC_DK_DEB_SEL  (0x1   9)  /* Direct Keypad Debounce Select */
+#define KPC_DI  (0x1   5)  /* Direct key interrupt bit */
+#define KPC_RE_ZERO_DEB (0x1   4)  /* Rotary Encoder Zero Debounce */
+#define KPC_REE1(0x1   3)  /* Rotary Encoder1 Enable */
+#define KPC_REE0(0x1   2)  /* Rotary Encoder0 Enable */
+#define KPC_DE  (0x1   1)  /* Direct Keypad Enable */
+#define KPC_DIE (0x1   0)  /* Direct Keypad interrupt Enable */
+
+#define KPDK_DKP(0x1  31)
+#define KPDK_DK7(0x1   7)
+#define KPDK_DK6(0x1   6)
+#define KPDK_DK5(0x1   5)
+#define KPDK_DK4(0x1   4)
+#define KPDK_DK3(0x1   3)
+#define KPDK_DK2(0x1   2)
+#define KPDK_DK1(0x1   1)
+#define KPDK_DK0(0x1   0)
+
+#define KPREC_OF1   (0x1  31)
+#define KPREC_UF1   (0x1  30)
+#define KPREC_OF0   (0x1  15)
+#define KPREC_UF0   (0x1  14)
+

[Qemu-devel] [Patch 2/2v2][PXA27x] Mainstone keypad support

2007-12-12 Thread Armin

Here is the Mainstone keypad martix

-Armin
Index: qemu/hw/mainstone.c
===
--- qemu.orig/hw/mainstone.c
+++ qemu/hw/mainstone.c
@@ -18,6 +18,45 @@
 #include sysemu.h
 #include flash.h
 
+static struct keymap map[0xE0] = {
+[0 ... 0xDf] = { -1, -1 },
+[0x1e] = {0,0}, /* a */
+[0x30] = {0,1}, /* b */
+[0x2e] = {0,2}, /* c */
+[0x20] = {0,3}, /* d */
+[0x12] = {0,4}, /* e */
+[0x21] = {0,5}, /* f */
+[0x22] = {1,0}, /* g */
+[0x23] = {1,1}, /* h */
+[0x17] = {1,2}, /* i */
+[0x24] = {1,3}, /* j */
+[0x25] = {1,4}, /* k */
+[0x26] = {1,5}, /* l */
+[0x32] = {2,0}, /* m */
+[0x31] = {2,1}, /* n */
+[0x18] = {2,2}, /* o */
+[0x19] = {2,3}, /* p */
+[0x10] = {2,4}, /* q */
+[0x13] = {2,5}, /* r */
+[0x1f] = {3,0}, /* s */
+[0x14] = {3,1}, /* t */
+[0x16] = {3,2}, /* u */
+[0x2f] = {3,3}, /* v */
+[0x11] = {3,4}, /* w */
+[0x2d] = {3,5}, /* x */
+[0x15] = {4,2}, /* y */
+[0x2c] = {4,3}, /* z */
+[0xc7] = {5,0}, /* Home */
+[0x2a] = {5,1}, /* shift */
+[0x39] = {5,2}, /* space */
+[0x39] = {5,3}, /* space */
+[0x1c] = {5,5}, /*  enter */
+[0xc8] = {6,0}, /* up */
+[0xd0] = {6,1}, /* down */
+[0xcb] = {6,2}, /* left */
+[0xcd] = {6,3}, /* right */
+};
+
 enum mainstone_model_e { mainstone };
 
 static void mainstone_common_init(int ram_size, int vga_ram_size,
@@ -30,6 +69,7 @@ static void mainstone_common_init(int ra
 struct pxa2xx_state_s *cpu;
 qemu_irq *mst_irq;
 int index;
+int a;
 
 if (!cpu_model)
 cpu_model = pxa270-c5;
@@ -79,6 +119,10 @@ static void mainstone_common_init(int ra
 
 mst_irq = mst_irq_init(cpu, MST_FPGA_PHYS, PXA2XX_PIC_GPIO_0);
 
+/* setup keypad */
+printf(map addr %p\n,map);
+ 	pxa27x_register_keypad(cpu-kp, map, 0xe0);
+
 /* MMC/SD host */
 pxa2xx_mmci_handlers(cpu-mmc, NULL, mst_irq[MMC_IRQ]);
 
Index: qemu/hw/mainstone.h
===
--- qemu.orig/hw/mainstone.h
+++ qemu/hw/mainstone.h
@@ -34,5 +34,4 @@
 
 extern qemu_irq
 *mst_irq_init(struct pxa2xx_state_s *cpu, uint32_t base, int irq);
-
 #endif /* __MAINSTONE_H__ */


[Qemu-devel] [BUG][PATCH] getsockopt() errno

2007-12-12 Thread Thayne Harbaugh
linux-user getsockopt() doesn't return the correct errnos for certain
cases.  This fixes errnos for unsupported levels and unsupported SOL_IP
option names.
Index: qemu/linux-user/syscall.c
===
--- qemu.orig/linux-user/syscall.c	2007-12-12 20:48:56.0 -0700
+++ qemu/linux-user/syscall.c	2007-12-12 20:50:05.0 -0700
@@ -1010,14 +1010,15 @@
 }
 break;
 default:
-goto unimplemented;
+ret = -TARGET_ENOPROTOOPT;
+break;
 }
 break;
 default:
 unimplemented:
 gemu_log(getsockopt level=%d optname=%d not yet supported\n,
  level, optname);
-ret = -TARGET_ENOSYS;
+ret = -TARGET_EOPNOTSUPP;
 break;
 }
 return ret;


[Qemu-devel] [BUG][PATCH] nanosleep doesn't write remaining time

2007-12-12 Thread Thayne Harbaugh
nanosleep() doesn't write remaining time if there's an error - but it's
when return value == -1 and errno == EINTR when the remaining time must
be written.
Index: qemu/linux-user/syscall.c
===
--- qemu.orig/linux-user/syscall.c	2007-12-12 22:01:13.0 -0700
+++ qemu/linux-user/syscall.c	2007-12-12 22:08:49.0 -0700
@@ -5134,7 +5134,7 @@
 if (copy_from_user_timespec(req, arg1))
 goto efault;
 ret = get_errno(nanosleep(req, rem));
-if (!is_error(ret)  arg2) {
+if (ret == -TARGET_EINTR  arg2) {
 if (copy_to_user_timespec(arg2, rem))
 goto efault;
 }


[Qemu-devel] [BUG][PATCH] setsockopt() errno

2007-12-12 Thread Thayne Harbaugh
linux-user setsockopt() doesn't return the correct errno for certain
cases.  This fixes errno for unsupported levels.  It's similar to the
bug in getsockopt().
Index: qemu/linux-user/syscall.c
===
--- qemu.orig/linux-user/syscall.c	2007-12-12 22:26:51.0 -0700
+++ qemu/linux-user/syscall.c	2007-12-12 22:27:41.0 -0700
@@ -920,7 +920,7 @@
 default:
 unimplemented:
 gemu_log(Unsupported setsockopt level=%d optname=%d \n, level, optname);
-ret = -TARGET_ENOSYS;
+ret = -TARGET_ENOPROTOOPT;
 }
 return ret;
 }