[hyperv] Use generic set_bit() function

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2016-03-16 21:24:13 +00:00
parent c867b5ab1f
commit 9bab13a772
3 changed files with 3 additions and 48 deletions

View File

@@ -49,27 +49,4 @@ hv_call ( struct hv_hypervisor *hv, unsigned int code, const void *in,
return result;
}
/**
* Set bit atomically
*
* @v bits Bit field
* @v bit Bit to set
*/
static inline __attribute__ (( always_inline )) void
hv_set_bit ( void *bits, unsigned int bit ) {
struct {
uint64_t qword[ ( bit / 64 ) + 1 ];
} *qwords = bits;
/* Set bit using "lock bts". Inform compiler that any memory
* from the start of the bit field up to and including the
* qword containing this bit may be modified. (This is
* overkill but shouldn't matter in practice since we're
* unlikely to subsequently read other bits from the same bit
* field.)
*/
__asm__ __volatile__ ( "lock bts %1, %0"
: "+m" ( *qwords ) : "Ir" ( bit ) );
}
#endif /* _BITS_HYPERV_H */