/* * A test that tries to allocate a memory region above an address that is too * close to the end of the memory: * * + + * | +--------+---+ | * | | rgn + | | * +-----------+--------+---+------+ * ^ ^ * | | * | min_addr * | * Aligned address * boundary * * Expect to prioritize granting memory over satisfying the minimal address * requirement.
*/ staticint alloc_from_top_down_high_addr_check(void)
{ struct memblock_region *rgn = &memblock.reserved.regions[0]; void *allocated_ptr = NULL;
phys_addr_t size = SZ_32;
phys_addr_t min_addr;
PREFIX_PUSH();
setup_memblock();
/* The address is too close to the end of the memory */
min_addr = memblock_end_of_DRAM() - SZ_16;
/* * A test that tries to allocate a memory region when there is no space * available above the minimal address above a certain address: * * + * | +---------+-------------| * | | rgn | | * +--------+---------+-------------+ * ^ * | * min_addr * * Expect to prioritize granting memory over satisfying the minimal address * requirement and to allocate next to the previously reserved region. The * regions get merged into one.
*/ staticint alloc_from_top_down_no_space_above_check(void)
{ struct memblock_region *rgn = &memblock.reserved.regions[0]; void *allocated_ptr = NULL;
phys_addr_t r1_size = SZ_64;
phys_addr_t r2_size = SZ_2;
phys_addr_t total_size = r1_size + r2_size;
phys_addr_t min_addr;
/* * A test that tries to allocate a memory region with a minimal address below * the start address of the available memory. As the allocation is top-down, * first reserve a region that will force allocation near the start. * Expect successful allocation and merge of both regions.
*/ staticint alloc_from_top_down_min_addr_cap_check(void)
{ struct memblock_region *rgn = &memblock.reserved.regions[0]; void *allocated_ptr = NULL;
phys_addr_t r1_size = SZ_64;
phys_addr_t min_addr;
phys_addr_t start_addr;
/* * A test that tries to allocate a memory region above an address that is too * close to the end of the memory: * * + * |-----------+ + | * | rgn | | | * +-----------+--------------+-----+ * ^ ^ * | | * Aligned address min_addr * boundary * * Expect to prioritize granting memory over satisfying the minimal address * requirement. Allocation happens at beginning of the available memory.
*/ staticint alloc_from_bottom_up_high_addr_check(void)
{ struct memblock_region *rgn = &memblock.reserved.regions[0]; void *allocated_ptr = NULL;
phys_addr_t size = SZ_32;
phys_addr_t min_addr;
PREFIX_PUSH();
setup_memblock();
/* The address is too close to the end of the memory */
min_addr = memblock_end_of_DRAM() - SZ_8;
/* * A test that tries to allocate a memory region when there is no space * available above the minimal address above a certain address: * * + * |-----------+ +-------------------| * | rgn | | | * +-----------+----+-------------------+ * ^ * | * min_addr * * Expect to prioritize granting memory over satisfying the minimal address * requirement and to allocate at the beginning of the available memory.
*/ staticint alloc_from_bottom_up_no_space_above_check(void)
{ struct memblock_region *rgn = &memblock.reserved.regions[0]; void *allocated_ptr = NULL;
phys_addr_t r1_size = SZ_64;
phys_addr_t min_addr;
phys_addr_t r2_size;
/* * A test that tries to allocate a memory region with a minimal address below * the start address of the available memory. Expect to allocate a region * at the beginning of the available memory.
*/ staticint alloc_from_bottom_up_min_addr_cap_check(void)
{ struct memblock_region *rgn = &memblock.reserved.regions[0]; void *allocated_ptr = NULL;
phys_addr_t r1_size = SZ_64;
phys_addr_t min_addr;
phys_addr_t start_addr;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.