bsf32() used x86-only 'bsf' inline assembly to find the lowest
set bit in the O(1) scheduler bitmap. This would not compile on
ARM/RISC-V/MIPS. Replace with __builtin_ctz() which GCC supports
on all target architectures.
Passes: make, cppcheck, QEMU smoke test.
static struct runqueue* rq_expired = &rq_expired_store;
static inline uint32_t bsf32(uint32_t v) {
- uint32_t r;
- __asm__ volatile("bsf %1, %0" : "=r"(r) : "rm"(v) : "cc");
- return r;
+ return (uint32_t)__builtin_ctz(v);
}
static void rq_enqueue(struct runqueue* rq, struct process* p) {