~ubuntu-branches/ubuntu/raring/picprog/raring

« back to all changes in this revision

Viewing changes to debian/patches/30_iopl.dpatch

  • Committer: Package Import Robot
  • Author(s): Koichi Akabe
  • Date: 2011-12-03 10:08:38 UTC
  • mfrom: (4.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20111203100838-f05iyixkqjdh2byd
Tags: 1.9.1-2
* debian/control
  - changed priority from extra to optional
  - narrowed environments: linux-any kfreebsd-any

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
## 30_iopl.dpatch by Jelmer Vernooij <jelmer@samba.org>
3
 
##
4
 
## All lines beginning with `## DP:' are a description of the patch.
5
 
## DP: picprog: Don't use iopl() on architectures that don't have it.
6
 
 
7
 
@DPATCH@
8
 
diff -ur picprog-1.9.0/picport.cc picprog-1.9.0-j/picport.cc
9
 
--- picprog-1.9.0/picport.cc    2008-06-05 08:07:55.000000000 +0200
10
 
+++ picprog-1.9.0-j/picport.cc  2008-09-29 16:17:43.000000000 +0200
11
 
@@ -33,7 +33,6 @@
12
 
 #include <string>
13
 
 
14
 
 #include <sys/ioctl.h>
15
 
-#include <sys/io.h>
16
 
 #include <fcntl.h>
17
 
 #include <errno.h>
18
 
 #include <time.h>
19
 
@@ -44,6 +43,10 @@
20
 
 #include <sysexits.h>
21
 
 #include <string.h>
22
 
 #include <sched.h>
23
 
+#if defined(__i386__) || defined(__x86_64__)
24
 
+#include <sys/io.h>
25
 
+#define HAVE_IOPL
26
 
+#endif
27
 
 
28
 
 #include "picport.h"
29
 
 
30
 
@@ -159,8 +162,12 @@
31
 
     // Not root.  Cannot use realtime scheduling.
32
 
     use_nanosleep = 0;
33
 
   }
34
 
+#ifdef HAVE_IOPL
35
 
   if (iopl (3))
36
 
     disable_interrupts = 0;
37
 
+#else
38
 
+  disable_interrupts = 0;
39
 
+#endif
40
 
 
41
 
 #ifdef CPU_SETSIZE
42
 
   // When computing the delay loops, we do not want the cpu's to change.
43
 
@@ -402,13 +409,17 @@
44
 
 {
45
 
   struct timeval tv1, tv2;
46
 
   gettimeofday (&tv1, 0);
47
 
+#if defined(__i386__) or defined(__x86_64__)
48
 
   if (tsc_1000ns > 1 && disable_interrupts)
49
 
     asm volatile("pushf; cli");
50
 
+#endif
51
 
   set_clock_data (1, b); // set data, clock up
52
 
   delay (cable_delay);
53
 
   set_clock_data (0, b); // clock down
54
 
+#if defined(__i386__) or defined(__x86_64__)
55
 
   if (tsc_1000ns > 1 && disable_interrupts)
56
 
     asm volatile("popf");
57
 
+#endif
58
 
   gettimeofday (&tv2, 0);
59
 
 
60
 
   // We may have spent a long time in an interrupt or in another task
61
 
@@ -427,13 +438,17 @@
62
 
 {
63
 
   struct timeval tv1, tv2;
64
 
   gettimeofday (&tv1, 0);
65
 
+#if defined(__i386__) or defined(__x86_64__)
66
 
   if (tsc_1000ns > 1 && disable_interrupts)
67
 
     asm volatile("pushf; cli");
68
 
+#endif
69
 
   set_clock_data (1, 1); // clock up
70
 
   delay (cable_delay);
71
 
   set_clock_data (0, 1); // set data up, clock down
72
 
+#if defined(__i386__) or defined(__x86_64__)
73
 
   if (tsc_1000ns > 1 && disable_interrupts)
74
 
     asm volatile("popf");
75
 
+#endif
76
 
   gettimeofday (&tv2, 0);
77
 
 
78
 
   // We may have spent a long time in an interrupt or in another task
79
 
diff -ur picprog-1.9.0/testport.cc picprog-1.9.0-j/testport.cc
80
 
--- picprog-1.9.0/testport.cc   2007-11-13 19:21:24.000000000 +0100
81
 
+++ picprog-1.9.0-j/testport.cc 2008-09-29 16:11:50.000000000 +0200
82
 
@@ -33,7 +33,6 @@
83
 
 #include <string>
84
 
 
85
 
 #include <sys/ioctl.h>
86
 
-#include <sys/io.h>
87
 
 #include <fcntl.h>
88
 
 #include <errno.h>
89
 
 #include <time.h>