From 6446304460a63b46ce2ffebafc332b20a76e5ef6 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 20 Jan 2019 08:20:32 +0100 Subject: [PATCH] efi_loader: use library memcpy() in helloworld.efi Helloworld does not need its own memcpy() implementation anymore. Use the one provided in efi_freestanding.c. Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- lib/efi_loader/helloworld.c | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c index 2905479..426f276 100644 --- a/lib/efi_loader/helloworld.c +++ b/lib/efi_loader/helloworld.c @@ -18,30 +18,6 @@ static const efi_guid_t acpi_guid = EFI_ACPI_TABLE_GUID; static const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID; /** - * hw_memcmp() - compare memory areas - * - * @buf1: pointer to first area - * @buf2: pointer to second area - * @length: number of bytes to compare - * Return: 0 if both memory areas are the same, otherwise the sign of the - * result value is the same as the sign of ghe difference between - * the first differing pair of bytes taken as u8. - */ -static int hw_memcmp(const void *buf1, const void *buf2, size_t length) -{ - const u8 *pos1 = buf1; - const u8 *pos2 = buf2; - - for (; length; --length) { - if (*pos1 != *pos2) - return *pos1 - *pos2; - ++pos1; - ++pos2; - } - return 0; -} - -/** * efi_main() - entry point of the EFI application. * * @handle: handle of the loaded image @@ -88,16 +64,16 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, } /* Find configuration tables */ for (i = 0; i < systable->nr_tables; ++i) { - if (!hw_memcmp(&systable->tables[i].guid, &fdt_guid, - sizeof(efi_guid_t))) + if (!memcmp(&systable->tables[i].guid, &fdt_guid, + sizeof(efi_guid_t))) con_out->output_string (con_out, L"Have device tree\r\n"); - if (!hw_memcmp(&systable->tables[i].guid, &acpi_guid, - sizeof(efi_guid_t))) + if (!memcmp(&systable->tables[i].guid, &acpi_guid, + sizeof(efi_guid_t))) con_out->output_string (con_out, L"Have ACPI 2.0 table\r\n"); - if (!hw_memcmp(&systable->tables[i].guid, &smbios_guid, - sizeof(efi_guid_t))) + if (!memcmp(&systable->tables[i].guid, &smbios_guid, + sizeof(efi_guid_t))) con_out->output_string (con_out, L"Have SMBIOS table\r\n"); } -- 2.7.4