Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F176216910
D9904.id26027.vs26023.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D9904.id26027.vs26023.diff
View Options
Index: head/sys/boot/efi/loader/copy.c
===================================================================
--- head/sys/boot/efi/loader/copy.c
+++ head/sys/boot/efi/loader/copy.c
@@ -53,7 +53,7 @@
UINT32 dver;
EFI_STATUS status;
int i, ndesc;
- unsigned long available_pages;
+ unsigned long available_pages = 0;
sz = 0;
status = BS->GetMemoryMap(&sz, 0, &key, &dsz, &dver);
@@ -70,7 +70,6 @@
}
ndesc = sz / dsz;
-
for (i = 0, p = map; i < ndesc;
i++, p = NextMemoryDescriptor(p, dsz)) {
start = p->PhysicalStart;
@@ -81,20 +80,38 @@
continue;
if (p->Type != EfiConventionalMemory)
- continue;
+ printf("Warning: wrong EFI memory type: %d\n",
+ p->Type);
available_pages = p->NumberOfPages -
((KERNEL_PHYSICAL_BASE - start) >> EFI_PAGE_SHIFT);
+ break;
+ }
+
+ if (available_pages == 0) {
+ printf("Can't find valid memory map for staging area!\n");
+ goto out;
+ }
- if (*nr_pages > available_pages) {
- printf("staging area size is reduced: %ld -> %ld!\n",
- *nr_pages, available_pages);
- *nr_pages = available_pages;
- }
+ for ( ; i < ndesc;
+ i++, p = NextMemoryDescriptor(p, dsz)) {
+ if (p->Type != EfiConventionalMemory &&
+ p->Type != EfiLoaderData)
+ break;
- break;
+ if (p->PhysicalStart != end)
+ break;
+
+ end = p->PhysicalStart + p->NumberOfPages * EFI_PAGE_SIZE;
+
+ available_pages += p->NumberOfPages;
}
+ if (*nr_pages > available_pages) {
+ printf("Staging area's size is reduced: %ld -> %ld!\n",
+ *nr_pages, available_pages);
+ *nr_pages = available_pages;
+ }
out:
free(map);
}
Index: sys/boot/efi/loader/copy.c
===================================================================
--- sys/boot/efi/loader/copy.c
+++ sys/boot/efi/loader/copy.c
@@ -53,7 +53,7 @@
UINT32 dver;
EFI_STATUS status;
int i, ndesc;
- unsigned long available_pages;
+ unsigned long available_pages = 0;
sz = 0;
status = BS->GetMemoryMap(&sz, 0, &key, &dsz, &dver);
@@ -70,7 +70,6 @@
}
ndesc = sz / dsz;
-
for (i = 0, p = map; i < ndesc;
i++, p = NextMemoryDescriptor(p, dsz)) {
start = p->PhysicalStart;
@@ -81,20 +80,38 @@
continue;
if (p->Type != EfiConventionalMemory)
- continue;
+ printf("Warning: wrong EFI memory type: %d\n",
+ p->Type);
available_pages = p->NumberOfPages -
((KERNEL_PHYSICAL_BASE - start) >> EFI_PAGE_SHIFT);
+ break;
+ }
+
+ if (available_pages == 0) {
+ printf("Can't find valid memory map for staging area!\n");
+ goto out;
+ }
- if (*nr_pages > available_pages) {
- printf("staging area size is reduced: %ld -> %ld!\n",
- *nr_pages, available_pages);
- *nr_pages = available_pages;
- }
+ for ( ; i < ndesc;
+ i++, p = NextMemoryDescriptor(p, dsz)) {
+ if (p->Type != EfiConventionalMemory &&
+ p->Type != EfiLoaderData)
+ break;
- break;
+ if (p->PhysicalStart != end)
+ break;
+
+ end = p->PhysicalStart + p->NumberOfPages * EFI_PAGE_SIZE;
+
+ available_pages += p->NumberOfPages;
}
+ if (*nr_pages > available_pages) {
+ printf("Staging area's size is reduced: %ld -> %ld!\n",
+ *nr_pages, available_pages);
+ *nr_pages = available_pages;
+ }
out:
free(map);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 18, 1:14 AM (5 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40975349
Default Alt Text
D9904.id26027.vs26023.diff (3 KB)
Attached To
Mode
D9904: fix UEFI boot on physical machines
Attached
Detach File
Event Timeline
Log In to Comment