mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04: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
1 changed files with 13 additions and 1 deletions
|
|
@ -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 a new issue