mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
NOVA: maximize contiguous virtual space for 32/64
Use virtual regions for memory used during core initialization behind context area. Enables us to start Vancouver VMs up to 1280 MiB, which requires large virtual regions of contiguous aligned memory. Exclude used virtual regions of echo and of pager thread in core.
This commit is contained in:
parent
ea38aad30e
commit
ed2e610178
@ -22,7 +22,6 @@
|
||||
#include <echo.h>
|
||||
|
||||
enum {
|
||||
ECHO_UTCB_ADDR = 0x50000000,
|
||||
ECHO_STACK_SIZE = 1024,
|
||||
ECHO_CPU_NO = 0,
|
||||
ECHO_GLOBAL = false,
|
||||
@ -85,4 +84,4 @@ Echo::Echo(Genode::addr_t utcb_addr)
|
||||
}
|
||||
|
||||
|
||||
Echo *echo() { static Echo inst(ECHO_UTCB_ADDR); return &inst; }
|
||||
Echo *echo() { static Echo inst(Echo::ECHO_UTCB_ADDR); return &inst; }
|
||||
|
@ -27,6 +27,10 @@ class Echo
|
||||
|
||||
public:
|
||||
|
||||
enum {
|
||||
ECHO_UTCB_ADDR = 0xbff00000,
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -87,7 +87,7 @@ void Platform::_preserve_page(addr_t phys_page)
|
||||
** Core page-fault handler **
|
||||
*****************************/
|
||||
|
||||
enum { CORE_PAGER_UTCB_ADDR = 0x50002000 };
|
||||
enum { CORE_PAGER_UTCB_ADDR = 0xbff02000 };
|
||||
|
||||
|
||||
/**
|
||||
@ -199,6 +199,14 @@ Platform::Platform() :
|
||||
* Now that we can access the I/O ports for comport 0, printf works...
|
||||
*/
|
||||
|
||||
/* configure virtual address spaces */
|
||||
_vm_base = get_page_size();
|
||||
#ifdef __x86_64__
|
||||
_vm_size = 0x800000000000UL - _vm_base;
|
||||
#else
|
||||
_vm_size = 0xc0000000UL - _vm_base;
|
||||
#endif
|
||||
|
||||
/* set up page fault handler for core - for debugging */
|
||||
init_core_page_fault_handler();
|
||||
|
||||
@ -217,10 +225,9 @@ Platform::Platform() :
|
||||
addr_t mem_desc_base = ((addr_t)hip + hip->mem_desc_offset);
|
||||
|
||||
/* define core's virtual address space */
|
||||
addr_t virt_beg = get_page_size();
|
||||
addr_t virt_end = Native_config::context_area_virtual_base();
|
||||
_core_mem_alloc.virt_alloc()->add_range(virt_beg,
|
||||
virt_end - virt_beg);
|
||||
addr_t virt_beg = _vm_base;
|
||||
addr_t virt_end = _vm_size;
|
||||
_core_mem_alloc.virt_alloc()->add_range(virt_beg, virt_end - virt_beg);
|
||||
|
||||
/* exclude core image from core's virtual address allocator */
|
||||
addr_t core_virt_beg = trunc_page((addr_t)&_prog_img_beg),
|
||||
@ -232,8 +239,39 @@ Platform::Platform() :
|
||||
_core_mem_alloc.virt_alloc()->remove_range(Native_config::context_area_virtual_base(),
|
||||
Native_config::context_area_virtual_size());
|
||||
|
||||
/* exclude utcb of core pager thread + empty guard pages before and after */
|
||||
_core_mem_alloc.virt_alloc()->remove_range(CORE_PAGER_UTCB_ADDR - get_page_size(),
|
||||
get_page_size() * 3);
|
||||
|
||||
/* exclude utcb of echo thread + empty guard pages before and after */
|
||||
_core_mem_alloc.virt_alloc()->remove_range(Echo::ECHO_UTCB_ADDR - get_page_size(),
|
||||
get_page_size() * 3);
|
||||
|
||||
/* exclude utcb of main thread and hip + empty guard pages before and after */
|
||||
_core_mem_alloc.virt_alloc()->remove_range((addr_t)__main_thread_utcb - get_page_size(),
|
||||
get_page_size() * 4);
|
||||
|
||||
/* sanity checks */
|
||||
addr_t check [] = {
|
||||
reinterpret_cast<addr_t>(__main_thread_utcb), CORE_PAGER_UTCB_ADDR,
|
||||
Echo::ECHO_UTCB_ADDR,
|
||||
};
|
||||
|
||||
for (unsigned i = 0; i < sizeof(check) / sizeof(check[0]); i++) {
|
||||
if (Native_config::context_area_virtual_base() <= check[i] &&
|
||||
check[i] < Native_config::context_area_virtual_base() +
|
||||
Native_config::context_area_virtual_size())
|
||||
{
|
||||
PERR("overlapping area - [%lx, %lx) vs %lx",
|
||||
Native_config::context_area_virtual_base(),
|
||||
Native_config::context_area_virtual_base() +
|
||||
Native_config::context_area_virtual_size(), check[i]);
|
||||
nova_die();
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize core's physical-memory and I/O memory allocator */
|
||||
_io_mem_alloc.add_range(0, ~0xfff);
|
||||
_io_mem_alloc.add_range(0, ~0xfffUL);
|
||||
Hip::Mem_desc *mem_desc = (Hip::Mem_desc *)mem_desc_base;
|
||||
for (unsigned i = 0; i < num_mem_desc; i++, mem_desc++) {
|
||||
if (mem_desc->type != Hip::Mem_desc::AVAILABLE_MEMORY) continue;
|
||||
@ -339,10 +377,6 @@ Platform::Platform() :
|
||||
_rom_fs.insert(new (core_mem_alloc())
|
||||
Rom_module((addr_t)hip, get_page_size(), "hypervisor_info_page"));
|
||||
|
||||
/* configure non-core virtual address spaces as 2G-2G split */
|
||||
_vm_base = get_page_size();
|
||||
_vm_size = 2*1024*1024*1024UL - _vm_base;
|
||||
|
||||
/* I/O port allocator (only meaningful for x86) */
|
||||
_io_port_alloc.add_range(0, 0x10000);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user