iPXE
|
x86 bit operations More...
#include <stdint.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static | __attribute__ ((always_inline)) void set_bit(unsigned int bit |
Set bit atomically. More... | |
__asm__ | __volatile__ ("lock btsl %k1, %0" :"+m"(*bytes) :"Ir"(bit)) |
__asm__ | __volatile__ ("lock btrl %k1, %0" :"+m"(*bytes) :"Ir"(bit)) |
__asm__ | __volatile__ ("lock btsl %k2, %0\n\t" "sbb %1, %1\n\t" :"+m"(*bytes), "=r"(old) :"Ir"(bit)) |
__asm__ | __volatile__ ("lock btrl %k2, %0\n\t" "sbb %1, %1\n\t" :"+m"(*bytes), "=r"(old) :"Ir"(bit)) |
Variables | |
static volatile void * | bits |
int | old |
x86 bit operations
We perform atomic bit set and bit clear operations using "lock bts" and "lock btr". We use the output constraint to inform the compiler that any memory from the start of the bit field up to and including the byte containing the 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.)
Definition in file bitops.h.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Set bit atomically.
Test and clear bit atomically.
Test and set bit atomically.
Clear bit atomically.
bit | Bit to set |
bits | Bit field |
bit | Bit to set |
bits | Bit field |
old | Old value of bit (zero or non-zero) |
__asm__ __volatile__ | ( | "lock btsl % | k1, |
%0" :"+m"*bytes :"Ir" | bit | ||
) |
__asm__ __volatile__ | ( | "lock btrl % | k1, |
%0" :"+m"*bytes :"Ir" | bit | ||
) |
__asm__ __volatile__ | ( | "lock btsl % | k2, |
%0\n\t" "sbb % | 1, | ||
%1\n\t" :"+m"* | bytes | ||
) |
__asm__ __volatile__ | ( | "lock btrl % | k2, |
%0\n\t" "sbb % | 1, | ||
%1\n\t" :"+m"* | bytes | ||
) |
static volatile void * bits |
Definition at line 27 of file bitops.h.
Referenced by _tg3_flag(), _tg3_flag_clear(), _tg3_flag_set(), arbel_bitmask_alloc(), arbel_bitmask_free(), asn1_bit_string(), asn1_integral_bit_string(), ath5k_hw_bitswap(), ath9k_hw_getrxfilter(), ath9k_hw_setrxfilter(), bitops_test_exec(), deflate_alphabet(), deflate_bin(), deflate_consume(), deflate_dump_alphabet(), deflate_inflate(), deflate_init(), deflate_set_length(), hermon_bitmask_alloc(), hermon_bitmask_free(), hub_complete(), mdio_sync(), net80211_duration(), png_pixels_pass(), rol32(), ror16(), ror32(), rsa_parse_mod_exp(), smc_read_phy_register(), and smc_write_phy_register().
return old |
Definition at line 64 of file bitops.h.
Referenced by efi_file_path_claim(), generic_settings_store(), tcp_sack(), and usbkbd_report().