> +static grub_uint64_t

> +grub_efi_get_time_ms(void)
> +{
> +  grub_efi_time_t now;
> +  grub_uint64_t retval;
> +  grub_efi_status_t status;
> +
> +  status = efi_call_2 (grub_efi_system_table->runtime_services->get_time,
> +                    &now, NULL);
> +  if (status != GRUB_EFI_SUCCESS)
> +    {
> +      grub_printf("No time!\n");
> +      return 0;

This is about the worse thing you can do. It will make any timeout go wrong.

> +    }
> +  retval = now.year * 365 * 24 * 60 * 60 * 1000;
> +  retval += now.month * 30 * 24 * 60 * 60 * 1000;
> +  retval += now.day * 24 * 60 * 60 * 1000;
> +  retval += now.hour * 60 * 60 * 1000;
> +  retval += now.minute * 60 * 1000;
> +  retval += now.second * 1000;
> +  retval += now.nanosecond / 1000;
> + 
> +  grub_dprintf("timer", "timestamp: 0x%llx\n", retval);
> +
> +  return retval;

This is almost a verbatim copy of what we had for i386 efi before but it
went haywire in many ways. Like jumps forward or backward around end of
month or when one sets datetime. Or around the summer/winter timezone
transition.
Does ARM have anything like TSC?

> +static inline grub_size_t
> +page_align (grub_size_t size)
> +{
> +  return (size + (1 << 12) - 1) & (~((1 << 12) - 1));
> +}

We already have ALIGN_UP



Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to