Browse Source

[xen] Use generic test_and_clear_bit() function

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
c14971bf88
2 changed files with 14 additions and 19 deletions
  1. 0
    19
      src/arch/x86/include/bits/xen.h
  2. 14
    0
      src/include/ipxe/xen.h

+ 0
- 19
src/arch/x86/include/bits/xen.h View File

161
 	return retval;
161
 	return retval;
162
 }
162
 }
163
 
163
 
164
-/**
165
- * Test and clear pending event
166
- *
167
- * @v xen		Xen hypervisor
168
- * @v port		Event channel port
169
- * @ret pending		Event was pending
170
- */
171
-static inline __attribute__ (( always_inline )) uint8_t
172
-xenevent_pending ( struct xen_hypervisor *xen, evtchn_port_t port ) {
173
-	uint8_t pending;
174
-
175
-	__asm__ __volatile__ ( "lock btr %2, %0\n\t"
176
-			       "setc %1\n\t"
177
-			       : "+m" ( xen->shared->evtchn_pending ),
178
-				 "=a"  ( pending )
179
-			       : "Ir" ( port ) );
180
-	return pending;
181
-}
182
-
183
 #endif /* _BITS_XEN_H */
164
 #endif /* _BITS_XEN_H */

+ 14
- 0
src/include/ipxe/xen.h View File

13
 #define __XEN_INTERFACE_VERSION__ 0x00040400
13
 #define __XEN_INTERFACE_VERSION__ 0x00040400
14
 
14
 
15
 #include <stdint.h>
15
 #include <stdint.h>
16
+#include <ipxe/bitops.h>
16
 #include <ipxe/uaccess.h>
17
 #include <ipxe/uaccess.h>
17
 #include <xen/xen.h>
18
 #include <xen/xen.h>
18
 #include <xen/event_channel.h>
19
 #include <xen/event_channel.h>
58
 	struct xen_store store;
59
 	struct xen_store store;
59
 };
60
 };
60
 
61
 
62
+/**
63
+ * Test and clear pending event
64
+ *
65
+ * @v xen		Xen hypervisor
66
+ * @v port		Event channel port
67
+ * @ret pending		Event was pending
68
+ */
69
+static inline __attribute__ (( always_inline )) int
70
+xenevent_pending ( struct xen_hypervisor *xen, evtchn_port_t port ) {
71
+
72
+	return test_and_clear_bit ( port, xen->shared->evtchn_pending );
73
+}
74
+
61
 #include <bits/xen.h>
75
 #include <bits/xen.h>
62
 
76
 
63
 /**
77
 /**

Loading…
Cancel
Save