microkit icon indicating copy to clipboard operation
microkit copied to clipboard

Patch page tables of child PD's into their parent

Open Kswin01 opened this issue 5 months ago • 0 comments

This PR adds support for patching a copy of a child PD's page tables into the parent.

We add an extra attribute to the protection domain xml tag, if set to true, the child page tables will be added into the parent.

We create a vector for all potential child page tables, with the length of the total amount of PDs in the system. This vector is a vector of 64 references to potential PGD's of potential child PDs. If the above tag is set to true, we will go through the current elf segments, memory regions and the ipc buffer associated with each of the child PDs, and create a copy of this paging structure and add to the above vector. At this point, the underlying frame caps haven't been allocated. We will add a blank elf segment, .table_data to the parent elf at this point, of the correct size that we have calculated from creating these paging structures.

Later on when these frame caps have been allocated, its a simple matter of filling in the already create paging structures. To make this simpler, we have added some helper structs and functions in lib.rs. I'm not sure if this is the best place for this code to live.

We then populate the elf segment we created before with these complete paging structures. Additionally we patch a struct variable into the parent containing the base address of this new segment, as well as an array of 64 pointers into this region that are the start of the PGD of each child. We haven't added this struct to the microkit header, so it is therefore up to the user to define this structure. Please let me know if we should add this to microkit.h instead. The entries in this table are pointers to the next level tables, or the frame cap. We support both large and small pages. This has been tested on aarch64, but should also work on RISCV64 provided that the address are Sv48 (48bit addressing) we don't actually use . The caps to the underlying frames are also minted into the parent's cspace.

Additionally, we extend the current elf library in the microkit tool to be able to create and populate new segments to the in-memory copy of the supplied elf's.

Please feel free to provide any feedback!

Kswin01 avatar Jul 17 '25 06:07 Kswin01