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

2007-12-13 Thread Fabrice Bellard

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.


If some CPUs implement it in hardware, then I agree.

Fabrice.




[Qemu-devel] [PPC] segfault with crnand instruction

2007-12-13 Thread claude vittoria
Hi everybody,

I get a segfault with qemu-ppc-softmmu, Source downloaded yesterday, 12/12/O7.

After dump my program, I see this instruction fails at nip

4d d6 d1 c2 crnand  4*cr3+eq,4*cr5+eq,4*cr6+eq

in function
translate.c: static inline int gen_intermediate_code_internal 
l 6218
/* Is opcode *REALLY* valid ? */
if (unlikely(handler->handler == &gen_invalid)) {

handler->handler is not valid.

Could you confirm ?

Regards,
Claude 





Re: [Qemu-devel] [PATCH] Fix compilation with Cygwin

2007-12-13 Thread Balazs Attila-Mihaly (Cd-MaN)
I just want to confirm that the fix works also for MinGW. At first I dind't 
like the word "type" and would have preferred something like "if_type", but I 
realized that drives[i].type is just as readable as drives[i].if_type.

- Original Message 
From: Hervé Poussineau <[EMAIL PROTECTED]>
To: qemu-devel@nongnu.org
Sent: Thursday, 13 December, 2007 9:42:07 AM
Subject: [Qemu-devel] [PATCH] Fix compilation with Cygwin

Hi,

Cygwin compiler doesn't seem to like variables/structure members which
 are
named "interface".
This patch renames them to "type".

Hervé





  __
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com





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

2007-12-13 Thread Daniel Jacobowitz
On Thu, Dec 13, 2007 at 01:21:03AM +, Paul Brook wrote:
> 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.

That's correct, though I don't know if there is silicon to match yet.

-- 
Daniel Jacobowitz
CodeSourcery




Re: [Qemu-devel][Patch] Windows build broken

2007-12-13 Thread Stefan Weil
Here is a patch using WIN32_LEAN_AND_MEAN which tries not to break
dsound (and vl.c). I could only test it using cross compilation from Linux,
so please send comments.

Patch description:
* add WIN32_LEAN_AND_MEAN to all inclusions of windows.h
* remove windows.h from vl.c (it is already included otherwise)
* add mmsystem.h to vl.c and dsoundaudio.c (they need it and got it from
windows.h)
* fixed indentation in vl.c (wrong indentation was caused by an earlier
patch from me)

It will be difficult to avoid using variable names like "interface" in the
future, so I still think using a minimal set of includes is the better
(and faster) solution.

Anyway, Windows users need a working solution, so it would be nice if one
of these patches could be applied to CVS HEAD.

Thank you.
Stefan

JonY schrieb:
> 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 
>>
>> 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
>
> Hi,
>
> I would prefer Eduardo's patch, defining WIN32_LEAN_AND_MEAN breaks
> dsound.
>
> Thanks.
>
>
>

Index: qemu_socket.h
===
RCS file: /sources/qemu/qemu/qemu_socket.h,v
retrieving revision 1.2
diff -u -r1.2 qemu_socket.h
--- qemu_socket.h	21 Dec 2006 19:46:43 -	1.2
+++ qemu_socket.h	13 Dec 2007 20:09:04 -
@@ -3,7 +3,7 @@
 #define QEMU_SOCKET_H
 
 #ifdef _WIN32
-
+#define WIN32_LEAN_AND_MEAN
 #include 
 #include 
 #include 
Index: osdep.c
===
RCS file: /sources/qemu/qemu/osdep.c,v
retrieving revision 1.20
diff -u -r1.20 osdep.c
--- osdep.c	18 Nov 2007 01:44:35 -	1.20
+++ osdep.c	13 Dec 2007 20:09:05 -
@@ -37,6 +37,7 @@
 #include "sysemu.h"
 
 #ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
 #include 
 #elif defined(_BSD)
 #include 
Index: vl.c
===
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.379
diff -u -r1.379 vl.c
--- vl.c	11 Dec 2007 23:23:51 -	1.379
+++ vl.c	13 Dec 2007 20:09:07 -
@@ -109,7 +109,7 @@
 #ifdef _WIN32
 #include 
 #include 
-#include 
+#include 
 #define getopt_long_only getopt_long
 #define memalign(align, size) malloc(size)
 #endif
@@ -8937,7 +8937,7 @@
 s->down_script[0])
 launch_script(s->down_script, ifname, s->fd);
 }
-}
+}
 }
 #endif
 return 0;
Index: tap-win32.c
===
RCS file: /sources/qemu/qemu/tap-win32.c,v
retrieving revision 1.7
diff -u -r1.7 tap-win32.c
--- tap-win32.c	17 Nov 2007 17:14:38 -	1.7
+++ tap-win32.c	13 Dec 2007 20:09:07 -
@@ -30,6 +30,7 @@
 #include "net.h"
 #include "sysemu.h"
 #include 
+#define WIN32_LEAN_AND_MEAN
 #include 
 
 /* NOTE: PCIBus is redefined in winddk.h */
Index: qemu-common.h
===
RCS file: /sources/qemu/qemu/qemu-common.h,v
retrieving revision 1.3
diff -u -r1.3 qemu-common.h
--- qemu-common.h	19 Nov 2007 00:38:33 -	1.3
+++ qemu-common.h	13 Dec 2007 20:09:07 -
@@ -28,6 +28,7 @@
 #endif
 
 #ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
 #include 
 #define fsync _commit
 #define lseek _lseeki64
Index: exec.c
===
RCS file: /sources/qemu/qemu/exec.c,v
retrieving revision 1.119
diff -u -r1.119 exec.c
--- exec.c	12 Dec 2007 01:16:22 -	1.119
+++ exec.c	13 Dec 2007 20:09:08 -
@@ -19,6 +19,7 @@
  */
 #include "config.h"
 #ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
 #include 
 #else
 #include 
Index: qemu-img.c
===
RCS file: /sources/qemu/qemu/qemu-img.c,v
retrieving revision 1.25
diff -u -r1.25 qemu-img.c
--- qemu-img.c	11 Nov 2007 03:33:13 -	1.25
+++ qemu-img.c	13 Dec 2007 20:09:09 -
@@ -26,6 +26,7 @@
 #include 
 
 #ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
 #include 
 #endif
 
Index: kqemu.c
===
RCS file: /sources/qemu/qemu/kqemu.c,v
retrieving revision 1.19
diff -u -r1.19 kqemu.c
--- kqemu.c	17 Sep 2007 08:09:44 -	1.19
+++ kqemu.c	13 Dec 2007 20:09:09 -
@@ -19,6 +19,7 @@
  */
 #include "config.h"
 #ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
 #include 
 #include 
 #else
Index: audio/dsoundaudio.c
===
RCS file: /sources/qemu/qemu/audio/dsoundaudio.c,v
retrieving revision 1.4
diff -u -r1.4 dsoundaudio.c
--- audio/dsoundaudio.c	17 Nov 2007 17:35:54 -	1.4
+++ audio/dsoundaudio.c	13 Dec 2007 20:09:09 -
@@ -32,7 +32,9 @@
 #define AUDIO_CAP "dsound"
 #include "audio_int.h"
 
+#define WIN32_LEAN_AN

[Qemu-devel] multiple VM on one tap device

2007-12-13 Thread Kирилл Паленов
Hello all.

Is it possible run several VM connected with one tap device?
I tried to run two VM with allready exist tap0 but when I started second
I've got message: "warning: could not configure /dev/net/tun: no virtual
network emulation Could not initialize device 'tap' ".

I did following under root:

-bash-3.00# tunctl -b -t tap0
-bash-3.00# ifconfig tap0 192.168.4.1 netmask 255.255.255.0 up
-bash-3.00# ifconfig tap0
tap0  Link encap:Ethernet  HWaddr 00:FF:A1:81:05:B0
  inet addr:192.168.4.1  Bcast:192.168.4.255  Mask:255.255.255.0
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:500
  RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Then started VM with following parameters:

1. -net nic,macaddr=00:1a:4b:34:74:43 -net
tap,vlan=0,ifname=tap0,host=sv3,script=no
2. -net nic,macaddr=00:1a:4b:34:74:44 -net
tap,vlan=0,ifname=tap0,host=sv4,script=no

I did it under linux kernel 2.6.23.9.

What does it mean fd in -net tap,fd ?  File discriptor of /dev/net/tun  or
tap device.


[Qemu-devel] [PATCH] Reduce redundant timer rearming

2007-12-13 Thread Anders

The dynticks code in qemu sets and gets timers very often. These
are the system calls (strace -c) of qemu/kvm running an idle Linux 
kernel at 250Hz for 10 seconds:


% time seconds  usecs/call callserrors syscall
-- --- --- - - 
 99.670.014391   1 23248  3187 ioctl
  0.330.47   0 43643   clock_gettime
  0.000.00   0  6375   gettimeofday
  0.000.00   0  6708   select
  0.000.00   0  3187   rt_sigaction
  0.000.00   0  9562  6375 rt_sigtimedwait
  0.000.00   0 10311   timer_settime
  0.000.00   0 12750   timer_gettime
-- --- --- - - 
100.000.014438115784  9562 total


The qemu_rearm_alarm_timer() function looks at vm_clock as well as 
rt_clock timers, but is called from qemu_run_timers() which looks at 
just one queue.


When an rt_clock timer has expired, the vm_clock iteration will rearm
with MIN_TIMER_REARM_US. This is not needed, since the timer in question 
will be removed right away when qemu_run_timers() is run on the rt_clock 
queue.


Moving the rearm call to after the two calls of qemu_run_timers() helps 
a lot:



% time seconds  usecs/call callserrors syscall
-- --- --- - - 
 99.740.012590   1 22766  2706 ioctl
  0.260.33   0 27044   clock_gettime
  0.000.00   0  5413   gettimeofday
  0.000.00   0  5745   select
  0.000.00   0  2706   rt_sigaction
  0.000.00   0  8119  5413 rt_sigtimedwait
  0.000.00   0  5215   timer_settime
  0.000.00   0  5413   timer_gettime
-- --- --- - - 
100.000.012623 82421  8119 total


Patch (based on kvm-userspace git) attached.



Cheers,
Anders.
diff --git a/qemu/vl.c b/qemu/vl.c
index 80ceb2f..2cd580d 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -1063,7 +1063,6 @@ static void qemu_run_timers(QEMUTimer **ptimer_head, int64_t current_time)
 /* run the callback (the timer list can be modified) */
 ts->cb(ts->opaque);
 }
-qemu_rearm_alarm_timer(alarm_timer);
 }
 
 int64_t qemu_get_clock(QEMUClock *clock)
@@ -7216,6 +7215,8 @@ void main_loop_wait(int timeout)
 qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME],
 qemu_get_clock(rt_clock));
 
+qemu_rearm_alarm_timer(alarm_timer);
+
 /* Check bottom-halves last in case any of the earlier events triggered
them.  */
 qemu_bh_poll();


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

2007-12-13 Thread Andreas Färber


Am 12.12.2007 um 13:08 schrieb Alexander Graf:

Does it work if you specify "-framework CoreFoundation -framework  
IOKit" in your LDFLAGS? That's what was needed on my Leopard x86_64  
build.


If I configure with LDFLAGS:
LDFLAGS="-framework CoreFoundation -framework IOKit" ./configure -- 
prefix=/Users/andreas/Q/latest --target-list=sparc-softmmu --enable- 
cocoa

it now ends like this:

gcc-3.3 -Wall -O2 -g -fno-strict-aliasing -I. -I.. -I/Users/andreas/Q/ 
myqemu/target-sparc -I/Users/andreas/Q/myqemu -D__powerpc__ - 
D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/Users/ 
andreas/Q/myqemu/fpu -I/Users/andreas/Q/myqemu/slirp  -mdynamic-no- 
pic  -c -o cocoa.o /Users/andreas/Q/myqemu/cocoa.m
In file included from /System/Library/Frameworks/Foundation.framework/ 
Headers/Foundation.h:15,
 from /System/Library/Frameworks/Cocoa.framework/ 
Headers/Cocoa.h:12,

 from /Users/andreas/Q/myqemu/cocoa.m:38:
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:62:  
error: parse error before "__attribute__"
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:66:  
error: parse error before "__attribute__"
In file included from /System/Library/Frameworks/Foundation.framework/ 
Headers/NSAttributedString.h:6,
 from /System/Library/Frameworks/Foundation.framework/ 
Headers/Foundation.h:16,
 from /System/Library/Frameworks/Cocoa.framework/ 
Headers/Cocoa.h:12,

 from /Users/andreas/Q/myqemu/cocoa.m:38:
/System/Library/Frameworks/Foundation.framework/Headers/NSDictionary.h: 
45: error: parse error before "__attribute__"
/System/Library/Frameworks/Foundation.framework/Headers/NSDictionary.h: 
50: error: parse error before "__attribute__"
In file included from /System/Library/Frameworks/Foundation.framework/ 
Headers/NSHashTable.h:5,
 from /System/Library/Frameworks/Foundation.framework/ 
Headers/Foundation.h:43,
 from /System/Library/Frameworks/Cocoa.framework/ 
Headers/Cocoa.h:12,

 from /Users/andreas/Q/myqemu/cocoa.m:38:
/System/Library/Frameworks/Foundation.framework/Headers/ 
NSPointerFunctions.h:59: error: parse error before '@' token
In file included from /System/Library/Frameworks/Foundation.framework/ 
Headers/NSKeyValueCoding.h:9,
 from /System/Library/Frameworks/Foundation.framework/ 
Headers/Foundation.h:49,
 from /System/Library/Frameworks/Cocoa.framework/ 
Headers/Cocoa.h:12,

 from /Users/andreas/Q/myqemu/cocoa.m:38:
/System/Library/Frameworks/Foundation.framework/Headers/NSSet.h:45:  
error: parse error before "__attribute__"
/System/Library/Frameworks/Foundation.framework/Headers/NSSet.h:50:  
error: parse error before "__attribute__"
In file included from /System/Library/Frameworks/AppKit.framework/ 
Headers/AppKit.h:19,
 from /System/Library/Frameworks/Cocoa.framework/ 
Headers/Cocoa.h:13,

 from /Users/andreas/Q/myqemu/cocoa.m:38:
/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h: 
68: error: parse error before "__weak"
In file included from /System/Library/Frameworks/AppKit.framework/ 
Headers/AppKit.h:78,
 from /System/Library/Frameworks/Cocoa.framework/ 
Headers/Cocoa.h:13,

 from /Users/andreas/Q/myqemu/cocoa.m:38:
/System/Library/Frameworks/AppKit.framework/Headers/NSPrintPanel.h:57:  
error: parse error before '@' token
In file included from /System/Library/Frameworks/AppKit.framework/ 
Headers/AppKit.h:95,
 from /System/Library/Frameworks/Cocoa.framework/ 
Headers/Cocoa.h:13,

 from /Users/andreas/Q/myqemu/cocoa.m:38:
/System/Library/Frameworks/AppKit.framework/Headers/NSTrackingArea.h: 
44: error: parse error before "__weak"
In file included from /System/Library/Frameworks/AppKit.framework/ 
Headers/NSTextView.h:16,
 from /System/Library/Frameworks/AppKit.framework/ 
Headers/AppKit.h:112,
 from /System/Library/Frameworks/Cocoa.framework/ 
Headers/Cocoa.h:13,

 from /Users/andreas/Q/myqemu/cocoa.m:38:
/System/Library/Frameworks/AppKit.framework/Headers/ 
NSTextInputClient.h:17: error: parse error before '@' token
/System/Library/Frameworks/AppKit.framework/Headers/ 
NSTextInputClient.h:62: error: parse error before '@' token
In file included from /System/Library/Frameworks/AppKit.framework/ 
Headers/NSObjectController.h:10,
 from /System/Library/Frameworks/AppKit.framework/ 
Headers/AppKit.h:158,
 from /System/Library/Frameworks/Cocoa.framework/ 
Headers/Cocoa.h:13,

 from /Users/andreas/Q/myqemu/cocoa.m:38:
/System/Library/Frameworks/CoreData.framework/Headers/NSFetchRequest.h: 
24: error: parse error before "__weak"
In file included from /System/Library/Frameworks/CoreData.framework/ 
Headers/NSAttributeDescription.h:10,
 from /System/Library/Frameworks/Ap

Re: [Qemu-devel] [PATCH 2] Reduce redundant timer rearming

2007-12-13 Thread Anders

(resending with the subscribed sender address)

> % time seconds  usecs/call callserrors syscall
> -- --- --- - - 
>   99.740.012590   1 22766  2706 ioctl
>0.260.33   0 27044   clock_gettime
>0.000.00   0  5413   gettimeofday
>0.000.00   0  5745   select
>0.000.00   0  2706   rt_sigaction
>0.000.00   0  8119  5413 rt_sigtimedwait
>0.000.00   0  5215   timer_settime
>0.000.00   0  5413   timer_gettime
> -- --- --- - - 
> 100.000.012623 82421  8119 total

Here is another patch that implements a dirty bit for the timer lists.
The bit is set when timers are modified or expire. Rearming clears the
bit (and only happens if it is set).

Numbers improve to this:

% time seconds  usecs/call callserrors syscall
-- --- --- - - 
100.000.13   0 21813   clock_gettime
  0.000.00   0 22789  2729 ioctl
  0.000.00   0  5459   gettimeofday
  0.000.00   0  5790   select
  0.000.00   0  2729   rt_sigaction
  0.000.00   0  8188  5459 rt_sigtimedwait
  0.000.00   0  2729   timer_settime
  0.000.00   0  2752   timer_gettime
-- --- --- - - 
100.000.13 72249  8188 total


I am not so sure about this one, so comments are appreciated.


Best regards,
Anders.


diff --git a/qemu/vl.c b/qemu/vl.c
index 2cd580d..924736e 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -816,6 +816,7 @@ struct qemu_alarm_timer {
 };
 
 #define ALARM_FLAG_DYNTICKS  0x1
+#define ALARM_FLAG_MODIFIED  0x2
 
 static inline int alarm_has_dynticks(struct qemu_alarm_timer *t)
 {
@@ -827,6 +828,11 @@ static void qemu_rearm_alarm_timer(struct qemu_alarm_timer *t)
 if (!alarm_has_dynticks(t))
 return;
 
+if (!(t->flags & ALARM_FLAG_MODIFIED))
+return;
+
+t->flags &= ~(ALARM_FLAG_MODIFIED);
+
 t->rearm(t);
 }
 
@@ -989,6 +995,8 @@ void qemu_del_timer(QEMUTimer *ts)
 {
 QEMUTimer **pt, *t;
 
+alarm_timer->flags |= ALARM_FLAG_MODIFIED;
+
 /* NOTE: this code must be signal safe because
qemu_timer_expired() can be called from a signal. */
 pt = &active_timers[ts->clock->type];
@@ -1182,6 +1190,7 @@ static void host_alarm_handler(int host_signum)
 #endif
 CPUState *env = cpu_single_env;
 if (env) {
+alarm_timer->flags |= ALARM_FLAG_MODIFIED;
 /* stop the currently executing cpu because a timer occured */
 cpu_interrupt(env, CPU_INTERRUPT_EXIT);
 #ifdef USE_KQEMU


Re: [Qemu-devel] [PATCH 3] Reduce redundant timer rearming

2007-12-13 Thread Anders
The VGA refresh (a 33 Hz timer) is running even with -nographics, 
apparently doing nothing. The vga_hw_update() call ends up just 
returning, because the display depth is zero.


This patch removes the dummy refresh handler, and thus the GUI refresh 
timer.



With an idle dyntick Linux guest in qemu/kvm, there are now only two 
timers per second (those are from the rtc). Another 10 seconds strace:


% time seconds  usecs/call callserrors syscall
-- --- --- - - 
100.000.12   0  376020 ioctl
  0.000.00   041   select
  0.000.00   020   rt_sigaction
  0.000.00   06141 rt_sigtimedwait
  0.000.00   020   timer_settime
  0.000.00   020   timer_gettime
  0.000.00   0   162   clock_gettime
-- --- --- - - 
100.000.12  408461 total


Cheers,
Anders.
diff --git a/qemu/vl.c b/qemu/vl.c
index 30c9537..8d67314 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -4902,13 +4902,6 @@ static void dumb_resize(DisplayState *ds, int w, int h)
 {
 }
 
-static void dumb_refresh(DisplayState *ds)
-{
-#if defined(CONFIG_SDL)
-vga_hw_update();
-#endif
-}
-
 static void dumb_display_init(DisplayState *ds)
 {
 ds->data = NULL;
@@ -4916,7 +4909,7 @@ static void dumb_display_init(DisplayState *ds)
 ds->depth = 0;
 ds->dpy_update = dumb_update;
 ds->dpy_resize = dumb_resize;
-ds->dpy_refresh = dumb_refresh;
+ds->dpy_refresh = NULL;
 }
 
 /***/


Re: [Qemu-devel][Patch] Windows build broken

2007-12-13 Thread JonY

Stefan Weil wrote:

Here is a patch using WIN32_LEAN_AND_MEAN which tries not to break
dsound (and vl.c). I could only test it using cross compilation from Linux,
so please send comments.

Patch description:
* add WIN32_LEAN_AND_MEAN to all inclusions of windows.h
* remove windows.h from vl.c (it is already included otherwise)
* add mmsystem.h to vl.c and dsoundaudio.c (they need it and got it from
windows.h)
* fixed indentation in vl.c (wrong indentation was caused by an earlier
patch from me)

It will be difficult to avoid using variable names like "interface" in the
future, so I still think using a minimal set of includes is the better
(and faster) solution.

Anyway, Windows users need a working solution, so it would be nice if one
of these patches could be applied to CVS HEAD.

Thank you.
Stefan

JonY schrieb:

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 

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

Hi,

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

Thanks.







Ok, this patch works as intended. Thanks for the patch!

Slightly off topic, but still on Windows builds broken.

For some odd reason, dyngen-exec.h is always conflicting with 
stdint.h(?!!) for me. Can somebody explain why the typedefs are in 
dyngen-exec.h?


Mingw does not have ffs, localtime_r, gmtime_r, which breaks when 
compiling some files.


I propose adding the following for *_r functions on mingw hosts.
#define localtime_r(x, y) memcpy(y, localtime(x), sizeof(y))
#define gmtime_r(x, y) memcpy(y, gmtime(x), sizeof(y))

There are many implementations of ffs(), but I'm unsure what it does :(