5.1.1 System Memory Allocation
- ER tk_get_smb( VP *addr, INT nblk, UINT attr )
Allocates a memory space of a size accommodating the number of contiguous memory blocks specified in nblk, and having the attributes specified in attr. The start address of the allocated memory space is returned in addr.
attr := (TA_RNG0 || TA_RNG1 || TA_RNG2 || TA_RNG3) | [TA_NORESIDENT]
#define TA_NORESIDENT 0x00000010 /* nonresident */
#define TA_RNG0 0x00000000 /* protection level 0 */
#define TA_RNG1 0x00000100 /* protection level 1 */
#define TA_RNG2 0x00000200 /* protection level 2 */
#define TA_RNG3 0x00000300 /* protection level 3 */
The acquired memory does not belong to a resource group. If memory could not be allocated, E_NOMEM is returned.
- ER tk_rel_smb( VP addr )
Releases the memory specified by the start address addr. addr must be the address obtained by tk_get_smb.
- ER tk_ref_smb( T_RSMB *pk_rsmb )
Gets information about system memory.
typedef struct t_rsmb {
INT blksz; /* block size (in bytes) */
INT total; /* total block count */
INT free; /* remaining free block count */
/* Implementation-dependent information may be added beyond this point.*/
} T_RSMB;
When virtual memory is used, there may be cases where the total block and remaining free block counts cannot be decided unequivocally. In such cases the contents of total and free are implementation-dependent, but preferably they should be values such that free ÷ total gives a useful estimate of the remaining memory capacity.

Comments