Hi,

 

During looking into the source code of v_insert() function in mem_space-arm.cpp file, I found two cases where it returns improper Mem_space::Status.

 

Case #1

When the size parameter of v_insert() is 0x100000 (that is, section mapping is asked), and the entry in the corresponding first-level page table indicates a coarse second-level page table (that is, it’s already valid) and only the entry in the second-level table is invalid:
v_insert() function returns Insert_OK status.
But it seems proper to return Insert_err_exists because there is already valid entry and inserting a new entry fails.

 

Case #2

When the size parameter of v_insert() is 0x1000 (that is, 4KB small page mapping is asked), and the memory allocation for creating a coarse second-level page table fails in Page_table::walk() function:  
v_insert() returns Insert_OK status.
But it seems proper to return Insert_err_nomem because due to memory shortage inserting a new entry fails.
 
I wonder my understanding is right.
 
Cheers,
 
Junghyun Yoo