# HG changeset patch # User diego # Date 1117010912 0 # Node ID 3758536dcef3735bdcfdf124aa16c89824f98d22 # Parent 1c1c7cd29707744dff9367330609cfd1a2ff5e1d DragonFly BSD support patch by Joerg Sonnenberger diff -r 1c1c7cd29707 -r 3758536dcef3 cpudetect.c --- 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 #endif -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__DragonFly__) #include #include #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); diff -r 1c1c7cd29707 -r 3758536dcef3 libdha/pci.c --- 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" diff -r 1c1c7cd29707 -r 3758536dcef3 libmpcodecs/ad_realaud.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 diff -r 1c1c7cd29707 -r 3758536dcef3 libmpcodecs/vd_realvid.c --- 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 diff -r 1c1c7cd29707 -r 3758536dcef3 libmpdemux/cddb.c --- 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 -#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 @@ 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 -r 1c1c7cd29707 -r 3758536dcef3 libmpdemux/stream_vcd.c --- 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 #include -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__DragonFly__) #include #include "vcd_read_fbsd.h" #elif defined(__NetBSD__) || defined (__OpenBSD__) diff -r 1c1c7cd29707 -r 3758536dcef3 libmpdemux/tvi_bsdbt848.c --- 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 #include +#elif defined(__DragonFly__) +#include +#include #elif __FreeBSD_version >= 502100 #include #include diff -r 1c1c7cd29707 -r 3758536dcef3 libmpdvdkit2/bswap.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 +#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 -r 1c1c7cd29707 -r 3758536dcef3 libmpdvdkit2/dvd_reader.c --- 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 #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 -r 1c1c7cd29707 -r 3758536dcef3 loader/ldt_keeper.c --- 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 #include #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__) { diff -r 1c1c7cd29707 -r 3758536dcef3 loader/pe_image.c --- 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 diff -r 1c1c7cd29707 -r 3758536dcef3 loader/win32.c --- 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; diff -r 1c1c7cd29707 -r 3758536dcef3 osdep/getch2.c --- 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);