Native Port of QEMU to Haiku
Subsystems (2)
Hi there
I'm one of the developers that work on the Haiku OS and have also been maintaining the BeOS/Haiku port of QEMU for the last couple of years. Due to BeOS being locked into GCC 2.95.3 and our commitment to provide binary compatibility with BeOS R5 in the first Haiku release, getting this port to work and maintaining it has been a lot of work and largely just a hack.
Haiku however also has a native GCC 4.3.3 toolchain since some time and I brought the QEMU port up to date using it. Since QEMU is pure C, it was possible to mix the Haiku display part and audio backend compiled with GCC 2.95.3 with a GCC 4.3.3 compiled QEMU core (this doesn't require any code changes and will simply continue to work once we migrate fully to GCC 4). This made it possible to do a much cleaner port that I think could now also be commited into the QEMU repository.
Since BeOS is not going anywhere and since it is stuck with the old GCC, I've removed all the leftovers from the original BeOS port so the final patch simply adds native Haiku support to QEMU.
The patch linked below is against the 0.10.4 release sources including kqemu in a kqemu subdirectory. Please advice if you would be willing to include this work into your repository. If necessary I can split this up into multiple patches providing more detailed info on the different parts or diff it against more current sources. Please just let me know.
http://haiku.mlotz.ch/qemu-0.10.4-haiku.diff
Regards
Michael
Quoted 27 lines · Michael Lotz
Hi there
I'm one of the developers that work on the Haiku OS and have also been maintaining the BeOS/Haiku port of QEMU for the last couple of years. Due to BeOS being locked into GCC 2.95.3 and our commitment to provide binary compatibility with BeOS R5 in the first Haiku release, getting this port to work and maintaining it has been a lot of work and largely just a hack.
Haiku however also has a native GCC 4.3.3 toolchain since some time and I brought the QEMU port up to date using it. Since QEMU is pure C, it was possible to mix the Haiku display part and audio backend compiled with GCC 2.95.3 with a GCC 4.3.3 compiled QEMU core (this doesn't require any code changes and will simply continue to work once we migrate fully to GCC 4). This made it possible to do a much cleaner port that I think could now also be commited into the QEMU repository.
Since BeOS is not going anywhere and since it is stuck with the old GCC, I've removed all the leftovers from the original BeOS port so the final patch simply adds native Haiku support to QEMU.
The patch linked below is against the 0.10.4 release sources including kqemu in a kqemu subdirectory. Please advice if you would be willing to include this work into your repository. If necessary I can split this up into multiple patches providing more detailed info on the different parts or diff it against more current sources. Please just let me know.
Quoted 7 lines
http://haiku.mlotz.ch/qemu-0.10.4-haiku.diff
Regards
Michael
Hi,
it should be possible to get standard integral types like int32_t from stdint.h, so special code for Haiku in fpu/softfloat.h or kqemu/kqemu-haiku.c can be removed.
Regards
Stefan
Quoted 2 lines · Michael Lotz
The patch linked below is against the 0.10.4 release sources including kqemu in a kqemu subdirectory. Please advice if you would be willing to include this work into your repository. If necessary I can split this up into multiple patches providing more detailed info on the different parts or diff it against more current sources. Please just let me know.
Please patch against the qemu.git master branch. New ports are not stable branch material. Also, consult the CODING_STYLE file. Please post the patch inline instead of a link for easy review.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 4 lines · Michael Lotz
Hi there
I'm one of the developers that work on the Haiku OS and have also been maintaining the BeOS/Haiku port of QEMU for the last couple of years. Due to BeOS being locked into GCC 2.95.3 and our commitment to provide binary compatibility with BeOS R5 in the first Haiku release, getting this port to work and maintaining it has been a lot of work and largely just a hack.
Quoted 8 lines
Haiku however also has a native GCC 4.3.3 toolchain since some time and I brought the QEMU port up to date using it. Since QEMU is pure C, it was possible to mix the Haiku display part and audio backend compiled with GCC 2.95.3 with a GCC 4.3.3 compiled QEMU core (this doesn't require any code changes and will simply continue to work once we migrate fully to GCC 4). This made it possible to do a much cleaner port that I think could now also be commited into the QEMU repository.
Since BeOS is not going anywhere and since it is stuck with the old GCC, I've removed all the leftovers from the original BeOS port so the final patch simply adds native Haiku support to QEMU.
The patch linked below is against the 0.10.4 release sources including kqemu in a kqemu subdirectory. Please advice if you would be willing to include this work into your repository. If necessary I can split this up into multiple patches providing more detailed info on the different parts or diff it against more current sources. Please just let me know.
To even consider this, you have to send this to the mailing list as a series of patches either inlined or attached as plain text. A URL to a file with a non-text mime encoding is not easily reviewable.
Regards,
Anthony Liguori
Quoted 5 lines
Regards
Michael
Quoted 2 lines
I think you missed the biggest part there, which has been discussed previously, error signedness. Leaving it untouched will definitely get you into trouble.
Quoted 1 line
+
fprintf(stderr, "no tap on Haiku\n");
That can be arrange, I just need to port my BONE tuntap driver to Haiku.
François.
Am 19.05.2009 um 15:54 schrieb François Revol:
Quoted 6 lines
Quoted 2 lines
I think you missed the biggest part there, which has been discussed previously, error signedness. Leaving it untouched will definitely get you into trouble.
Didn't Ingo recently write some compatibility library for that purpose?
Andreas
Quoted 11 lines · Andreas Färber
Am 19.05.2009 um 15:54 schrieb François Revol:
Quoted 6 lines
Quoted 2 lines
I think you missed the biggest part there, which has been discussed previously, error signedness. Leaving it untouched will definitely get you into trouble.
Didn't Ingo recently write some compatibility library for that purpose?
Yep, one has to actively use it when building, though:
http://dev.haiku-os.org/changeset/29653
CU, Ingo
cover Add Haiku host support
In reply to Michael LotzHello,
The following patch series together with qemu_madvise() allows to build and run QEMU on Haiku, using GCC 4.x.
Patches 1-5 add support for Haiku hosts to build ppc-softmmu. They are based on qemu_madvise() v7, since Haiku does not have madvise(), but they do not depend on it themselves so could be cherry-picked.
Patch 6 fixes a build warning.
The following patches are based on mmlr's 0.10.4 port and are not intended for upstream inclusion at this time:
Patch 7 is needed for successful runtime execution.
Patch 8 is included as a test case and to show where things are moving wrt C++.
Not yet included is his native Haiku audio backend, also using C++.
Another issue that Michael had addressed and that I would like to see fixed differently is a mismatch between softfloat headers and sources wrt int types. I'll post a separate RFC since it's not strictly related to Haiku.
Regards,
Andreas
Andreas Färber (8):
configure: Add basic support for Haiku
configure: Don't rely on special pthreads library Haiku doesn't have libm
nbd: Haiku has _IO() in its BSD compatibility layer
tap: Add stub for Haiku
slirp: Silence warning on Haiku
qemu_malloc: Use areas on Haiku for sizes > 1 MiB
ui: Haiku frontend
Makefile | 2 + Makefile.objs | 2 + Makefile.target | 2 + configure | 33 +++- console.h | 3 + nbd.c | 2 +- net/tap-haiku.c | 61 ++++++ qemu-malloc.c | 53 +++++ rules.mak | 6 +- slirp/slirp.h | 4 +- ui/haiku.cpp | 607 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ ui/haiku.h | 96 +++++++++ vl.c | 10 +- 13 files changed, 869 insertions(+), 12 deletions(-) create mode 100644 net/tap-haiku.c create mode 100644 ui/haiku.cpp create mode 100644 ui/haiku.h
PATCH 2/8 configure: Don't rely on special pthreads library
In reply to Andreas FärberHaiku has pthreads integrated into its libroot.so library. No linker arguments are needed for it, so don't fail if -lpthread and similar don't link.
--- configure | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)
configure +11 -7
@@ -1706,13 +1706,17 @@ cat > $TMPC << EOF #include <pthread.h> int main(void) { pthread_create(0,0,0,0); return 0; } EOF -for pthread_lib in $PTHREADLIBS_LIST; do - if compile_prog "" "$pthread_lib" ; then - pthread=yes - LIBS="$pthread_lib $LIBS" - break - fi -done +if compile_prog "" "" ; then + pthread=yes +else + for pthread_lib in $PTHREADLIBS_LIST; do + if compile_prog "" "$pthread_lib" ; then + pthread=yes + LIBS="$pthread_lib $LIBS" + break + fi + done +fi if test "$mingw32" != yes -a "$pthread" = no; then echo
Signature · 1 line
1.7.1.rc2.7.g3e7f1
PATCH 1/8 configure: Add basic support for Haiku
In reply to Andreas FärberFrom: Andreas Färber <andreas.faerber>
For compatibility with BeOS, Haiku's error codes are negative whereas recent POSIX versions require them to be positive. As spotted by François, some parts of QEMU code rely on this, so use a mapper library to convert them to positive ones.
Haiku has network functions in libnetwork.so. It doesn't ship libutil.so.
--- configure | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
configure +12 -1
@@ -315,6 +315,7 @@ io_thread="no" mixemu="no" kerneldir="" aix="no" +haiku="no" blobs="yes" pkgversion="" check_utests="no"
@@ -332,6 +333,8 @@ elif check_define __OpenBSD__ ; then targetos='OpenBSD' elif check_define __sun__ ; then targetos='SunOS' +elif check_define __HAIKU__ ; then + targetos='Haiku' else targetos=`uname -s` fi
@@ -447,6 +450,11 @@ AIX) aix="yes" make="gmake" ;; +Haiku) + haiku="yes" + QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" + LIBS="-lposix_error_mapper -lnetwork $LIBS" +;; *) audio_drv_list="oss" audio_possible_drivers="oss alsa sdl esd pa"
@@ -2026,7 +2034,7 @@ elif compile_prog "" "-lrt" ; then fi if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ - "$aix" != "yes" ; then + "$aix" != "yes" -a "$haiku" != "yes" ; then libs_softmmu="-lutil $libs_softmmu" fi
@@ -2340,6 +2348,9 @@ if test "$solaris" = "yes" ; then echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak fi fi +if test "$haiku" = "yes" ; then + echo "CONFIG_HAIKU=y" >> $config_host_mak +fi if test "$static" = "yes" ; then echo "CONFIG_STATIC=y" >> $config_host_mak fi
Signature · 1 line
1.7.1.rc2.7.g3e7f1
PATCH 3/8 Haiku doesn't have libm
In reply to Andreas FärberMath functions are integrated into Haiku's libroot.
--- Makefile.target | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
Makefile.target +2 -0
@@ -31,7 +31,9 @@ endif PROGS=$(QEMU_PROG) +ifndef CONFIG_HAIKU LIBS+=-lm +endif kvm.o kvm-all.o vhost.o vhost_net.o: QEMU_CFLAGS+=$(KVM_CFLAGS)
Signature · 1 line
1.7.1.rc2.7.g3e7f1
PATCH 4/8 nbd: Haiku has _IO() in its BSD compatibility layer
--- nbd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
nbd.c +1 -1
@@ -23,7 +23,7 @@#ifndef _WIN32#include <sys/ioctl.h> #endif -#ifdef __sun__ +#if defined(__sun__) || defined(__HAIKU__)#include <sys/ioccom.h> #endif #include <ctype.h>
Signature · 1 line
1.7.1.rc2.7.g3e7f1
PATCH 5/8 tap: Add stub for Haiku
Adapted from AIX code.
--- Makefile.objs | 1 + net/tap-haiku.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 0 deletions(-) create mode 100644 net/tap-haiku.c
Makefile.objs +1 -0
@@ -31,6 +31,7 @@ net-nested-$(CONFIG_WIN32) += tap-win32.o net-nested-$(CONFIG_BSD) += tap-bsd.o net-nested-$(CONFIG_SOLARIS) += tap-solaris.o net-nested-$(CONFIG_AIX) += tap-aix.o +net-nested-$(CONFIG_HAIKU) += tap-haiku.o net-nested-$(CONFIG_SLIRP) += slirp.o net-nested-$(CONFIG_VDE) += vde.o net-obj-y += $(addprefix net/, $(net-nested-y))
net/tap-haiku.c new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
1.7.1.rc2.7.g3e7f1
PATCH 6/8 slirp: Silence warning on Haiku
Haiku has O_BINARY in fcntl.h.
--- slirp/slirp.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
slirp/slirp.h +3 -1
@@ -24,7 +24,9 @@ typedef char *caddr_t;#else # define ioctlsocket ioctl# define closesocket (s) close(s) -# define O_BINARY 0 +# if !defined(__HAIKU__) +# define O_BINARY 0 +# endif #endif #include <sys/types.h>
Signature · 1 line
1.7.1.rc2.7.g3e7f1
PATCH 7/8 qemu_malloc: Use areas on Haiku for sizes > 1 MiB
Works around a calloc() SEGV in Haiku's libroot.
Cf. http://dev.haiku-os.org/ticket/6637
Ported to HEAD based on a patch by Michael "mmlr" Lotz. Also consider the limit when reallocating.
--- configure | 1 + qemu-malloc.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 0 deletions(-)
configure +1 -0
@@ -2354,6 +2354,7 @@ if test "$solaris" = "yes" ; then fi if test "$haiku" = "yes" ; then echo "CONFIG_HAIKU=y" >> $config_host_mak + echo "CONFIG_HAIKU_USE_AREAS=y" >> $config_host_mak fi if test "$static" = "yes" ; then echo "CONFIG_STATIC=y" >> $config_host_mak
qemu-malloc.c +53 -0
80 lines not on this page · raw message
Signature · 1 line
1.7.1.rc2.7.g3e7f1
PATCH 8/8 ui: Haiku frontend
Since Haiku is still in development and raw builds don't contain the SDL or a VNC client, a native frontend is convenient. mmlr had maintained a basic one for BeOS/Haiku until the kqemu drop. The code has been ported to HEAD but is not yet fully updated to match CODING_STYLE.
Haiku's native APIs are C++ based, so we need a new make rule. Some enabled GCC warnings are not applicable to C++ code and cause warnings.
Note that this frontend is another candidate user of a central qemu_main() prototype, like Cocoa. It would also be candidate for a generic argv check for non-graphic mode, to be shared with Cocoa.
--- Makefile | 2 + Makefile.objs | 1 + configure | 1 + console.h | 3 + rules.mak | 6 +- ui/haiku.cpp | 607 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ui/haiku.h | 96 +++++++++ vl.c | 10 +- 8 files changed, 724 insertions(+), 2 deletions(-) create mode 100644 ui/haiku.cpp create mode 100644 ui/haiku.h
Makefile +2 -0
@@ -98,6 +98,8 @@ QEMU_CFLAGS+=$(CURL_CFLAGS) ui/cocoa.o: ui/cocoa.m +ui/haiku.o: ui/haiku.cpp + ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS) ui/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
Makefile.objs +1 -0
@@ -112,6 +112,7 @@ ui-obj-y += vnc-enc-tight.o vnc-palette.o ui-obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o ui-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o ui-obj-$(CONFIG_COCOA) += cocoa.o +ui-obj-$(CONFIG_HAIKU) += haiku.o ifdef CONFIG_VNC_THREAD ui-obj-y += vnc-jobs-async.o else
configure +1 -0
@@ -454,6 +454,7 @@ Haiku) haiku="yes" QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" LIBS="-lposix_error_mapper -lnetwork $LIBS" + LIBS="-lstdc++ -lbe -lgame $LIBS" ;; *) audio_drv_list="oss"
console.h +3 -0
@@ -364,6 +364,9 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);/* cocoa.m */ void cocoa_display_init (DisplayState *ds,int full_screen); +/* haiku.cpp */ +void haiku_display_init (DisplayState *ds,int full_screen); +/* vnc.c */ void vnc_display_init (DisplayState *ds);void vnc_display_close (DisplayState *ds);
rules.mak +5 -1
@@ -8,6 +8,7 @@ MAKEFLAGS += -rR %.d: %.h: %.c: +%.cpp: %.m: %.mak:
@@ -23,6 +24,9 @@ QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d %.o: %.m $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@") +%.o: %.cpp + $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," CXX $(TARGET_DIR)$@") + LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(LIBS)," LINK $(TARGET_DIR)$@") %$(EXESUF): %.o
@@ -39,7 +43,7 @@ quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \ >/dev/null 2>&1 && echo OK), $2, $3) -VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.texi +VPATH_SUFFIXES = %.c %.h %.S %.m %.cpp %.mak %.texi set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1))) # Generate timestamp files for .h include files
ui/haiku.cpp new file +607 -0
607 lines not on this page · raw message
ui/haiku.h new file +96 -0
96 lines not on this page · raw message
vl.c +9 -1
@@ -1799,6 +1799,10 @@ static const QEMUOption *lookup_opt(int argc, char **argv,return popt; } +#ifdef CONFIG_HAIKU +#define main qemu_main +#endif +int main (int argc,char **argv,char **envp) {const char *gdbstub_dev =NULL ;
@@ -2919,7 +2923,7 @@ int main(int argc, char **argv, char **envp) ds =get_displaystate ();if (display_type ==DT_DEFAULT ) { -#if defined(CONFIG_SDL ) || defined(CONFIG_COCOA ) +#if defined(CONFIG_SDL ) || defined(CONFIG_COCOA ) || defined(CONFIG_HAIKU ) display_type =DT_SDL ;#else display_type =DT_VNC ;
@@ -2945,6 +2949,10 @@ int main(int argc, char **argv, char **envp)case DT_SDL :cocoa_display_init (ds, full_screen);break ; +#elif defined(CONFIG_HAIKU ) +case DT_SDL : +haiku_display_init (ds, full_screen); +break ;#endif case DT_VNC :vnc_display_init (ds);
Signature · 1 line
1.7.1.rc2.7.g3e7f1
[Qemu-devel] Re: [HaikuPorts-devs] [FYI 7/8] qemu_malloc: Use areas on Haiku for sizes > 1 MiB
In reply to Andreas FärberHi Andreas,
Quoted 5 lines · Andreas Färber
Works around a
calloc()SEGV in Haiku's libroot.
Cf. http://dev.haiku-os.org/ticket/6637Ported to HEAD based on a patch by Michael "mmlr" Lotz. Also consider the limit when reallocating.
Were you able to run any image in qemu on haiku with this?
I'm asking because of haiku ticket #6606, which is about some problematic behaviour with respect to qemu not being able to resize an area (in effect aborting). Looking at the patch, I'd say it should still do the same ...
cheers,
Oliver
[Qemu-devel] Re: [HaikuPorts-devs] [PATCH 0/8] Add Haiku host support
In reply to Andreas FärberQuoted 6 lines · Andreas Färber
The following patch series together with
qemu_madvise()allows to build and run QEMU on Haiku, using GCC 4.x.Patches 1-5 add support for Haiku hosts to build ppc-softmmu. They are based on
qemu_madvise()v7, since Haiku does not havemadvise(), but they do not depend on it themselves so could be cherry-picked.
I didn't spot anything related to madvise() in any of the patches. Anyway, Haiku does have posix_madvise(), which, unlike madvise(), is part of POSIX.
CU, Ingo
[Qemu-devel] Re: [HaikuPorts-devs] [PATCH 0/8] Add Haiku host support
Am 20.09.2010 um 21:04 schrieb Ingo Weinhold:
Quoted 10 lines
On 2010-09-20 at 00:50:42 [+0200], Andreas Färber <[email protected]
Quoted 7 lines
wrote:
The following patch series together withqemu_madvise()allows to build and run QEMU on Haiku, using GCC 4.x.Patches 1-5 add support for Haiku hosts to build ppc-softmmu. They are based on
qemu_madvise()v7, since Haiku does not havemadvise(), but they do not depend on it themselves so could be cherry-picked.I didn't spot anything related to
madvise()in any of the patches.
My saying. :)
Quoted 2 lines
Anyway, Haiku does
haveposix_madvise(), which, unlikemadvise(), is part of POSIX.
...which is exactly what qemu_madvise() takes care of, using a configure check.
http://repo.or.cz/w/qemu/afaerber.git/commit/e88131d2177cf12dba99c13fe5ff6a21d8fb7dc1
Unfortunately posix_madvise() doesn't supply us with the full spectrum of advice flags KVM needs, so we can't prefer it over madvise() despite being part of POSIX.
Regards,
Andreas
[Qemu-devel] Re: [HaikuPorts-devs] [FYI 7/8] qemu_malloc: Use areas on Haiku for sizes > 1 MiB
In reply to Oliver TappeHi,
Am 20.09.2010 um 14:26 schrieb Oliver Tappe:
Quoted 9 lines
On 2010-09-20 at 00:50:49 [+0200], Andreas Färber <[email protected]
Quoted 6 lines
wrote:
Works around acalloc()SEGV in Haiku's libroot.
Cf. http://dev.haiku-os.org/ticket/6637Ported to HEAD based on a patch by Michael "mmlr" Lotz. Also consider the limit when reallocating.
Were you able to run any image in qemu on haiku with this?
As indicated, I built the ppc-softmmu system emulation. I was able to both play around in OpenBIOS [1] and to try booting Haiku/ppc [2], which doesn't go far due to OpenBIOS ofmem issues (cf. #6071).
i386-softmmu needs more patches to compile. Haiku's math.h is missing some POSIX macros like isless[equal], isgreater, isunordered. That should be fixed in Haiku imo instead of being worked around in QEMU. QEMU's softfloat code has a wild mix of int32 and int though that may need to be remedied then, I have a patch in preparation for that.
[1] qemu-system-ppc /dev/null
[2] qemu-system-ppc -boot d -cdrom path/to/haiku-boot-cd-ppc.iso
Quoted 3 lines
I'm asking because of haiku ticket #6606, which is about some problematic behaviour with respect to qemu not being able to resize an area (in effect aborting). Looking at the patch, I'd say it should still do the same ...
I had taken a look at #6606 and tried LD_PRELOAD=libroot-icu-addon.so qemu-system-ppc /dev/null -nographic without any luck.
Note that vanilla QEMU does not use any areas at all, it uses malloc(), calloc(), realloc() and free(). The areas were just a workaround my mmlr and, to not miscredit him, he had the following explanation in his patch:
+/*
+ The reason for the following mess is that somehow large allocations seem
+ to cause memory curruption. Most likely this is a bug in either Haiku or
+ QEMU. Since I wasn't able to repoduce the issue with other Haiku software
+ my first guess would go to QEMU, but who knows. In any case the hack below
+ makes larger allocations (>= 1MB) using areas instead of using the heap
+ to work around said issue. TODO: remove this when the reason is found/fixed! +*/
(I personally rather believe it's a bug in Haiku and that most BeOS/Haiku apps don't encounter it since they use C++ new/new[]/delete/delete[] but no realloc. But no one knows for sure until we've found out.)
As seen in this patch of mine, QEMU has a new tracing framework that should (once it compiles - Haiku doesn't have clock_gettime) show us all successful (re)allocations and a build configured with --disable-strip shows us the crashing calloc args in gdb, so we could exactly reproduce the allocations and find out if that triggers it or not.
Andreas
Blue Swirl
AppliedRe: [Qemu-devel] [PATCH 0/8] Add Haiku host support
In reply to Andreas FärberThanks, applied 1 to 6.
Quoted 57 lines · Andreas Färber
Hello,
The following patch series together with
qemu_madvise()allows to build and run QEMU on Haiku, using GCC 4.x.Patches 1-5 add support for Haiku hosts to build ppc-softmmu. They are based on
qemu_madvise()v7, since Haiku does not havemadvise(), but they do not depend on it themselves so could be cherry-picked.Patch 6 fixes a build warning.
The following patches are based on mmlr's 0.10.4 port and are not intended for upstream inclusion at this time:
Patch 7 is needed for successful runtime execution.
Patch 8 is included as a test case and to show where things are moving wrt C++.
Not yet included is his native Haiku audio backend, also using C++.
Another issue that Michael had addressed and that I would like to see fixed differently is a mismatch between softfloat headers and sources wrt int types. I'll post a separate RFC since it's not strictly related to Haiku.
Regards,
AndreasAndreas Färber (8):
configure: Add basic support for Haiku
configure: Don't rely on special pthreads library Haiku doesn't have libm
nbd: Haiku has_IO()in its BSD compatibility layer
tap: Add stub for Haiku
slirp: Silence warning on Haiku
qemu_malloc: Use areas on Haiku for sizes > 1 MiB
ui: Haiku frontendMakefile | 2 +
Makefile.objs | 2 +
Makefile.target | 2 +
configure | 33 +++-
console.h | 3 +
nbd.c | 2 +-
net/tap-haiku.c | 61 ++++++
qemu-malloc.c | 53 +++++
rules.mak | 6 +-
slirp/slirp.h | 4 +-
ui/haiku.cpp | 607 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ui/haiku.h| 96 +++++++++
vl.c | 10 +-13 files changed, 869 insertions(+), 12 deletions(-)create mode 100644
net/tap-haiku.c
create mode 100644 ui/haiku.cpp
create mode 100644ui/haiku.h