gonzui


Format: Advanced Search

tkernel_2/include/sys/imalloc.hbare sourcepermlink (0.00 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T-Kernel 2.0 Software Package
    4:  *
    5:  *    Copyright 2011 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
   10:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   11:  *
   12:  *----------------------------------------------------------------------
   13:  */
   14: 
   15: /*
   16:  *      @(#)imalloc.h (sys)
   17:  *
   18:  *      Kernel memory allocation
   19:  *
   20:  *      A function for allocating memory used in parts of T-Kernel.
   21:  *      Not for general use.
   22:  */
   23: 
   24: #ifndef __SYS_IMALLOC_H__
   25: #define __SYS_IMALLOC_H__
   26: 
   27: #include <basic.h>
   28: #include <tk/typedef.h>
   29: #include <tk/sysmgr.h>
   30: 
   31: #ifdef __cplusplus
   32: extern "C" {
   33: #endif
   34: 
   35: /*
   36:  * Allocates resident memory which has the lowest protection
   37:  * level (TSCVLimit) in which level where a T-Kernel system call
   38:  * can be issued.
   39:  */
   40: IMPORT void* Imalloc( size_t size );
   41: IMPORT void* Icalloc( size_t nmemb, size_t size );
   42: IMPORT void  Ifree( void *ptr );
   43: 
   44: /*
   45:  * Allocates memory with the attributes specified in 'attr'.
   46:  *      attr = TA_RNGn | TA_NORESIDENT
   47:  */
   48: IMPORT void* IAmalloc( size_t size, UINT attr );
   49: IMPORT void* IAcalloc( size_t nmemb, size_t size, UINT attr );
   50: IMPORT void  IAfree( void *ptr, UINT attr );
   51: 
   52: /*
   53:  * In all cases, malloc and calloc cannot be called while interrupt or
   54:  * dispatch are disabled.
   55:  * Only free can always be called while interrupt or dispatch are
   56:  * disabled; however memory release may not complete. For this reason,
   57:  * it is preferable to issue the call when interrupt and dispatch are
   58:  * both enabled.
   59:  * If release has not completed, the area is allocated in accordance
   60:  * with the subsequent
   61:  * malloc and calloc.
   62: */
   63: 
   64: /* ------------------------------------------------------------------------ */
   65: 
   66: /*
   67:  * System memory management in block units
   68:  */
   69: IMPORT void* GetSysMemBlk( INT nblk, UINT attr );
   70: IMPORT ER RelSysMemBlk( CONST void *addr );
   71: IMPORT ER RefSysMemInfo( T_RSMB *rsmb );
   72: 
   73: #ifdef __cplusplus
   74: }
   75: #endif
   76: #endif /* __SYS_IMALLOC_H__ */