aboutsummaryrefslogtreecommitdiffstats
path: root/bootloader/other.c
blob: 9286daca66e90355a424ceaf3c106402a26e38d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <efi.h>
#include <efilib.h>
#include <efidef.h>

#include "other.h"

void PrintImageAddr(EFI_HANDLE image)
{
  EFI_LOADED_IMAGE *loaded_image = NULL;
  EFI_STATUS status;

  status = uefi_call_wrapper(BS->HandleProtocol,
                             3,
                             image,
                             &LoadedImageProtocol,
                             (void **)&loaded_image);

  if (EFI_ERROR(status))
  {
    Print(L"handleprotocol: %r\n", status);
  }

  Print(L"Image base: 0x%lx\n", loaded_image->ImageBase);
}

bool AreEqual(void* lhs, void* rhs, uint64_t size)
{
  char* clhs = (char*)lhs;
  char* crhs = (char*)rhs;

  bool equal = true;

  for(int i = 0; i < size; i++)
  {
    if(clhs[i] != crhs[i])
    {
      equal = false;
    }
  }

  return equal;
}