summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2015-06-30 14:19:57 -0400
committerPeter Jones <pjones@redhat.com>2015-06-30 14:19:57 -0400
commit403afdad02dac12639afbb380f3ec8f37cd6f723 (patch)
treeb06581a9d6522e8f442c03f93eb6fae6aef1b786
parentb4cd19405fb16fc3c13568c968d473172bbb0d54 (diff)
downloadefi-boot-shim-403afdad02dac12639afbb380f3ec8f37cd6f723.tar.gz
efi-boot-shim-403afdad02dac12639afbb380f3ec8f37cd6f723.zip
Improve our debuginfo path print
Signed-off-by: Peter Jones <pjones@redhat.com>
-rw-r--r--Makefile15
-rw-r--r--fallback.c4
-rw-r--r--shim.c19
3 files changed, 27 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 547cec5e..abf34287 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,9 @@
+VERSION = 0.8
+RELEASE :=
+ifneq ($(RELEASE),"")
+ RELEASE="-$(RELEASE)"
+endif
+
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
OBJCOPY = $(CROSS_COMPILE)objcopy
@@ -36,15 +42,18 @@ ifeq ($(ARCH),x86_64)
CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc \
-maccumulate-outgoing-args \
-DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI \
- "-DEFI_ARCH=L\"x64\""
+ "-DEFI_ARCH=L\"x64\"" \
+ "-DDEBUGDIR=L\"/usr/lib/debug/usr/share/shim/x64-$(VERSION)$(RELEASE)/\""
endif
ifeq ($(ARCH),ia32)
CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc \
-maccumulate-outgoing-args -m32 \
- "-DEFI_ARCH=L\"ia32\""
+ "-DEFI_ARCH=L\"ia32\"" \
+ "-DDEBUGDIR=L\"/usr/lib/debug/usr/share/shim/ia32-$(VERSION)$(RELEASE)/\""
endif
ifeq ($(ARCH),aarch64)
CFLAGS += "-DEFI_ARCH=L\"aa64\""
+ "-DDEBUGDIR=L\"/usr/lib/debug/usr/share/shim/aa64-$(VERSION)$(RELEASE)/\""
endif
ifneq ($(origin VENDOR_CERT_FILE), undefined)
@@ -56,8 +65,6 @@ endif
LDFLAGS = --hash-style=sysv -nostdlib -znocombreloc -T $(EFI_LDS) -shared -Bsymbolic -L$(EFI_PATH) -L$(LIB_PATH) -LCryptlib -LCryptlib/OpenSSL $(EFI_CRT_OBJS) --build-id=sha1
-VERSION = 0.8
-
TARGET = shim.efi MokManager.efi.signed fallback.efi.signed
OBJS = shim.o netboot.o cert.o replacements.o version.o
KEYS = shim_cert.h ocsp.* ca.* shim.crt shim.csr shim.p12 shim.pem shim.key shim.cer
diff --git a/fallback.c b/fallback.c
index cf578d69..da7f2099 100644
--- a/fallback.c
+++ b/fallback.c
@@ -816,8 +816,8 @@ debug_hook(void)
return;
x = 1;
- Print(L"add-symbol-file /usr/lib/debug/usr/share/shim/"
- EFI_ARCH"/fallback.debug %p -s .data %p\n", &_etext,
+ Print(L"add-symbol-file "DEBUGDIR
+ L"fallback.debug %p -s .data %p\n", &_etext,
&_edata);
}
diff --git a/shim.c b/shim.c
index 5daafb7f..4c6bdc54 100644
--- a/shim.c
+++ b/shim.c
@@ -2151,7 +2151,7 @@ debug_hook(void)
UINT8 *data = NULL;
UINTN dataSize = 0;
EFI_STATUS efi_status;
- volatile register int x = 0;
+ volatile register UINTN x = 0;
extern char _text, _data;
if (x)
@@ -2162,19 +2162,28 @@ debug_hook(void)
return;
}
- Print(L"add-symbol-file /usr/lib/debug/usr/share/shim/"
- EFI_ARCH"/shim.debug 0x%08x -s .data 0x%08x\n", &_text,
+ Print(L"add-symbol-file "DEBUGDIR
+ L"shim.debug 0x%08x -s .data 0x%08x\n", &_text,
&_data);
Print(L"Pausing for debugger attachment.\n");
+ Print(L"To disable this, remove the EFI variable SHIM_DEBUG-%g .\n",
+ &guid);
x = 1;
- while (x) {
+ while (x++) {
+ /* Make this so it can't /totally/ DoS us. */
#if defined(__x86_64__) || defined(__i386__) || defined(__i686__)
+ if (x > 4294967294)
+ break;
__asm__ __volatile__("pause");
#elif defined(__aarch64__)
+ if (x > 1000)
+ break;
__asm__ __volatile__("wfi");
#else
- uefi_call_wrapper(BS->Stall, 1, 50000);
+ if (x > 12000)
+ break;
+ uefi_call_wrapper(BS->Stall, 1, 5000);
#endif
}
x = 1;