KernelTestFramework / ktf

Kernel Test Framework
BSD 2-Clause "Simplified" License
140 stars 18 forks source link

[Feature] Separate address space support for tasks and contexts #320

Open wipawel opened 10 months ago

wipawel commented 10 months ago

Is your feature request related to a problem? Please describe.

Currently there are only two address spaces implemented in KTF: kernel context (shared by BSP context and all kernel tasks) and a user context used by usermode tasks. This works fine unless we need to add modifications to the address spaces from within different tasks and limit the changes visibility to those contexts only (I.e. we need tests with independent address spaces). Also different usermode tasks may need different address spaces for similar reasons.

Describe the solution you'd like

Keep current kernel context page tables as a BSP context address space and use it as a starting references for kernel tasks address spaces. Upon task creation create a new address space with references in the task struct and duplicate the reference BSP page tables by allocating new frames for everything (maybe except from page structure tables with all entries marked as global). Keep the current user context page tables as a reference for all new usermode tasks and duplicate them the same way like the kernel context page tables.