X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=lib%2Fdiv64.c;h=779d7521f69fdeab66d92e3dc736004eaefe306e;hb=60c7facfc965af6ff8ea14ee26c9d49cd2d0ec22;hp=206f582ca96c5a11df528cd7dfc7f16eb57145da;hpb=1622559066d890f1b7622be0ede8a5d64de66ef3;p=oweals%2Fu-boot.git diff --git a/lib/div64.c b/lib/div64.c index 206f582ca9..779d7521f6 100644 --- a/lib/div64.c +++ b/lib/div64.c @@ -17,6 +17,7 @@ * or by defining a preprocessor macro in arch/include/asm/div64.h. */ +#include #include #include #include @@ -25,19 +26,25 @@ #if BITS_PER_LONG == 32 #ifndef __div64_32 -uint32_t __attribute__((weak)) __div64_32(uint64_t *n, uint32_t base) +/* + * Don't instrument this function as it may be called from tracing code, since + * it needs to read the timer and this often requires calling do_div(), which + * calls this function. + */ +uint32_t __attribute__((weak, no_instrument_function)) __div64_32(u64 *n, + u32 base) { - uint64_t rem = *n; - uint64_t b = base; - uint64_t res, d = 1; - uint32_t high = rem >> 32; + u64 rem = *n; + u64 b = base; + u64 res, d = 1; + u32 high = rem >> 32; /* Reduce the thing a bit first */ res = 0; if (high >= base) { high /= base; - res = (uint64_t) high << 32; - rem -= (uint64_t) (high*base) << 32; + res = (u64)high << 32; + rem -= (u64)(high * base) << 32; } while ((int64_t)b > 0 && b < rem) {