summaryrefslogblamecommitdiffstats
path: root/source/x/x11/patch/xf86-video-chips/0005-util-Consolidate-common-macros.patch
blob: 77d0d5bc060d229bc640724695f21c7a9f0d1356 (plain) (tree)


























































































































































































































































































                                                                               
From 94a8b34528b42a4fe6f81c8b8bd1ddb6bebaeea9 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston <jeremyhu@apple.com>
Date: Tue, 18 Oct 2011 23:04:32 -0700
Subject: [PATCH 5/9] util: Consolidate common macros

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
---
 util/dRegs.c    |   57 +------------------------------------------------------
 util/iopl.h     |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 util/mRegs.c    |   57 +------------------------------------------------------
 util/modClock.c |   53 ++-------------------------------------------------
 4 files changed, 58 insertions(+), 163 deletions(-)
 create mode 100644 util/iopl.h

diff --git a/util/dRegs.c b/util/dRegs.c
index b7edc8f..0d2f0cb 100644
--- a/util/dRegs.c
+++ b/util/dRegs.c
@@ -1,63 +1,8 @@
-
-
-
-
-
-
-#ifdef __NetBSD__
-#  include <sys/types.h>
-#  include <machine/pio.h>
-#  include <machine/sysarch.h>
-#else
-#  if defined(SVR4) && defined(i386)
-#    include <sys/types.h>
-#    ifdef NCR
-       /* broken NCR <sys/sysi86.h> */
-#      define __STDC
-#      include <sys/sysi86.h>
-#      undef __STDC
-#    else
-#      include <sys/sysi86.h>
-#    endif
-#    ifdef SVR4
-#      if !defined(sun)
-#        include <sys/seg.h>
-#      endif
-#    endif
-#    include <sys/v86.h>
-#    if defined(sun)
-#      include <sys/psw.h>
-#    endif
-#  endif
-#  include "AsmMacros.h"
-#endif /* NetBSD */
-
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifdef __NetBSD__
-#  define SET_IOPL() i386_iopl(3)
-#  define RESET_IOPL() i386_iopl(0)
-#else
-#  if defined(SVR4) && defined(i386)
-#    ifndef SI86IOPL
-#      define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
-#      define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
-#    else
-#      define SET_IOPL() sysi86(SI86IOPL,3)
-#      define RESET_IOPL() sysi86(SI86IOPL,0)
-#    endif
-#  else
-#    ifdef linux
-#      define SET_IOPL() iopl(3)
-#      define RESET_IOPL() iopl(0)
-#    else
-#      define SET_IOPL() (void)0
-#      define RESET_IOPL() (void)0
-#    endif
-#  endif
-#endif
+#include "iopl.h"
 
 int main(void)
 {
diff --git a/util/iopl.h b/util/iopl.h
new file mode 100644
index 0000000..d7890b3
--- /dev/null
+++ b/util/iopl.h
@@ -0,0 +1,54 @@
+#ifdef __NetBSD__
+#  include <sys/types.h>
+#  include <machine/pio.h>
+#  include <machine/sysarch.h>
+#else
+#  if defined(SVR4) && defined(i386)
+#    include <sys/types.h>
+#    ifdef NCR
+       /* broken NCR <sys/sysi86.h> */
+#      define __STDC
+#      include <sys/sysi86.h>
+#      undef __STDC
+#    else
+#      include <sys/sysi86.h>
+#    endif
+#    ifdef SVR4
+#      if !defined(sun)
+#        include <sys/seg.h>
+#      endif
+#    endif
+#    include <sys/v86.h>
+#    if defined(sun)
+#      include <sys/psw.h>
+#    endif
+#  endif
+#  include "AsmMacros.h"
+#endif /* NetBSD */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef __NetBSD__
+#  define SET_IOPL() i386_iopl(3)
+#  define RESET_IOPL() i386_iopl(0)
+#else
+#  if defined(SVR4) && defined(i386)
+#    ifndef SI86IOPL
+#      define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
+#      define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
+#    else
+#      define SET_IOPL() sysi86(SI86IOPL,3)
+#      define RESET_IOPL() sysi86(SI86IOPL,0)
+#    endif
+#  else
+#    ifdef linux
+#      define SET_IOPL() iopl(3)
+#      define RESET_IOPL() iopl(0)
+#    else
+#      define SET_IOPL() (void)0
+#      define RESET_IOPL() (void)0
+#    endif
+#  endif
+#endif
diff --git a/util/mRegs.c b/util/mRegs.c
index f359738..843d01d 100644
--- a/util/mRegs.c
+++ b/util/mRegs.c
@@ -1,63 +1,8 @@
-
-
-
-
-
-
-#ifdef __NetBSD__
-#  include <sys/types.h>
-#  include <machine/pio.h>
-#  include <machine/sysarch.h>
-#else
-#  if defined(SVR4) && defined(i386)
-#    include <sys/types.h>
-#    ifdef NCR
-       /* broken NCR <sys/sysi86.h> */
-#      define __STDC
-#      include <sys/sysi86.h>
-#      undef __STDC
-#    else
-#      include <sys/sysi86.h>
-#    endif
-#    ifdef SVR4
-#      if !defined(sun)
-#        include <sys/seg.h>
-#      endif
-#    endif
-#    include <sys/v86.h>
-#    if defined(sun)
-#      include <sys/psw.h>
-#    endif
-#  endif
-#  include "AsmMacros.h"
-#endif /* NetBSD */
-
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifdef __NetBSD__
-#  define SET_IOPL() i386_iopl(3)
-#  define RESET_IOPL() i386_iopl(0)
-#else
-#  if defined(SVR4) && defined(i386)
-#    ifndef SI86IOPL
-#      define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
-#      define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
-#    else
-#      define SET_IOPL() sysi86(SI86IOPL,3)
-#      define RESET_IOPL() sysi86(SI86IOPL,0)
-#    endif
-#  else
-#    ifdef linux
-#      define SET_IOPL() iopl(3)
-#      define RESET_IOPL() iopl(0)
-#    else
-#      define SET_IOPL() (void)0
-#      define RESET_IOPL() (void)0
-#    endif
-#  endif
-#endif
+#include "iopl.h"
 
 int hex2int(char* str);
 
diff --git a/util/modClock.c b/util/modClock.c
index 89a291a..45af19b 100644
--- a/util/modClock.c
+++ b/util/modClock.c
@@ -1,61 +1,12 @@
-
-#ifdef __NetBSD__
-#  include <sys/types.h>
-#  include <machine/pio.h>
-#  include <machine/sysarch.h>
-#else
-#  if defined(SVR4) && defined(i386)
-#    include <sys/types.h>
-#    ifdef NCR
-       /* broken NCR <sys/sysi86.h> */
-#      define __STDC
-#      include <sys/sysi86.h>
-#      undef __STDC
-#    else
-#      include <sys/sysi86.h>
-#    endif
-#    ifdef SVR4
-#      if !defined(sun)
-#        include <sys/seg.h>
-#      endif
-#    endif
-#    include <sys/v86.h>
-#    if defined(sun)
-#      include <sys/psw.h>
-#    endif
-#  endif
-#  include "AsmMacros.h"
-#endif /* NetBSD */
-
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
+
 #ifndef Lynx
 #include <fnmatch.h>
 #endif
 
-#ifdef __NetBSD__
-#  define SET_IOPL() i386_iopl(3)
-#  define RESET_IOPL() i386_iopl(0)
-#else
-#  if defined(SVR4) && defined(i386)
-#    ifndef SI86IOPL
-#      define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
-#      define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
-#    else
-#      define SET_IOPL() sysi86(SI86IOPL,3)
-#      define RESET_IOPL() sysi86(SI86IOPL,0)
-#    endif
-#  else
-#    ifdef linux
-#      define SET_IOPL() iopl(3)
-#      define RESET_IOPL() iopl(0)
-#    else
-#      define SET_IOPL() (void)0
-#      define RESET_IOPL() (void)0
-#    endif
-#  endif
-#endif
+#include "iopl.h"
 
 #define tolerance 0.01 /* +/- 1% */
 
-- 
1.7.9.4