Closed NewDwarf closed 10 months ago
A mobj
is an abstraction of a memory object: shared memory, TA exec or read/write memory, FFA memory reference, etc... It is a convenient way to bind operations (map/unmap w/ refcount, get phys. addr./memroy type, ...) under a common API: consumers manipulate a mobj
reference instead of a virtual address reference.
An fobj
is a file abstraction for the content represented by a memory object. It is mainly designed for OP-TEE pager, for the page swapping mechanism. Elfloader also uses the fobj
abstraction for ELF content loading of secure userland code/data (unless i missed somthing).
Due to pager constraint on the system, OP-TEE core needs a specific sequence to allocate external secure memory that you will find at several places (_ldelfloader.c, _ldelfsyscalls.c, _stmmsp.c, _securepartition.c):
tee_mm_sec_ddr
/TA_RAM using fobj = fobj_ta_mem_alloc(page_count)
;mobj = mobj_with_fobj_alloc(fobj, ...); fobj_put(fobj);
;va = vm_map(..., mobj, ...); mobj_put(mobj);
;vm_unmap(..., va, ...)
(unless there are several users).
What are the main purposes of
mobj
andfobj
abstraction from the OP-TEE design perspective? It is interesting to know how they help to orginize the OP-TEE design and how difficult/inconvenient would be developing of OP-TEE in the case of missedmobj
andfobj
abstraction.