From b46540452ad12ce44385386b3f0aadf89824e8fc Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 23 Jun 2010 13:52:32 +0000 Subject: [PATCH] Added vm_page_max_address() which returns the greatest address of accessible physical memory. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37230 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/vm/vm_page.h | 1 + src/system/kernel/vm/vm_page.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/headers/private/kernel/vm/vm_page.h b/headers/private/kernel/vm/vm_page.h index 3eb2c260e7..65feee5153 100644 --- a/headers/private/kernel/vm/vm_page.h +++ b/headers/private/kernel/vm/vm_page.h @@ -44,6 +44,7 @@ page_num_t vm_page_num_free_pages(void); page_num_t vm_page_num_available_pages(void); page_num_t vm_page_num_unused_pages(void); void vm_page_get_stats(system_info *info); +phys_addr_t vm_page_max_address(); status_t vm_page_write_modified_page_range(struct VMCache *cache, uint32 firstPage, uint32 endPage); diff --git a/src/system/kernel/vm/vm_page.cpp b/src/system/kernel/vm/vm_page.cpp index 7a947449d3..4ec0ac3d29 100644 --- a/src/system/kernel/vm/vm_page.cpp +++ b/src/system/kernel/vm/vm_page.cpp @@ -3634,3 +3634,15 @@ vm_page_get_stats(system_info *info) // TODO: We don't consider pages used for page directories/tables yet. } + + +/*! Returns the greatest address within the last page of accessible physical + memory. + The value is inclusive, i.e. in case of a 32 bit phys_addr_t 0xffffffff + means the that the last page ends at exactly 4 GB. +*/ +phys_addr_t +vm_page_max_address() +{ + return ((phys_addr_t)sPhysicalPageOffset + sNumPages) * B_PAGE_SIZE - 1; +}