]>
git.proxmox.com Git - efi-boot-shim.git/blob - gnu-efi/apps/debughook.c
5 GetVariableAttr(CHAR16
*var
, UINT8
**data
, UINTN
*len
, EFI_GUID owner
,
12 efi_status
= uefi_call_wrapper(RT
->GetVariable
, 5, var
, &owner
,
14 if (efi_status
!= EFI_BUFFER_TOO_SMALL
)
17 *data
= AllocateZeroPool(*len
);
19 return EFI_OUT_OF_RESOURCES
;
21 efi_status
= uefi_call_wrapper(RT
->GetVariable
, 5, var
, &owner
,
22 attributes
, len
, *data
);
24 if (efi_status
!= EFI_SUCCESS
) {
32 GetVariable(CHAR16
*var
, UINT8
**data
, UINTN
*len
, EFI_GUID owner
)
34 return GetVariableAttr(var
, data
, len
, owner
, NULL
);
38 {0x55aad538, 0x8f82, 0x4e2a, {0xa4,0xf0,0xbe, 0x59, 0x13, 0xb6, 0x5f, 0x1e}};
40 #if defined(__clang__)
41 # define _OPTNONE __attribute__((optnone))
43 # define _OPTNONE __attribute__((__optimize__("0")))
49 EFI_GUID guid
= DUMMY_GUID
;
52 EFI_STATUS efi_status
;
53 register volatile unsigned long long x
= 0;
54 extern char _text
, _data
;
59 efi_status
= GetVariable(L
"DUMMY_DEBUG", &data
, &dataSize
, guid
);
60 if (EFI_ERROR(efi_status
)) {
64 Print(L
"add-symbol-file /usr/lib/debug/boot/efi/debughook.debug "
65 L
"0x%08x -s .data 0x%08x\n", &_text
, &_data
);
67 Print(L
"Pausing for debugger attachment.\n");
68 Print(L
"To disable this, remove the EFI variable DUMMY_DEBUG-%g .\n",
72 /* Make this so it can't /totally/ DoS us. */
73 #if defined(__x86_64__) || defined(__i386__) || defined(__i686__)
74 if (x
> 4294967294ULL)
76 __asm__
__volatile__("pause");
77 #elif defined(__aarch64__)
80 __asm__
__volatile__("wfi");
84 uefi_call_wrapper(BS
->Stall
, 1, 5000);
92 efi_main (EFI_HANDLE image
, EFI_SYSTEM_TABLE
*systab
)
94 InitializeLib(image
, systab
);