소스 검색

[xen] Use generic test_and_clear_bit() function

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 년 전
부모
커밋
c14971bf88
2개의 변경된 파일14개의 추가작업 그리고 19개의 파일을 삭제
  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 파일 보기

@@ -161,23 +161,4 @@ xen_hypercall_5 ( struct xen_hypervisor *xen, unsigned int hypercall,
161 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 164
 #endif /* _BITS_XEN_H */

+ 14
- 0
src/include/ipxe/xen.h 파일 보기

@@ -13,6 +13,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
13 13
 #define __XEN_INTERFACE_VERSION__ 0x00040400
14 14
 
15 15
 #include <stdint.h>
16
+#include <ipxe/bitops.h>
16 17
 #include <ipxe/uaccess.h>
17 18
 #include <xen/xen.h>
18 19
 #include <xen/event_channel.h>
@@ -58,6 +59,19 @@ struct xen_hypervisor {
58 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 75
 #include <bits/xen.h>
62 76
 
63 77
 /**

Loading…
취소
저장