bsd port (Markus Niemisto)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@800 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
fd872598d8
commit
7d3505c55a
10
Makefile
10
Makefile
|
@ -16,7 +16,7 @@ endif
|
||||||
|
|
||||||
all: dyngen$(EXESUF) $(TOOLS) qemu-doc.html qemu-tech.html qemu.1
|
all: dyngen$(EXESUF) $(TOOLS) qemu-doc.html qemu-tech.html qemu.1
|
||||||
for d in $(TARGET_DIRS); do \
|
for d in $(TARGET_DIRS); do \
|
||||||
make -C $$d $@ || exit 1 ; \
|
$(MAKE) -C $$d $@ || exit 1 ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
qemu-mkcow: qemu-mkcow.c
|
qemu-mkcow: qemu-mkcow.c
|
||||||
|
@ -29,9 +29,9 @@ clean:
|
||||||
# avoid old build problems by removing potentially incorrect old files
|
# 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 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
|
rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS qemu.pod
|
||||||
make -C tests clean
|
$(MAKE) -C tests clean
|
||||||
for d in $(TARGET_DIRS); do \
|
for d in $(TARGET_DIRS); do \
|
||||||
make -C $$d $@ || exit 1 ; \
|
$(MAKE) -C $$d $@ || exit 1 ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
|
@ -55,12 +55,12 @@ ifndef CONFIG_WIN32
|
||||||
install qemu.1 qemu-mkcow.1 "$(mandir)/man1"
|
install qemu.1 qemu-mkcow.1 "$(mandir)/man1"
|
||||||
endif
|
endif
|
||||||
for d in $(TARGET_DIRS); do \
|
for d in $(TARGET_DIRS); do \
|
||||||
make -C $$d $@ || exit 1 ; \
|
$(MAKE) -C $$d $@ || exit 1 ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
# various test targets
|
# various test targets
|
||||||
test speed test2: all
|
test speed test2: all
|
||||||
make -C tests $@
|
$(MAKE) -C tests $@
|
||||||
|
|
||||||
TAGS:
|
TAGS:
|
||||||
etags *.[ch] tests/*.[ch]
|
etags *.[ch] tests/*.[ch]
|
||||||
|
|
|
@ -79,9 +79,23 @@ case $targetos in
|
||||||
MINGW32*)
|
MINGW32*)
|
||||||
mingw32="yes"
|
mingw32="yes"
|
||||||
;;
|
;;
|
||||||
|
FreeBSD)
|
||||||
|
bsd="yes"
|
||||||
|
;;
|
||||||
|
NetBSD)
|
||||||
|
bsd="yes"
|
||||||
|
;;
|
||||||
|
OpenBSD)
|
||||||
|
bsd="yes"
|
||||||
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ "$bsd" = "yes" ] ; then
|
||||||
|
make="gmake"
|
||||||
|
target_list="i386-softmmu"
|
||||||
|
fi
|
||||||
|
|
||||||
# find source path
|
# find source path
|
||||||
# XXX: we assume an absolute path is given when launching configure,
|
# XXX: we assume an absolute path is given when launching configure,
|
||||||
# except in './configure' case.
|
# except in './configure' case.
|
||||||
|
@ -373,7 +387,7 @@ fi
|
||||||
if test "$mingw32" = "yes" ; then
|
if test "$mingw32" = "yes" ; then
|
||||||
echo "CONFIG_WIN32=yes" >> $config_mak
|
echo "CONFIG_WIN32=yes" >> $config_mak
|
||||||
echo "#define CONFIG_WIN32 1" >> $config_h
|
echo "#define CONFIG_WIN32 1" >> $config_h
|
||||||
else
|
elif test -f "/usr/include/byteswap.h" ; then
|
||||||
echo "#define HAVE_BYTESWAP_H 1" >> $config_h
|
echo "#define HAVE_BYTESWAP_H 1" >> $config_h
|
||||||
fi
|
fi
|
||||||
if test "$gdbstub" = "yes" ; then
|
if test "$gdbstub" = "yes" ; then
|
||||||
|
@ -402,6 +416,10 @@ echo "\"" >> $config_h
|
||||||
echo "SRC_PATH=$source_path" >> $config_mak
|
echo "SRC_PATH=$source_path" >> $config_mak
|
||||||
echo "TARGET_DIRS=$target_list" >> $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
|
for target in $target_list; do
|
||||||
|
|
||||||
target_dir="$target"
|
target_dir="$target"
|
||||||
|
|
|
@ -59,7 +59,11 @@ extern int fprintf(FILE *, const char *, ...);
|
||||||
extern int printf(const char *, ...);
|
extern int printf(const char *, ...);
|
||||||
#undef NULL
|
#undef NULL
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
|
#ifdef _BSD
|
||||||
|
#include <ieeefp.h>
|
||||||
|
#else
|
||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
#define AREG0 "ebp"
|
#define AREG0 "ebp"
|
||||||
|
|
|
@ -532,7 +532,7 @@ static void gdb_accept(void *opaque, const uint8_t *buf, int size)
|
||||||
|
|
||||||
/* set short latency */
|
/* set short latency */
|
||||||
val = 1;
|
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));
|
s = qemu_mallocz(sizeof(GDBState));
|
||||||
if (!s) {
|
if (!s) {
|
||||||
|
|
|
@ -259,7 +259,7 @@ enum {
|
||||||
CC_OP_NB,
|
CC_OP_NB,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(__i386__) || defined(__x86_64__)
|
#if (defined(__i386__) || defined(__x86_64__)) && !defined(_BSD)
|
||||||
#define USE_X86LDOUBLE
|
#define USE_X86LDOUBLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
#include "config.h"
|
||||||
#include "dyngen-exec.h"
|
#include "dyngen-exec.h"
|
||||||
|
|
||||||
/* at least 4 register variables are defines */
|
/* at least 4 register variables are defines */
|
||||||
|
@ -307,8 +308,13 @@ static inline void stfl(void *ptr, float v)
|
||||||
#define rint rintl
|
#define rint rintl
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_BSD)
|
||||||
extern int lrint(CPU86_LDouble x);
|
extern int lrint(CPU86_LDouble x);
|
||||||
extern int64_t llrint(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 fabs(CPU86_LDouble x);
|
||||||
extern CPU86_LDouble sin(CPU86_LDouble x);
|
extern CPU86_LDouble sin(CPU86_LDouble x);
|
||||||
extern CPU86_LDouble cos(CPU86_LDouble x);
|
extern CPU86_LDouble cos(CPU86_LDouble x);
|
||||||
|
|
|
@ -1938,6 +1938,24 @@ void OPPROTO op_fldcw_A0(void)
|
||||||
int rnd_type;
|
int rnd_type;
|
||||||
env->fpuc = lduw((void *)A0);
|
env->fpuc = lduw((void *)A0);
|
||||||
/* set rounding mode */
|
/* 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) {
|
switch(env->fpuc & RC_MASK) {
|
||||||
default:
|
default:
|
||||||
case RC_NEAR:
|
case RC_NEAR:
|
||||||
|
@ -1954,6 +1972,7 @@ void OPPROTO op_fldcw_A0(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fesetround(rnd_type);
|
fesetround(rnd_type);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPPROTO op_fclex(void)
|
void OPPROTO op_fclex(void)
|
||||||
|
|
52
vl.c
52
vl.c
|
@ -28,29 +28,35 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <malloc.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <pty.h>
|
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#ifdef _BSD
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <libutil.h>
|
||||||
|
#else
|
||||||
#include <linux/if.h>
|
#include <linux/if.h>
|
||||||
#include <linux/if_tun.h>
|
#include <linux/if_tun.h>
|
||||||
|
#include <pty.h>
|
||||||
|
#include <malloc.h>
|
||||||
#include <linux/rtc.h>
|
#include <linux/rtc.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SLIRP)
|
#if defined(CONFIG_SLIRP)
|
||||||
#include "libslirp.h"
|
#include "libslirp.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#include <malloc.h>
|
||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define getopt_long_only getopt_long
|
#define getopt_long_only getopt_long
|
||||||
|
@ -58,15 +64,17 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SDL
|
#ifdef CONFIG_SDL
|
||||||
|
#if defined(__linux__)
|
||||||
/* SDL use the pthreads and they modify sigaction. We don't
|
/* SDL use the pthreads and they modify sigaction. We don't
|
||||||
want that. */
|
want that. */
|
||||||
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
|
#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2))
|
||||||
extern void __libc_sigaction();
|
extern void __libc_sigaction();
|
||||||
#define sigaction(sig, act, oact) __libc_sigaction(sig, act, oact)
|
#define sigaction(sig, act, oact) __libc_sigaction(sig, act, oact)
|
||||||
#else
|
#else
|
||||||
extern void __sigaction();
|
extern void __sigaction();
|
||||||
#define sigaction(sig, act, oact) __sigaction(sig, act, oact)
|
#define sigaction(sig, act, oact) __sigaction(sig, act, oact)
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* __linux__ */
|
||||||
#endif /* CONFIG_SDL */
|
#endif /* CONFIG_SDL */
|
||||||
|
|
||||||
#include "disas.h"
|
#include "disas.h"
|
||||||
|
@ -637,11 +645,17 @@ int64_t qemu_get_clock(QEMUClock *clock)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return GetTickCount();
|
return GetTickCount();
|
||||||
#else
|
#else
|
||||||
/* XXX: portability among Linux hosts */
|
{
|
||||||
|
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) {
|
if (timer_freq == 100) {
|
||||||
return times(NULL) * 10;
|
return times(&tp) * 10;
|
||||||
} else {
|
} else {
|
||||||
return ((int64_t)times(NULL) * 1000) / timer_freq;
|
return ((int64_t)times(&tp) * 1000) / timer_freq;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
@ -964,7 +978,27 @@ static int net_slirp_init(NetDriverState *nd)
|
||||||
#endif /* CONFIG_SLIRP */
|
#endif /* CONFIG_SLIRP */
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#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)
|
static int tun_open(char *ifname, int ifname_size)
|
||||||
{
|
{
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
|
@ -989,6 +1023,7 @@ static int tun_open(char *ifname, int ifname_size)
|
||||||
fcntl(fd, F_SETFL, O_NONBLOCK);
|
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void tun_send_packet(NetDriverState *nd, const uint8_t *buf, int size)
|
static void tun_send_packet(NetDriverState *nd, const uint8_t *buf, int size)
|
||||||
{
|
{
|
||||||
|
@ -2248,7 +2283,12 @@ int main(int argc, char **argv)
|
||||||
phys_ram_size = ram_size + vga_ram_size;
|
phys_ram_size = ram_size + vga_ram_size;
|
||||||
|
|
||||||
#ifdef CONFIG_SOFTMMU
|
#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);
|
phys_ram_base = memalign(TARGET_PAGE_SIZE, phys_ram_size);
|
||||||
|
#endif
|
||||||
if (!phys_ram_base) {
|
if (!phys_ram_base) {
|
||||||
fprintf(stderr, "Could not allocate physical memory\n");
|
fprintf(stderr, "Could not allocate physical memory\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
8
vl.h
8
vl.h
|
@ -35,6 +35,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifndef O_LARGEFILE
|
#ifndef O_LARGEFILE
|
||||||
#define O_LARGEFILE 0
|
#define O_LARGEFILE 0
|
||||||
|
@ -49,6 +50,13 @@
|
||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
|
||||||
|
#ifdef _BSD
|
||||||
|
#define lseek64 lseek
|
||||||
|
#define ftruncate64 ftruncate
|
||||||
|
#define mkstemp64 mkstemp
|
||||||
|
#define MAP_ANONYMOUS MAP_ANON
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef glue
|
#ifndef glue
|
||||||
#define xglue(x, y) x ## y
|
#define xglue(x, y) x ## y
|
||||||
#define glue(x, y) xglue(x, y)
|
#define glue(x, y) xglue(x, y)
|
||||||
|
|
Loading…
Reference in New Issue