# kmalloc.h

Go to the documentation of this file.

    00001 /*****************************************************************************************
    00002  Copyright (c) 2002-2004 The UbixOS Project
    00003  All rights reserved.
    00004
    00005  Redistribution and use in source and binary forms, with or without modification, are
    00006  permitted provided that the following conditions are met:
    00007
    00008  Redistributions of source code must retain the above copyright notice, this list of
    00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
    00010  form must reproduce the above copyright notice, this list of conditions, the following
    00011  disclaimer and the list of authors in the documentation and/or other materials provided
    00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
    00013  contributors may be used to endorse or promote products derived from this software
    00014  without specific prior written permission.
    00015
    00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
    00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
    00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
    00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00025
    00026  $Id: kmalloc_8h-source.html 88 2016-01-12 00:11:29Z reddawg $
    00027
    00028 *****************************************************************************************/
    00029
    00030 #ifndef _KMALLOC_H
    00031 #define _KMALLOC_H
    00032
    00033 #include <ubixos/types.h>
    00034
    00035 #ifdef __cplusplus
    00036 extern "C" {
    00037 #endif
    00038
    00039 #define sysID      -2
    00040 #define MALLOC_ALIGN_SIZE  32
    00041 #define MALLOC_ALIGN(size) (size + ((((size) % (MALLOC_ALIGN_SIZE)) == 0)? 0 : ((MALLOC_ALIGN_SIZE) - ((size) % (MALLOC_ALIGN_SIZE)))))
    00042
    00043 struct memDescriptor {
    00044   struct memDescriptor *prev;        //4
    00045   struct memDescriptor *next;        //4
    00046   void                 *baseAddr;    //4
    00047   uInt32               limit;        //4
    00048   /*uInt8                status;       //1  */
    00049   /*char                 reserved[11]; //11 */
    00050   };
    00051
    00052 void kfree(void *baseAddr);
    00053 void *kmalloc(uInt32 len);
    00054
    00055 #ifdef __cplusplus
    00056  }
    00057 #endif
    00058
    00059 #endif
    00060
    00061 /***
    00062  $Log: kmalloc_8h-source.html,v $
    00062  Revision 1.7  2006/12/15 17:47:06  reddawg
    00062  Updates
    00062
    00063  Revision 1.1.1.1  2006/06/01 12:46:13  reddawg
    00064  ubix2
    00065
    00066  Revision 1.2  2005/10/12 00:13:36  reddawg
    00067  Removed
    00068
    00069  Revision 1.1.1.1  2005/09/26 17:23:40  reddawg
    00070  no message
    00071
    00072  Revision 1.7  2004/09/14 20:57:01  reddawg
    00073  Bug fixes: macro problem over opt a multiply
    00074
    00075  Revision 1.6  2004/07/21 10:02:09  reddawg
    00076  devfs: renamed functions
    00077  device system: renamed functions
    00078  fdc: fixed a few potential bugs and cleaned up some unused variables
    00079  strol: fixed definition
    00080  endtask: made it print out freepage debug info
    00081  kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost
    00082  ld: fixed a pointer conversion
    00083  file: cleaned up a few unused variables
    00084  sched: broke task deletion
    00085  kprintf: fixed ogPrintf definition
    00086
    00087  Revision 1.5  2004/07/19 02:08:27  reddawg
    00088  Cleaned out the rest of debuging code also temporarily disabled the ip stack to improve boot time
    00089
    00090  Revision 1.4  2004/07/18 05:24:15  reddawg
    00091  Fixens
    00092
    00093  Revision 1.3  2004/05/21 15:00:27  reddawg
    00094  Cleaned up
    00095
    00096  END
    00097  ***/