all: dyngen$(EXESUF) $(TOOLS) qemu-doc.html qemu-tech.html qemu.1
for d in $(TARGET_DIRS); do \
- make -C $$d $@ || exit 1 ; \
+ $(MAKE) -C $$d $@ || exit 1 ; \
done
qemu-mkcow: qemu-mkcow.c
# avoid old build problems by removing potentially incorrect old files
rm -f config.mak config.h op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS qemu.pod
- make -C tests clean
+ $(MAKE) -C tests clean
for d in $(TARGET_DIRS); do \
- make -C $$d $@ || exit 1 ; \
+ $(MAKE) -C $$d $@ || exit 1 ; \
done
distclean: clean
install qemu.1 qemu-mkcow.1 "$(mandir)/man1"
endif
for d in $(TARGET_DIRS); do \
- make -C $$d $@ || exit 1 ; \
+ $(MAKE) -C $$d $@ || exit 1 ; \
done
# various test targets
test speed test2: all
- make -C tests $@
+ $(MAKE) -C tests $@
TAGS:
etags *.[ch] tests/*.[ch]
MINGW32*)
mingw32="yes"
;;
+FreeBSD)
+bsd="yes"
+;;
+NetBSD)
+bsd="yes"
+;;
+OpenBSD)
+bsd="yes"
+;;
*) ;;
esac
+if [ "$bsd" = "yes" ] ; then
+ make="gmake"
+ target_list="i386-softmmu"
+fi
+
# find source path
# XXX: we assume an absolute path is given when launching configure,
# except in './configure' case.
if test "$mingw32" = "yes" ; then
echo "CONFIG_WIN32=yes" >> $config_mak
echo "#define CONFIG_WIN32 1" >> $config_h
-else
+elif test -f "/usr/include/byteswap.h" ; then
echo "#define HAVE_BYTESWAP_H 1" >> $config_h
fi
if test "$gdbstub" = "yes" ; then
echo "SRC_PATH=$source_path" >> $config_mak
echo "TARGET_DIRS=$target_list" >> $config_mak
+if [ "$bsd" = "yes" ] ; then
+ echo "#define _BSD 1" >> $config_h
+fi
+
for target in $target_list; do
target_dir="$target"
extern int printf(const char *, ...);
#undef NULL
#define NULL 0
+#ifdef _BSD
+#include <ieeefp.h>
+#else
#include <fenv.h>
+#endif
#ifdef __i386__
#define AREG0 "ebp"
/* set short latency */
val = 1;
- setsockopt(fd, SOL_TCP, TCP_NODELAY, &val, sizeof(val));
+ setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
s = qemu_mallocz(sizeof(GDBState));
if (!s) {
CC_OP_NB,
};
-#if defined(__i386__) || defined(__x86_64__)
+#if (defined(__i386__) || defined(__x86_64__)) && !defined(_BSD)
#define USE_X86LDOUBLE
#endif
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "config.h"
#include "dyngen-exec.h"
/* at least 4 register variables are defines */
#define rint rintl
#endif
+#if !defined(_BSD)
extern int lrint(CPU86_LDouble x);
extern int64_t llrint(CPU86_LDouble x);
+#else
+#define lrint(d) ((int)rint(d))
+#define llrint(d) ((int)rint(d))
+#endif
extern CPU86_LDouble fabs(CPU86_LDouble x);
extern CPU86_LDouble sin(CPU86_LDouble x);
extern CPU86_LDouble cos(CPU86_LDouble x);
int rnd_type;
env->fpuc = lduw((void *)A0);
/* set rounding mode */
+#ifdef _BSD
+ switch(env->fpuc & RC_MASK) {
+ default:
+ case RC_NEAR:
+ rnd_type = FP_RN;
+ break;
+ case RC_DOWN:
+ rnd_type = FP_RM;
+ break;
+ case RC_UP:
+ rnd_type = FP_RP;
+ break;
+ case RC_CHOP:
+ rnd_type = FP_RZ;
+ break;
+ }
+ fpsetround(rnd_type);
+#else
switch(env->fpuc & RC_MASK) {
default:
case RC_NEAR:
break;
}
fesetround(rnd_type);
+#endif
}
void OPPROTO op_fclex(void)
#include <fcntl.h>
#include <signal.h>
#include <time.h>
-#include <malloc.h>
#include <errno.h>
#include <sys/time.h>
#ifndef _WIN32
#include <sys/times.h>
#include <sys/wait.h>
-#include <pty.h>
#include <termios.h>
#include <sys/poll.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
+#ifdef _BSD
+#include <sys/stat.h>
+#include <libutil.h>
+#else
#include <linux/if.h>
#include <linux/if_tun.h>
+#include <pty.h>
+#include <malloc.h>
#include <linux/rtc.h>
#endif
+#endif
#if defined(CONFIG_SLIRP)
#include "libslirp.h"
#endif
#ifdef _WIN32
+#include <malloc.h>
#include <sys/timeb.h>
#include <windows.h>
#define getopt_long_only getopt_long
#endif
#ifdef CONFIG_SDL
+#if defined(__linux__)
/* SDL use the pthreads and they modify sigaction. We don't
want that. */
-#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2))
extern void __libc_sigaction();
#define sigaction(sig, act, oact) __libc_sigaction(sig, act, oact)
#else
extern void __sigaction();
#define sigaction(sig, act, oact) __sigaction(sig, act, oact)
#endif
+#endif /* __linux__ */
#endif /* CONFIG_SDL */
#include "disas.h"
#ifdef _WIN32
return GetTickCount();
#else
- /* XXX: portability among Linux hosts */
- if (timer_freq == 100) {
- return times(NULL) * 10;
- } else {
- return ((int64_t)times(NULL) * 1000) / timer_freq;
+ {
+ struct tms tp;
+
+ /* Note that using gettimeofday() is not a good solution
+ for timers because its value change when the date is
+ modified. */
+ if (timer_freq == 100) {
+ return times(&tp) * 10;
+ } else {
+ return ((int64_t)times(&tp) * 1000) / timer_freq;
+ }
}
#endif
default:
#endif /* CONFIG_SLIRP */
#if !defined(_WIN32)
+#ifdef _BSD
+static int tun_open(char *ifname, int ifname_size)
+{
+ int fd;
+ char *dev;
+ struct stat s;
+ fd = open("/dev/tap", O_RDWR);
+ if (fd < 0) {
+ fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation\n");
+ return -1;
+ }
+
+ fstat(fd, &s);
+ dev = devname(s.st_rdev, S_IFCHR);
+ pstrcpy(ifname, ifname_size, dev);
+
+ fcntl(fd, F_SETFL, O_NONBLOCK);
+ return fd;
+}
+#else
static int tun_open(char *ifname, int ifname_size)
{
struct ifreq ifr;
fcntl(fd, F_SETFL, O_NONBLOCK);
return fd;
}
+#endif
static void tun_send_packet(NetDriverState *nd, const uint8_t *buf, int size)
{
phys_ram_size = ram_size + vga_ram_size;
#ifdef CONFIG_SOFTMMU
+#ifdef _BSD
+ /* mallocs are always aligned on BSD. */
+ phys_ram_base = malloc(phys_ram_size);
+#else
phys_ram_base = memalign(TARGET_PAGE_SIZE, phys_ram_size);
+#endif
if (!phys_ram_base) {
fprintf(stderr, "Could not allocate physical memory\n");
exit(1);
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
+#include <sys/stat.h>
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#include "cpu.h"
+#ifdef _BSD
+#define lseek64 lseek
+#define ftruncate64 ftruncate
+#define mkstemp64 mkstemp
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
#ifndef glue
#define xglue(x, y) x ## y
#define glue(x, y) xglue(x, y)