On 21.06.22 00:43, Samuel Thibault wrote:
Juergen Gross, le dim. 19 juin 2022 08:52:52 +0200, a ecrit:
When getting the current allocation from Xen, this value includes the
pages allocated in the MMIO area. Fix the highest available RAM page
by subtracting the size of that area.

This requires to read the E820 map before needing this value. Add two
functions returning the current and the maximum number of RAM pages
taking this correction into account.

At the same time add the LAPIC page to the memory map in order to
avoid reusing that PFN for internal purposes.

Signed-off-by: Juergen Gross <jgr...@suse.com>
---
V2:
- make e820_initial_reserved_pfns static (Samuel Thibault)
- add e820_get_current_pages() and e820_get_max_pages()
---

diff --git a/include/e820.h b/include/e820.h
index 5438a7c8..6f15fcd2 100644
--- a/include/e820.h
+++ b/include/e820.h
@@ -52,6 +52,8 @@ struct __packed e820entry {
  extern struct e820entry e820_map[];
  extern unsigned e820_entries;
+unsigned int e820_get_current_pages(void);
+unsigned int e820_get_max_pages(void);

Why an int rather than a long int? Yes 4TiB memory is large for mini-os,
but better keep numbers of pages a long?

I don't think it matters that much (currently Mini-OS can't support more
than 512GiB of memory), but I can change the functions to unsigned long.


Apart from that,

Reviewed-by: Samuel Thibault <samuel.thiba...@ens-lyon.org>

Thanks,


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to