arch: x86_64: Fix E820 table for RAM

The last byte was missing from the E820 RAM area. This was due to the
function using the last address relative to the first address in the
range to calculate the size. This incorrectly calculated the size by
one. This produced incorrect E820 tables like this:

[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009ffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000001ffffffe] usable

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2019-09-18 16:05:17 +01:00
parent 5b3ca78dac
commit b488d4859b

View File

@ -166,7 +166,7 @@ pub fn configure_system(
add_e820_entry(
&mut params.0,
himem_start.raw_value(),
mem_end.unchecked_offset_from(himem_start),
mem_end.unchecked_offset_from(himem_start) + 1,
E820_RAM,
)?;
} else {
@ -180,7 +180,7 @@ pub fn configure_system(
add_e820_entry(
&mut params.0,
first_addr_past_32bits.raw_value(),
mem_end.unchecked_offset_from(first_addr_past_32bits),
mem_end.unchecked_offset_from(first_addr_past_32bits) + 1,
E820_RAM,
)?;
}