+ } else if (CompareMem(Section->Name, ".sbat\0\0\0", 8) == 0) {
+ if (SBATBase || SBATSize) {
+ perror(L"Image has multiple resource sections\n");
+ return EFI_UNSUPPORTED;
+ }
+
+ if (Section->NumberOfRelocations != 0 ||
+ Section->PointerToRelocations != 0) {
+ perror(L"SBAT section has relocations\n");
+ return EFI_UNSUPPORTED;
+ }
+
+ /* If it has nonzero size, and our bounds check made
+ * sense, sizes match, then we believe it's okay. */
+ if (Section->SizeOfRawData &&
+ Section->SizeOfRawData == Section->Misc.VirtualSize &&
+ base && end) {
+ SBATBase = base;
+ /* +1 because of size vs last byte location */
+ SBATSize = end - base + 1;
+ }