Expand description
Core methods for the env module.
Structs§
- The PCB struct. Compatible with the C-Like memory structure and the MOS.
- Wrapper to make it aligned to a page.
- The IPC data collected together. Compatible with the C-Like memory structure.
Enums§
- The env status enum. Compatible with the C-Like memory structure.
Constants§
- The log of NENV.
- The count of the envs.
Statics§
- Bitmap for the asid allocatoin.
- The global pgdir.
- The current env.
- The envs array in kernel, mapped to the UENVS and used by the user program.
- Free env list.
- ENV_I 🔒The static variable used by mkenvid;
- Runnable env list.
Functions§
- Alloc a new asid. Return an error if there is no asid remained.
- Free an asid.
- Alloc an
envand setup its vm and PCB. - Create an env and load the icode, set the priority. For tests mainly.
- Destory an env and free it. Re-schedule will be performed.
- Free an env, and remove all its pages. The TLB will be flushed after the deletion of pages.
- Init the env environment. Put the envs into the free list, and map the PAGES and ENVS to base_pgdir’s UPAGES and UENVS accordingly.
- Recover from exception, load the specified TrapFrame.
- Run the env. Save the current env’s trapframe if it exists.
- Setup the virtual memory of the new-born env.
- Get the env’s PCB by its id. If
checkpermis set, the method will check whether the env just is the current env or the child of it. If not, KError::BadEnv will be returned with aErrwrapper. - Load the icode for the
e. - Map the [va, va + size) in virtual address space to the [pa, pa + size) in physical address space if
pgdir. This method will validate the entry perm. - mkenvid 🔒Get the envid with the env node.