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