Commit c5e97233e8c8e53aab1b80b5e9891a71c4edea3e
1 parent
9399f095
Support for DragonFly BSD (Hasso Tepper)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6746 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
11 changed files
with
52 additions
and
17 deletions
audio/sdlaudio.c
@@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
29 | #ifndef _WIN32 | 29 | #ifndef _WIN32 |
30 | #ifdef __sun__ | 30 | #ifdef __sun__ |
31 | #define _POSIX_PTHREAD_SEMANTICS 1 | 31 | #define _POSIX_PTHREAD_SEMANTICS 1 |
32 | -#elif defined(__OpenBSD__) || defined(__FreeBSD__) | 32 | +#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) |
33 | #include <pthread.h> | 33 | #include <pthread.h> |
34 | #endif | 34 | #endif |
35 | #include <signal.h> | 35 | #include <signal.h> |
block-raw-posix.c
@@ -63,6 +63,11 @@ | @@ -63,6 +63,11 @@ | ||
63 | #include <sys/dkio.h> | 63 | #include <sys/dkio.h> |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | +#ifdef __DragonFly__ | ||
67 | +#include <sys/ioctl.h> | ||
68 | +#include <sys/diskslice.h> | ||
69 | +#endif | ||
70 | + | ||
66 | //#define DEBUG_FLOPPY | 71 | //#define DEBUG_FLOPPY |
67 | 72 | ||
68 | //#define DEBUG_BLOCK | 73 | //#define DEBUG_BLOCK |
@@ -762,6 +767,15 @@ static int64_t raw_getlength(BlockDriverState *bs) | @@ -762,6 +767,15 @@ static int64_t raw_getlength(BlockDriverState *bs) | ||
762 | if (!fstat(fd, &sb) && (S_IFCHR & sb.st_mode)) { | 767 | if (!fstat(fd, &sb) && (S_IFCHR & sb.st_mode)) { |
763 | #ifdef DIOCGMEDIASIZE | 768 | #ifdef DIOCGMEDIASIZE |
764 | if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size)) | 769 | if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size)) |
770 | +#elif defined(DIOCGPART) | ||
771 | + { | ||
772 | + struct partinfo pi; | ||
773 | + if (ioctl(fd, DIOCGPART, &pi) == 0) | ||
774 | + size = pi.media_size; | ||
775 | + else | ||
776 | + size = 0; | ||
777 | + } | ||
778 | + if (size == 0) | ||
765 | #endif | 779 | #endif |
766 | #ifdef CONFIG_COCOA | 780 | #ifdef CONFIG_COCOA |
767 | size = LONG_LONG_MAX; | 781 | size = LONG_LONG_MAX; |
block.c
@@ -35,8 +35,10 @@ | @@ -35,8 +35,10 @@ | ||
35 | #include <sys/types.h> | 35 | #include <sys/types.h> |
36 | #include <sys/stat.h> | 36 | #include <sys/stat.h> |
37 | #include <sys/ioctl.h> | 37 | #include <sys/ioctl.h> |
38 | +#ifndef __DragonFly__ | ||
38 | #include <sys/disk.h> | 39 | #include <sys/disk.h> |
39 | #endif | 40 | #endif |
41 | +#endif | ||
40 | 42 | ||
41 | #define SECTOR_BITS 9 | 43 | #define SECTOR_BITS 9 |
42 | #define SECTOR_SIZE (1 << SECTOR_BITS) | 44 | #define SECTOR_SIZE (1 << SECTOR_BITS) |
configure
@@ -229,6 +229,15 @@ if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then | @@ -229,6 +229,15 @@ if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then | ||
229 | kqemu="yes" | 229 | kqemu="yes" |
230 | fi | 230 | fi |
231 | ;; | 231 | ;; |
232 | +DragonFly) | ||
233 | +bsd="yes" | ||
234 | +audio_drv_list="oss" | ||
235 | +audio_possible_drivers="oss sdl esd pa" | ||
236 | +if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then | ||
237 | + kqemu="yes" | ||
238 | +fi | ||
239 | +aio="no" | ||
240 | +;; | ||
232 | NetBSD) | 241 | NetBSD) |
233 | bsd="yes" | 242 | bsd="yes" |
234 | audio_drv_list="oss" | 243 | audio_drv_list="oss" |
exec.c
@@ -454,7 +454,7 @@ static void code_gen_alloc(unsigned long tb_size) | @@ -454,7 +454,7 @@ static void code_gen_alloc(unsigned long tb_size) | ||
454 | exit(1); | 454 | exit(1); |
455 | } | 455 | } |
456 | } | 456 | } |
457 | -#elif defined(__FreeBSD__) | 457 | +#elif defined(__FreeBSD__) || defined(__DragonFly__) |
458 | { | 458 | { |
459 | int flags; | 459 | int flags; |
460 | void *addr = NULL; | 460 | void *addr = NULL; |
net.c
@@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
54 | #include <sys/select.h> | 54 | #include <sys/select.h> |
55 | #ifdef _BSD | 55 | #ifdef _BSD |
56 | #include <sys/stat.h> | 56 | #include <sys/stat.h> |
57 | -#ifdef __FreeBSD__ | 57 | +#if defined(__FreeBSD__) || defined(__DragonFly__) |
58 | #include <libutil.h> | 58 | #include <libutil.h> |
59 | #else | 59 | #else |
60 | #include <util.h> | 60 | #include <util.h> |
osdep.c
@@ -92,7 +92,7 @@ static void *kqemu_vmalloc(size_t size) | @@ -92,7 +92,7 @@ static void *kqemu_vmalloc(size_t size) | ||
92 | void *ptr; | 92 | void *ptr; |
93 | 93 | ||
94 | /* no need (?) for a dummy file on OpenBSD/FreeBSD */ | 94 | /* no need (?) for a dummy file on OpenBSD/FreeBSD */ |
95 | -#if defined(__OpenBSD__) || defined(__FreeBSD__) | 95 | +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) |
96 | int map_anon = MAP_ANON; | 96 | int map_anon = MAP_ANON; |
97 | #else | 97 | #else |
98 | int map_anon = 0; | 98 | int map_anon = 0; |
@@ -159,7 +159,7 @@ static void *kqemu_vmalloc(size_t size) | @@ -159,7 +159,7 @@ static void *kqemu_vmalloc(size_t size) | ||
159 | } | 159 | } |
160 | size = (size + 4095) & ~4095; | 160 | size = (size + 4095) & ~4095; |
161 | ftruncate(phys_ram_fd, phys_ram_size + size); | 161 | ftruncate(phys_ram_fd, phys_ram_size + size); |
162 | -#endif /* !(__OpenBSD__ || __FreeBSD__) */ | 162 | +#endif /* !(__OpenBSD__ || __FreeBSD__ || __DragonFly__) */ |
163 | ptr = mmap(NULL, | 163 | ptr = mmap(NULL, |
164 | size, | 164 | size, |
165 | PROT_WRITE | PROT_READ, map_anon | MAP_SHARED, | 165 | PROT_WRITE | PROT_READ, map_anon | MAP_SHARED, |
qemu-char.c
@@ -67,6 +67,10 @@ | @@ -67,6 +67,10 @@ | ||
67 | #include <libutil.h> | 67 | #include <libutil.h> |
68 | #include <dev/ppbus/ppi.h> | 68 | #include <dev/ppbus/ppi.h> |
69 | #include <dev/ppbus/ppbconf.h> | 69 | #include <dev/ppbus/ppbconf.h> |
70 | +#elif defined(__DragonFly__) | ||
71 | +#include <libutil.h> | ||
72 | +#include <dev/misc/ppi/ppi.h> | ||
73 | +#include <bus/ppbus/ppbconf.h> | ||
70 | #else | 74 | #else |
71 | #include <util.h> | 75 | #include <util.h> |
72 | #endif | 76 | #endif |
@@ -806,7 +810,7 @@ void cfmakeraw (struct termios *termios_p) | @@ -806,7 +810,7 @@ void cfmakeraw (struct termios *termios_p) | ||
806 | #endif | 810 | #endif |
807 | 811 | ||
808 | #if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ | 812 | #if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ |
809 | - || defined(__NetBSD__) || defined(__OpenBSD__) | 813 | + || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) |
810 | 814 | ||
811 | typedef struct { | 815 | typedef struct { |
812 | int fd; | 816 | int fd; |
@@ -934,7 +938,7 @@ static CharDriverState *qemu_chr_open_pty(void) | @@ -934,7 +938,7 @@ static CharDriverState *qemu_chr_open_pty(void) | ||
934 | PtyCharDriver *s; | 938 | PtyCharDriver *s; |
935 | struct termios tty; | 939 | struct termios tty; |
936 | int slave_fd, len; | 940 | int slave_fd, len; |
937 | -#if defined(__OpenBSD__) | 941 | +#if defined(__OpenBSD__) || defined(__DragonFly__) |
938 | char pty_name[PATH_MAX]; | 942 | char pty_name[PATH_MAX]; |
939 | #define q_ptsname(x) pty_name | 943 | #define q_ptsname(x) pty_name |
940 | #else | 944 | #else |
@@ -1280,7 +1284,7 @@ static CharDriverState *qemu_chr_open_pp(const char *filename) | @@ -1280,7 +1284,7 @@ static CharDriverState *qemu_chr_open_pp(const char *filename) | ||
1280 | } | 1284 | } |
1281 | #endif /* __linux__ */ | 1285 | #endif /* __linux__ */ |
1282 | 1286 | ||
1283 | -#if defined(__FreeBSD__) | 1287 | +#if defined(__FreeBSD__) || defined(__DragonFly__) |
1284 | static int pp_ioctl(CharDriverState *chr, int cmd, void *arg) | 1288 | static int pp_ioctl(CharDriverState *chr, int cmd, void *arg) |
1285 | { | 1289 | { |
1286 | int fd = (int)chr->opaque; | 1290 | int fd = (int)chr->opaque; |
@@ -2153,13 +2157,13 @@ CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*i | @@ -2153,13 +2157,13 @@ CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*i | ||
2153 | if (strstart(filename, "/dev/parport", NULL)) { | 2157 | if (strstart(filename, "/dev/parport", NULL)) { |
2154 | chr = qemu_chr_open_pp(filename); | 2158 | chr = qemu_chr_open_pp(filename); |
2155 | } else | 2159 | } else |
2156 | -#elif defined(__FreeBSD__) | 2160 | +#elif defined(__FreeBSD__) || defined(__DragonFly__) |
2157 | if (strstart(filename, "/dev/ppi", NULL)) { | 2161 | if (strstart(filename, "/dev/ppi", NULL)) { |
2158 | chr = qemu_chr_open_pp(filename); | 2162 | chr = qemu_chr_open_pp(filename); |
2159 | } else | 2163 | } else |
2160 | #endif | 2164 | #endif |
2161 | #if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ | 2165 | #if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ |
2162 | - || defined(__NetBSD__) || defined(__OpenBSD__) | 2166 | + || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) |
2163 | if (strstart(filename, "/dev/", NULL)) { | 2167 | if (strstart(filename, "/dev/", NULL)) { |
2164 | chr = qemu_chr_open_tty(filename); | 2168 | chr = qemu_chr_open_tty(filename); |
2165 | } else | 2169 | } else |
savevm.c
@@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
54 | #include <sys/select.h> | 54 | #include <sys/select.h> |
55 | #ifdef _BSD | 55 | #ifdef _BSD |
56 | #include <sys/stat.h> | 56 | #include <sys/stat.h> |
57 | -#ifdef __FreeBSD__ | 57 | +#if defined(__FreeBSD__) || defined(__DragonFly__) |
58 | #include <libutil.h> | 58 | #include <libutil.h> |
59 | #else | 59 | #else |
60 | #include <util.h> | 60 | #include <util.h> |
usb-bsd.c
@@ -34,7 +34,11 @@ | @@ -34,7 +34,11 @@ | ||
34 | #undef USB_SPEED_LOW | 34 | #undef USB_SPEED_LOW |
35 | 35 | ||
36 | #include <sys/ioctl.h> | 36 | #include <sys/ioctl.h> |
37 | +#ifndef __DragonFly__ | ||
37 | #include <dev/usb/usb.h> | 38 | #include <dev/usb/usb.h> |
39 | +#else | ||
40 | +#include <bus/usb/usb.h> | ||
41 | +#endif | ||
38 | #include <signal.h> | 42 | #include <signal.h> |
39 | 43 | ||
40 | /* This value has maximum potential at 16. | 44 | /* This value has maximum potential at 16. |
@@ -68,7 +72,7 @@ static int ensure_ep_open(USBHostDevice *dev, int ep, int mode) | @@ -68,7 +72,7 @@ static int ensure_ep_open(USBHostDevice *dev, int ep, int mode) | ||
68 | ep = UE_GET_ADDR(ep); | 72 | ep = UE_GET_ADDR(ep); |
69 | 73 | ||
70 | if (dev->ep_fd[ep] < 0) { | 74 | if (dev->ep_fd[ep] < 0) { |
71 | -#ifdef __FreeBSD__ | 75 | +#if defined(__FreeBSD__) || defined(__DragonFly__) |
72 | snprintf(buf, sizeof(buf) - 1, "%s.%d", dev->devpath, ep); | 76 | snprintf(buf, sizeof(buf) - 1, "%s.%d", dev->devpath, ep); |
73 | #else | 77 | #else |
74 | snprintf(buf, sizeof(buf) - 1, "%s.%02d", dev->devpath, ep); | 78 | snprintf(buf, sizeof(buf) - 1, "%s.%02d", dev->devpath, ep); |
@@ -321,7 +325,7 @@ USBDevice *usb_host_device_open(const char *devname) | @@ -321,7 +325,7 @@ USBDevice *usb_host_device_open(const char *devname) | ||
321 | return NULL; | 325 | return NULL; |
322 | } | 326 | } |
323 | 327 | ||
324 | -#ifdef __FreeBSD__ | 328 | +#if defined(__FreeBSD__) || defined(__DragonFly__) |
325 | snprintf(ctlpath, PATH_MAX, "/dev/%s", bus_info.udi_devnames[0]); | 329 | snprintf(ctlpath, PATH_MAX, "/dev/%s", bus_info.udi_devnames[0]); |
326 | #else | 330 | #else |
327 | snprintf(ctlpath, PATH_MAX, "/dev/%s.00", bus_info.udi_devnames[0]); | 331 | snprintf(ctlpath, PATH_MAX, "/dev/%s.00", bus_info.udi_devnames[0]); |
@@ -411,7 +415,7 @@ static int usb_host_scan(void *opaque, USBScanFunc *func) | @@ -411,7 +415,7 @@ static int usb_host_scan(void *opaque, USBScanFunc *func) | ||
411 | if (strncmp(bus_info.udi_devnames[0], "ugen", 4) != 0) | 415 | if (strncmp(bus_info.udi_devnames[0], "ugen", 4) != 0) |
412 | continue; | 416 | continue; |
413 | 417 | ||
414 | -#ifdef __FreeBSD__ | 418 | +#if defined(__FreeBSD__) || defined(__DragonFly__) |
415 | snprintf(devbuf, sizeof(devbuf) - 1, "/dev/%s", bus_info.udi_devnames[0]); | 419 | snprintf(devbuf, sizeof(devbuf) - 1, "/dev/%s", bus_info.udi_devnames[0]); |
416 | #else | 420 | #else |
417 | snprintf(devbuf, sizeof(devbuf) - 1, "/dev/%s.00", bus_info.udi_devnames[0]); | 421 | snprintf(devbuf, sizeof(devbuf) - 1, "/dev/%s.00", bus_info.udi_devnames[0]); |
vl.c
@@ -55,7 +55,7 @@ | @@ -55,7 +55,7 @@ | ||
55 | #include <sys/select.h> | 55 | #include <sys/select.h> |
56 | #ifdef _BSD | 56 | #ifdef _BSD |
57 | #include <sys/stat.h> | 57 | #include <sys/stat.h> |
58 | -#ifdef __FreeBSD__ | 58 | +#if defined(__FreeBSD__) || defined(__DragonFly__) |
59 | #include <libutil.h> | 59 | #include <libutil.h> |
60 | #else | 60 | #else |
61 | #include <util.h> | 61 | #include <util.h> |
@@ -759,7 +759,8 @@ static int use_rt_clock; | @@ -759,7 +759,8 @@ static int use_rt_clock; | ||
759 | static void init_get_clock(void) | 759 | static void init_get_clock(void) |
760 | { | 760 | { |
761 | use_rt_clock = 0; | 761 | use_rt_clock = 0; |
762 | -#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) | 762 | +#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \ |
763 | + || defined(__DragonFly__) | ||
763 | { | 764 | { |
764 | struct timespec ts; | 765 | struct timespec ts; |
765 | if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { | 766 | if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { |
@@ -771,7 +772,8 @@ static void init_get_clock(void) | @@ -771,7 +772,8 @@ static void init_get_clock(void) | ||
771 | 772 | ||
772 | static int64_t get_clock(void) | 773 | static int64_t get_clock(void) |
773 | { | 774 | { |
774 | -#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) | 775 | +#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \ |
776 | + || defined(__DragonFly__) | ||
775 | if (use_rt_clock) { | 777 | if (use_rt_clock) { |
776 | struct timespec ts; | 778 | struct timespec ts; |
777 | clock_gettime(CLOCK_MONOTONIC, &ts); | 779 | clock_gettime(CLOCK_MONOTONIC, &ts); |