rusty_mos::kernel::syscall_impl

Function sys_mem_alloc

Source
fn sys_mem_alloc(envid: u32, va: u32, perm: u32) -> u32
Expand description

SYSNO: 6, alloc a page and map it to va.

The perm is used when insert the page alloced into the env’s page table.

Only the current env or the child of the current env can be allocated.

If va is already mapped, that original page is sliently unmapped.

§Failure

This syscall will return a negated-KError returned by envid2env, page_alloc and page_insert.

For example, the envid is not allowed or the pages are ran out.