changeset 15566:3758536dcef3

DragonFly BSD support patch by Joerg Sonnenberger <joerg - at - britannica - dot - bec - dot - de>
author diego
date Wed, 25 May 2005 08:48:32 +0000
parents 1c1c7cd29707
children c8ef0513f470
files cpudetect.c libdha/pci.c libmpcodecs/ad_realaud.c libmpcodecs/vd_realvid.c libmpdemux/cddb.c libmpdemux/stream_vcd.c libmpdemux/tvi_bsdbt848.c libmpdvdkit2/bswap.h libmpdvdkit2/dvd_reader.c loader/ldt_keeper.c loader/pe_image.c loader/win32.c osdep/getch2.c
diffstat 13 files changed, 28 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/cpudetect.c	Tue May 24 19:46:44 2005 +0000
+++ b/cpudetect.c	Wed May 25 08:48:32 2005 +0000
@@ -20,7 +20,7 @@
 #include <machine/cpu.h>
 #endif
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 #include <sys/types.h>
 #include <sys/sysctl.h>
 #endif
@@ -169,7 +169,7 @@
 #endif
 
 		/* FIXME: Does SSE2 need more OS support, too? */
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__CYGWIN__) || defined(__OpenBSD__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__CYGWIN__) || defined(__OpenBSD__) || defined(__DragonFly__)
 		if (caps->hasSSE)
 			check_os_katmai_support();
 		if (!caps->hasSSE)
@@ -324,7 +324,7 @@
 #ifdef ARCH_X86_64
    gCpuCaps.hasSSE=1;
    gCpuCaps.hasSSE2=1;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
    int has_sse=0, ret;
    size_t len=sizeof(has_sse);
 
--- a/libdha/pci.c	Tue May 24 19:46:44 2005 +0000
+++ b/libdha/pci.c	Wed May 25 08:48:32 2005 +0000
@@ -62,7 +62,7 @@
 /* OS depended stuff */
 #if defined (linux)
 #include "sysdep/pci_linux.c"
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD__) || defined(__DragonFly__)
 #include "sysdep/pci_freebsd.c"
 #elif defined (__386BSD__)
 #include "sysdep/pci_386bsd.c"
--- a/libmpcodecs/ad_realaud.c	Tue May 24 19:46:44 2005 +0000
+++ b/libmpcodecs/ad_realaud.c	Wed May 25 08:48:32 2005 +0000
@@ -35,7 +35,7 @@
 	free(ize);
 }
 
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 void *__ctype_b=NULL;
 #endif
 
--- a/libmpcodecs/vd_realvid.c	Tue May 24 19:46:44 2005 +0000
+++ b/libmpcodecs/vd_realvid.c	Wed May 25 08:48:32 2005 +0000
@@ -79,7 +79,7 @@
 //	exit(1);
 }
 
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 void ___brk_addr(void) {exit(0);}
 char **__environ={NULL};
 #undef stderr
--- a/libmpdemux/cddb.c	Tue May 24 19:46:44 2005 +0000
+++ b/libmpdemux/cddb.c	Wed May 25 08:48:32 2005 +0000
@@ -30,7 +30,7 @@
 
 #if defined(__linux__)
 	#include <linux/cdrom.h>
-#elif defined(__FreeBSD__) || defined(__bsdi__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#elif defined(__FreeBSD__) || defined(__bsdi__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 	#include <sys/cdio.h>
 #endif
 
@@ -82,7 +82,7 @@
 	return tochdr.cdth_trk1;
 }
 
-#elif defined(__FreeBSD__) || defined(__bsdi__)
+#elif defined(__FreeBSD__) || defined(__bsdi__) || defined(__DragonFly__)
 int 
 read_toc(const char *dev) {
 	int drive;
--- a/libmpdemux/stream_vcd.c	Tue May 24 19:46:44 2005 +0000
+++ b/libmpdemux/stream_vcd.c	Wed May 25 08:48:32 2005 +0000
@@ -14,7 +14,7 @@
 #include <sys/ioctl.h>
 #include <errno.h>
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 #include <sys/cdrio.h>
 #include "vcd_read_fbsd.h" 
 #elif defined(__NetBSD__) || defined (__OpenBSD__)
--- a/libmpdemux/tvi_bsdbt848.c	Tue May 24 19:46:44 2005 +0000
+++ b/libmpdemux/tvi_bsdbt848.c	Wed May 25 08:48:32 2005 +0000
@@ -43,6 +43,9 @@
 #ifdef __NetBSD__
 #include <dev/ic/bt8xx.h>
 #include <sys/audioio.h>
+#elif defined(__DragonFly__)
+#include <dev/video/meteor/ioctl_meteor.h>
+#include <dev/video/bktr/ioctl_bt848.h>
 #elif __FreeBSD_version >= 502100
 #include <dev/bktr/ioctl_meteor.h>
 #include <dev/bktr/ioctl_bt848.h>
--- a/libmpdvdkit2/bswap.h	Tue May 24 19:46:44 2005 +0000
+++ b/libmpdvdkit2/bswap.h	Wed May 25 08:48:32 2005 +0000
@@ -88,12 +88,17 @@
 }
 #define B2N_64(x) x = bswap_64(x)
 
+#elif defined(__DragonFly__)
+#include <sys/endian.h>
+#define B2N_16(x) x = be16toh(x)
+#define B2N_32(x) x = be32toh(x)
+#define B2N_64(x) x = be64toh(x)
+
 /* This is a slow but portable implementation, it has multiple evaluation 
  * problems so beware.
  * FreeBSD and Solaris don't have <byteswap.h> or any other such 
  * functionality! 
  */
-
 #elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(__CYGWIN__)
 #define B2N_16(x) \
  x = ((((x) & 0xff00) >> 8) | \
--- a/libmpdvdkit2/dvd_reader.c	Tue May 24 19:46:44 2005 +0000
+++ b/libmpdvdkit2/dvd_reader.c	Wed May 25 08:48:32 2005 +0000
@@ -35,7 +35,7 @@
 #include <limits.h>
 #include <dirent.h>
  
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__) || defined(__DragonFly__)
 #define SYS_BSD 1
 #endif
 
--- a/loader/ldt_keeper.c	Tue May 24 19:46:44 2005 +0000
+++ b/loader/ldt_keeper.c	Wed May 25 08:48:32 2005 +0000
@@ -50,7 +50,7 @@
 }
 #endif
 #else
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 #include <machine/segments.h>
 #include <machine/sysarch.h>
 #endif
@@ -165,7 +165,7 @@
 #endif
 #endif
 
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content )
 {
     *buffer++ = ((content->base_addr & 0x0000ffff) << 16) |
@@ -227,7 +227,7 @@
     }
 #endif /*linux*/
 
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
     {
         unsigned long d[2];
 
@@ -246,7 +246,7 @@
             printf("Did you reconfigure the kernel with \"options USER_LDT\"?\n");
         }
     }
-#endif  /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ */
+#endif  /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ */
 
 #if defined(__svr4__)
     {
--- a/loader/pe_image.c	Tue May 24 19:46:44 2005 +0000
+++ b/loader/pe_image.c	Wed May 25 08:48:32 2005 +0000
@@ -905,7 +905,7 @@
  */
 static void __attribute__((noinline)) extend_stack_for_dll_alloca(void)
 {
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__DragonFly__)
     volatile int* mem=alloca(0x20000);
     *mem=0x1234;
 #endif
--- a/loader/win32.c	Tue May 24 19:46:44 2005 +0000
+++ b/loader/win32.c	Wed May 25 08:48:32 2005 +0000
@@ -993,7 +993,7 @@
 
 /* disable cpuid based detection (mplayer's cpudetect.c does this - see above) */
 #ifndef MPLAYER
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__) || defined(__DragonFly__)
     do_cpuid(1, regs);
     switch ((regs[0] >> 8) & 0xf) {			// cpu family
     case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
--- a/osdep/getch2.c	Tue May 24 19:46:44 2005 +0000
+++ b/osdep/getch2.c	Wed May 25 08:48:32 2005 +0000
@@ -220,7 +220,7 @@
 struct termios tio_new;
 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__)
     tcgetattr(0,&tio_orig);
-#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) || defined(__DragonFly__)
     ioctl(0,TIOCGETA,&tio_orig);
 #else
     ioctl(0,TCGETS,&tio_orig);
@@ -231,7 +231,7 @@
     tio_new.c_cc[VTIME] = 0;
 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__)
     tcsetattr(0,TCSANOW,&tio_new);
-#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) || defined(__DragonFly__)
     ioctl(0,TIOCSETA,&tio_new);
 #else
     ioctl(0,TCSETS,&tio_new);
@@ -245,7 +245,7 @@
 #ifdef HAVE_TERMIOS
 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__)
     tcsetattr(0,TCSANOW,&tio_orig);
-#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) || defined(__DragonFly__)
     ioctl(0,TIOCSETA,&tio_orig);
 #else
     ioctl(0,TCSETS,&tio_orig);