* grub-core/kern/uboot/init.c (uboot_timer_ms): Fix overflow after 71

minutes.
This commit is contained in:
Vladimir Serbinenko 2013-12-04 08:26:13 +01:00
parent 234d93464a
commit 40b5739ff9
2 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/uboot/init.c (uboot_timer_ms): Fix overflow after 71
minutes.
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/ieee1275/ofdisk.c: Remove variable length arrays.

View file

@ -61,7 +61,13 @@ grub_uboot_get_boot_data (void)
static grub_uint64_t
uboot_timer_ms (void)
{
return (grub_uint64_t) grub_uboot_get_timer (timer_start) / 1000;
static grub_uint32_t last = 0, high = 0;
grub_uint32_t cur = grub_uboot_get_timer (timer_start);
if (cur < last)
high++;
last = cur;
return grub_divmod64 ((((grub_uint64_t) high) << 32) | cur,
1000, 0);
}
void