From b488d4859bd1c6f96687a8f1659aa6aa057b7ce4 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 18 Sep 2019 16:05:17 +0100 Subject: [PATCH] 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 --- arch/src/x86_64/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/src/x86_64/mod.rs b/arch/src/x86_64/mod.rs index c2ee5295f..8f4b77cb4 100644 --- a/arch/src/x86_64/mod.rs +++ b/arch/src/x86_64/mod.rs @@ -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, )?; }