mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 10:53:16 +01:00
Pager struct allocated from boot memory and never referenced after boot.
We still have to have the pager structs because they possess intermediate data during boot up such as for transferring of capability lists to boot stack one-by-one, and then to newly generated ktcbs.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <l4/generic/resource.h>
|
||||
#include <l4/generic/capability.h>
|
||||
#include <l4/generic/cap-types.h>
|
||||
#include <l4/generic/bootmem.h>
|
||||
#include <l4/api/errno.h>
|
||||
#include INC_GLUE(memory.h)
|
||||
#include INC_SUBARCH(mm.h)
|
||||
@@ -25,6 +26,8 @@ int container_init(struct container *c)
|
||||
cap_list_init(&c->cap_list);
|
||||
|
||||
/* Init pager structs */
|
||||
c->pager = alloc_bootmem(sizeof(c->pager[0]) *
|
||||
CONFIG_MAX_PAGERS_USED, 0);
|
||||
for (int i = 0; i < CONFIG_MAX_PAGERS_USED; i++)
|
||||
cap_list_init(&c->pager[i].cap_list);
|
||||
|
||||
|
||||
@@ -319,6 +319,7 @@ int memcap_map(struct cap_list *cap_list,
|
||||
/* Delete all boot memory and add it to physical memory pool. */
|
||||
int free_boot_memory(struct kernel_resources *kres)
|
||||
{
|
||||
struct container *c;
|
||||
unsigned long pfn_start =
|
||||
__pfn(virt_to_phys(_start_init));
|
||||
unsigned long pfn_end =
|
||||
@@ -334,6 +335,10 @@ int free_boot_memory(struct kernel_resources *kres)
|
||||
for (unsigned long i = pfn_start; i < pfn_end; i++)
|
||||
remove_mapping(phys_to_virt(__pfn_to_addr(i)));
|
||||
|
||||
/* Reset pointers that will remain in system as precaution */
|
||||
list_foreach_struct(c, &kres->containers.list, list)
|
||||
c->pager = 0;
|
||||
|
||||
printk("%s: Freed %lu KB init memory.\n",
|
||||
__KERNELNAME__,
|
||||
__pfn_to_addr((pfn_end - pfn_start)) / 1024);
|
||||
|
||||
Reference in New Issue
Block a user