SimpleOS

LXR

Navigation



Site hébergé par : enix

The LXR Cross Referencer for SOS

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Article:1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 6.5 ] [ 7 ] [ 7.5 ] [ 8 ] [ 9 ] [ 9.5 ]

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_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.
047  *
048  * @param size  The size of the object
049  * @param flags The allocation flags (SOS_KMALLOC_* flags)
050  */
051 sos_vaddr_t sos_kmalloc(sos_size_t size, sos_ui32_t flags);
052 
053 /**
054  * @note you are perfectly allowed to give the address of the
055  * kernel image, or the address of the bios area here, it will work:
056  * the kernel/bios WILL be "deallocated". But if you really want to do
057  * this, well..., do expect some "surprises" ;)
058  */
059 sos_ret_t sos_kfree(sos_vaddr_t vaddr);
060 
061 #endif /* _SOS_KMALLOC_H_ */

source navigation ] diff markup ] identifier search ] general search ]