From 8308e63eb1f9203e53f13698e7a2bfb362ccceaf Mon Sep 17 00:00:00 2001 From: diego Date: Wed, 25 May 2005 08:48:32 +0000 Subject: [PATCH] DragonFly BSD support patch by Joerg Sonnenberger git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15567 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cpudetect.c | 6 +++--- libdha/pci.c | 2 +- libmpcodecs/ad_realaud.c | 2 +- libmpcodecs/vd_realvid.c | 2 +- libmpdemux/cddb.c | 4 ++-- libmpdemux/stream_vcd.c | 2 +- libmpdemux/tvi_bsdbt848.c | 3 +++ libmpdvdkit2/bswap.h | 7 ++++++- libmpdvdkit2/dvd_reader.c | 2 +- loader/ldt_keeper.c | 8 ++++---- loader/pe_image.c | 2 +- loader/win32.c | 2 +- osdep/getch2.c | 6 +++--- 13 files changed, 28 insertions(+), 20 deletions(-) diff --git a/cpudetect.c b/cpudetect.c index dda1b0f8ad..af85c7fdab 100644 --- a/cpudetect.c +++ b/cpudetect.c @@ -20,7 +20,7 @@ CpuCaps gCpuCaps; #include #endif -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__DragonFly__) #include #include #endif @@ -169,7 +169,7 @@ void GetCpuCaps( CpuCaps *caps) #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 @@ static void check_os_katmai_support( void ) #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); diff --git a/libdha/pci.c b/libdha/pci.c index 9524d8a2c0..6e2c3fc7b2 100644 --- a/libdha/pci.c +++ b/libdha/pci.c @@ -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" diff --git a/libmpcodecs/ad_realaud.c b/libmpcodecs/ad_realaud.c index c86c667a54..0c7c3af61c 100644 --- a/libmpcodecs/ad_realaud.c +++ b/libmpcodecs/ad_realaud.c @@ -35,7 +35,7 @@ void __builtin_delete(void* ize) { free(ize); } -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) void *__ctype_b=NULL; #endif diff --git a/libmpcodecs/vd_realvid.c b/libmpcodecs/vd_realvid.c index acdc38ee3f..36a87f33c6 100644 --- a/libmpcodecs/vd_realvid.c +++ b/libmpcodecs/vd_realvid.c @@ -79,7 +79,7 @@ void __pure_virtual(void) { // 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 diff --git a/libmpdemux/cddb.c b/libmpdemux/cddb.c index 0192277081..6bca6a87ca 100644 --- a/libmpdemux/cddb.c +++ b/libmpdemux/cddb.c @@ -30,7 +30,7 @@ #if defined(__linux__) #include -#elif defined(__FreeBSD__) || defined(__bsdi__) || defined(__NetBSD__) || defined(__OpenBSD__) +#elif defined(__FreeBSD__) || defined(__bsdi__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) #include #endif @@ -82,7 +82,7 @@ read_toc(const char *dev) { return tochdr.cdth_trk1; } -#elif defined(__FreeBSD__) || defined(__bsdi__) +#elif defined(__FreeBSD__) || defined(__bsdi__) || defined(__DragonFly__) int read_toc(const char *dev) { int drive; diff --git a/libmpdemux/stream_vcd.c b/libmpdemux/stream_vcd.c index 3c408cba48..b7ea156f49 100644 --- a/libmpdemux/stream_vcd.c +++ b/libmpdemux/stream_vcd.c @@ -14,7 +14,7 @@ #include #include -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__DragonFly__) #include #include "vcd_read_fbsd.h" #elif defined(__NetBSD__) || defined (__OpenBSD__) diff --git a/libmpdemux/tvi_bsdbt848.c b/libmpdemux/tvi_bsdbt848.c index ba2950844b..bebe4b635a 100644 --- a/libmpdemux/tvi_bsdbt848.c +++ b/libmpdemux/tvi_bsdbt848.c @@ -43,6 +43,9 @@ #ifdef __NetBSD__ #include #include +#elif defined(__DragonFly__) +#include +#include #elif __FreeBSD_version >= 502100 #include #include diff --git a/libmpdvdkit2/bswap.h b/libmpdvdkit2/bswap.h index 53abd3c2e5..240f06e16f 100644 --- a/libmpdvdkit2/bswap.h +++ b/libmpdvdkit2/bswap.h @@ -88,12 +88,17 @@ inline static unsigned long long int bswap_64(unsigned long long int x) } #define B2N_64(x) x = bswap_64(x) +#elif defined(__DragonFly__) +#include +#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 or any other such * functionality! */ - #elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(__CYGWIN__) #define B2N_16(x) \ x = ((((x) & 0xff00) >> 8) | \ diff --git a/libmpdvdkit2/dvd_reader.c b/libmpdvdkit2/dvd_reader.c index 4d3b9b0cf5..f4da80a7de 100644 --- a/libmpdvdkit2/dvd_reader.c +++ b/libmpdvdkit2/dvd_reader.c @@ -35,7 +35,7 @@ #include #include -#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 diff --git a/loader/ldt_keeper.c b/loader/ldt_keeper.c index 0e2ab31b19..3b5bf937e1 100644 --- a/loader/ldt_keeper.c +++ b/loader/ldt_keeper.c @@ -50,7 +50,7 @@ int modify_ldt(int func, void *ptr, unsigned long bytecount); } #endif #else -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) #include #include #endif @@ -165,7 +165,7 @@ static int LDT_Modify( int func, struct modify_ldt_ldt_s *ptr, #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 @@ ldt_fs_t* Setup_LDT_Keeper(void) } #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 @@ ldt_fs_t* Setup_LDT_Keeper(void) printf("Did you reconfigure the kernel with \"options USER_LDT\"?\n"); } } -#endif /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ */ +#endif /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ */ #if defined(__svr4__) { diff --git a/loader/pe_image.c b/loader/pe_image.c index 97dae9068f..ab2fb9be61 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -905,7 +905,7 @@ void PE_UnloadLibrary(WINE_MODREF *wm) */ 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 diff --git a/loader/win32.c b/loader/win32.c index 5f0d9d3e8c..b73a3b9ebd 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -993,7 +993,7 @@ static void WINAPI expGetSystemInfo(SYSTEM_INFO* si) /* 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; diff --git a/osdep/getch2.c b/osdep/getch2.c index 9c4a46e532..803dc61736 100644 --- a/osdep/getch2.c +++ b/osdep/getch2.c @@ -220,7 +220,7 @@ void getch2_enable(){ 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 @@ struct termios tio_new; 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 @@ void getch2_disable(){ #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);