gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / patches / picprog-non-intel-support.patch
1 https://sources.debian.org/data/main/p/picprog/1.9.1-3/debian/patches/20_iopl.patch
2
3 Description: Avoid some functions in some architectures
4 Upstream uses iopl() function and other architecture-dependent
5 codes. This patch adds building switches to avoid them in
6 some architectures.
7 Author: Koichi Akabe <vbkaisetsu@gmail.com>
8 Last-Update: 2011-11-30
9
10 --- picprog-1.9.1.orig/picport.cc
11 +++ picprog-1.9.1/picport.cc
12 @@ -38,7 +38,12 @@
13 #include <ctime>
14
15 #include <sys/ioctl.h>
16 -#include <sys/io.h>
17 +
18 +#if defined(__i386__) || defined(__x86_64__)
19 + #include <sys/io.h>
20 + #define HAVE_IOPL
21 +#endif
22 +
23 #include <fcntl.h>
24 #include <sys/time.h>
25 #include <unistd.h>
26 @@ -160,8 +165,12 @@
27 // Not root. Cannot use realtime scheduling.
28 use_nanosleep = 0;
29 }
30 +#ifdef HAVE_IOPL
31 if (iopl (3))
32 disable_interrupts = 0;
33 +#else
34 + disable_interrupts = 0;
35 +#endif
36
37 #ifdef CPU_SETSIZE
38 // When computing the delay loops, we do not want the cpu's to change.
39 @@ -403,13 +412,17 @@
40 {
41 struct timeval tv1, tv2;
42 gettimeofday (&tv1, 0);
43 +#if defined(__i386__) or defined(__x86_64__)
44 if (tsc_1000ns > 1 && disable_interrupts)
45 asm volatile("pushf; cli");
46 +#endif
47 set_clock_data (1, b); // set data, clock up
48 delay (cable_delay);
49 set_clock_data (0, b); // clock down
50 +#if defined(__i386__) or defined(__x86_64__)
51 if (tsc_1000ns > 1 && disable_interrupts)
52 asm volatile("popf");
53 +#endif
54 gettimeofday (&tv2, 0);
55
56 // We may have spent a long time in an interrupt or in another task
57 @@ -428,13 +441,17 @@
58 {
59 struct timeval tv1, tv2;
60 gettimeofday (&tv1, 0);
61 +#if defined(__i386__) or defined(__x86_64__)
62 if (tsc_1000ns > 1 && disable_interrupts)
63 asm volatile("pushf; cli");
64 +#endif
65 set_clock_data (1, 1); // clock up
66 delay (cable_delay);
67 set_clock_data (0, 1); // set data up, clock down
68 +#if defined(__i386__) or defined(__x86_64__)
69 if (tsc_1000ns > 1 && disable_interrupts)
70 asm volatile("popf");
71 +#endif
72 gettimeofday (&tv2, 0);
73
74 // We may have spent a long time in an interrupt or in another task