[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 02/10] mini-os: sort and sanitize e820 memory map
On 21.12.21 00:17, Samuel Thibault wrote:
Juergen Gross, le lun. 20 déc. 2021 17:07:08 +0100, a ecrit:
+static void e820_sanitize(void)
+{
+ int i;
+ unsigned long end, start;
+
+ /* Sanitize memory map in current form. */
+ e820_process_entries();
+
+ /* Adjust map entries to page boundaries. */
+ for ( i = 0; i < e820_entries; i++ )
+ {
+ start = e820_map[i].addr;
+ end = start + e820_map[i].size;
+ if ( (1U << e820_map[i].type) & E820_NARROW )
+ {
+ if ( start & (PAGE_SIZE - 1) )
+ {
+ start = round_pgup(start);
+ e820_insert_entry_at(i, start - PAGE_SIZE, PAGE_SIZE,
+ E820_TMP_RESERVED);
+ i++;
+ }
+ if ( end & (PAGE_SIZE - 1) )
+ {
+ end = round_pgdown(end);
+ e820_insert_entry_at(i, end, PAGE_SIZE, E820_TMP_RESERVED);
Rather i+1 so it's most probably already sorted?
Ah, yes, good catch.
Apart from that,
Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
Thanks,
Juergen
Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature
|