|
[ source navigation ] [ diff markup ] [ identifier search ] [ general search ] |
|||
|
001 /* Copyright (C) 2004 David Decotigny 002 003 This program is free software; you can redistribute it and/or 004 modify it under the terms of the GNU General Public License 005 as published by the Free Software Foundation; either version 2 006 of the License, or (at your option) any later version. 007 008 This program is distributed in the hope that it will be useful, 009 but WITHOUT ANY WARRANTY; without even the implied warranty of 010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 011 GNU General Public License for more details. 012 013 You should have received a copy of the GNU General Public License 014 along with this program; if not, write to the Free Software 015 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 016 USA. 017 */ 018 #ifndef _SOS_KMALLOC_H_ 019 #define _SOS_KMALLOC_H_ 020 021 /** 022 * @file kmalloc.h 023 * 024 * Simple malloc-style wrapper to kmem_vmm.h and kmem_slab.h for 025 * "anonymous" objects (ie not associated to any precise slab cache). 026 */ 027 028 #include <sos/types.h> 029 #include <sos/errno.h> 030 031 032 /** 033 * Iniatilize the kmalloc subsystem, ie pre-allocate a series of caches. 034 */ 035 sos_ret_t sos_kmalloc_subsystem_setup(void); 036 037 /* 038 * sos_kmalloc flags 039 */ 040 /** sos_kmalloc() should succeed without blocking, or return NULL */ 041 #define SOS_KMALLOC_ATOMIC 1 042 043 /** 044 * Allocate a kernel object of the given size in the most suited slab 045 * cache if size can be handled by one of the pre-allocated caches, or 046 * using directly the range allocator otherwise. The object will 047 * allways be mapped in physical memory (ie implies 048 * SOS_KSLAB_CREATE_MAP and SOS_KMEM_VMM_MAP). 049 * 050 * @param size The size of the object 051 * @param flags The allocation flags (SOS_KMALLOC_* flags) 052 */ 053 sos_vaddr_t sos_kmalloc(sos_size_t size, sos_ui32_t flags); 054 055 /** 056 * @note you are perfectly allowed to give the address of the 057 * kernel image, or the address of the bios area here, it will work: 058 * the kernel/bios WILL be "deallocated". But if you really want to do 059 * this, well..., do expect some "surprises" ;) 060 */ 061 sos_ret_t sos_kfree(sos_vaddr_t vaddr); 062 063 #endif /* _SOS_KMALLOC_H_ */
[ source navigation ] | [ diff markup ] | [ identifier search ] | [ general search ] |