mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-18 02:19:39 +00:00
bhyve: remove empty E820 entries
When reserving a block with the same size of a RAM segement, we can end up with an empty RAM segmenet. Avoid that by removing this empty segment from the E820 table. Reviewed by: jhb, markj (older version) MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D45480
This commit is contained in:
parent
104ee24349
commit
f325f81f4a
@ -210,7 +210,19 @@ e820_add_entry(const uint64_t base, const uint64_t end,
|
||||
(base < element->base || end > element->end))
|
||||
return (ENOMEM);
|
||||
|
||||
if (base == element->base) {
|
||||
if (base == element->base && end == element->end) {
|
||||
/*
|
||||
* The new entry replaces an existing one.
|
||||
*
|
||||
* Old table:
|
||||
* [ 0x1000, 0x4000] RAM <-- element
|
||||
* New table:
|
||||
* [ 0x1000, 0x4000] Reserved
|
||||
*/
|
||||
TAILQ_INSERT_BEFORE(element, new_element, chain);
|
||||
TAILQ_REMOVE(&e820_table, element, chain);
|
||||
free(element);
|
||||
} else if (base == element->base) {
|
||||
/*
|
||||
* New element at system memory base boundary. Add new
|
||||
* element before current and adjust the base of the old
|
||||
|
Loading…
Reference in New Issue
Block a user