Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151969666
D1417.id3442.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D1417.id3442.diff
View Options
Index: head/sys/amd64/amd64/machdep.c
===================================================================
--- head/sys/amd64/amd64/machdep.c
+++ head/sys/amd64/amd64/machdep.c
@@ -1355,8 +1355,10 @@
/*
* Find insertion point while checking for overlap. Start off by
* assuming the new entry will be added to the end.
+ *
+ * NB: physmap_idx points to the next free slot.
*/
- insert_idx = physmap_idx + 2;
+ insert_idx = physmap_idx;
for (i = 0; i <= physmap_idx; i += 2) {
if (base < physmap[i + 1]) {
if (base + length <= physmap[i]) {
@@ -1394,7 +1396,7 @@
* Move the last 'N' entries down to make room for the new
* entry if needed.
*/
- for (i = physmap_idx; i > insert_idx; i -= 2) {
+ for (i = (physmap_idx - 2); i > insert_idx; i -= 2) {
physmap[i] = physmap[i - 2];
physmap[i + 1] = physmap[i - 1];
}
@@ -1580,23 +1582,27 @@
int page_counter;
bzero(physmap, sizeof(physmap));
- basemem = 0;
physmap_idx = 0;
init_ops.parse_memmap(kmdp, physmap, &physmap_idx);
+ physmap_idx -= 2;
/*
* Find the 'base memory' segment for SMP
*/
basemem = 0;
for (i = 0; i <= physmap_idx; i += 2) {
- if (physmap[i] == 0x00000000) {
+ if (physmap[i] <= 0xA0000) {
basemem = physmap[i + 1] / 1024;
break;
}
}
- if (basemem == 0)
- panic("BIOS smap did not include a basemem segment!");
+ if (basemem == 0 || basemem > 640) {
+ if (bootverbose)
+ printf(
+ "Memory map doesn't contain a basemem segment, faking it");
+ basemem = 640;
+ }
/*
* Make hole for "AP -> long mode" bootstrap code. The
@@ -1604,8 +1610,12 @@
* is configured to support APs and APs for the system start
* in 32bit mode (e.g. SMP bare metal).
*/
- if (init_ops.mp_bootaddress)
+ if (init_ops.mp_bootaddress) {
+ if (physmap[1] >= 0x100000000)
+ panic(
+ "Basemem segment is not suitable for AP bootstrap code!");
physmap[1] = init_ops.mp_bootaddress(physmap[1] / 1024);
+ }
/*
* Maxmem isn't the "maximum memory", it's one larger than the
@@ -1657,12 +1667,14 @@
*/
physmem_start = (vm_guest > VM_GUEST_NO ? 1 : 16) << PAGE_SHIFT;
TUNABLE_ULONG_FETCH("hw.physmem.start", &physmem_start);
- if (physmem_start < PAGE_SIZE)
- physmap[0] = PAGE_SIZE;
- else if (physmem_start >= physmap[1])
- physmap[0] = round_page(physmap[1] - PAGE_SIZE);
- else
- physmap[0] = round_page(physmem_start);
+ if (physmap[0] < physmem_start) {
+ if (physmem_start < PAGE_SIZE)
+ physmap[0] = PAGE_SIZE;
+ else if (physmem_start >= physmap[1])
+ physmap[0] = round_page(physmap[1] - PAGE_SIZE);
+ else
+ physmap[0] = round_page(physmem_start);
+ }
pa_indx = 0;
da_indx = 1;
phys_avail[pa_indx++] = physmap[0];
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 12, 8:31 PM (6 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31369746
Default Alt Text
D1417.id3442.diff (2 KB)
Attached To
Mode
D1417: amd64: allow base memory segment to start at address different than 0
Attached
Detach File
Event Timeline
Log In to Comment