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 ]

Diff markup

Differences between /sos/kmem_vmm.h (Article 8) and /sos/kmem_vmm.h (Article 5)


001 /* Copyright (C) 2000 Thomas Petazzoni            001 /* Copyright (C) 2000 Thomas Petazzoni
002    Copyright (C) 2004 David Decotigny             002    Copyright (C) 2004 David Decotigny
003                                                   003 
004    This program is free software; you can redi    004    This program is free software; you can redistribute it and/or
005    modify it under the terms of the GNU Genera    005    modify it under the terms of the GNU General Public License
006    as published by the Free Software Foundatio    006    as published by the Free Software Foundation; either version 2
007    of the License, or (at your option) any lat    007    of the License, or (at your option) any later version.
008                                                   008    
009    This program is distributed in the hope tha    009    This program is distributed in the hope that it will be useful,
010    but WITHOUT ANY WARRANTY; without even the     010    but WITHOUT ANY WARRANTY; without even the implied warranty of
011    MERCHANTABILITY or FITNESS FOR A PARTICULAR    011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012    GNU General Public License for more details    012    GNU General Public License for more details.
013                                                   013    
014    You should have received a copy of the GNU     014    You should have received a copy of the GNU General Public License
015    along with this program; if not, write to t    015    along with this program; if not, write to the Free Software
016    Foundation, Inc., 59 Temple Place - Suite 3    016    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
017    USA.                                           017    USA. 
018 */                                                018 */
019 #ifndef _SOS_KMEM_VMM_H_                          019 #ifndef _SOS_KMEM_VMM_H_
020 #define _SOS_KMEM_VMM_H_                          020 #define _SOS_KMEM_VMM_H_
021                                                   021 
022 /**                                               022 /**
023  * @file kmem_vmm.h                               023  * @file kmem_vmm.h
024  *                                                024  *
025  * Kernel Memory Allocator for multiple-page-s    025  * Kernel Memory Allocator for multiple-page-sized objects residing in
026  * the kernel (virtual memory) space. Relies o    026  * the kernel (virtual memory) space. Relies on the slab cache
027  * allocator to allocate its (internal) "range    027  * allocator to allocate its (internal) "range" data structure.
028  */                                               028  */
029                                                   029 
030 #include <hwcore/paging.h>                        030 #include <hwcore/paging.h>
031                                                   031 
032 /* The base and top virtual addresses covered     032 /* The base and top virtual addresses covered by the kernel allocator */
033 #define SOS_KMEM_VMM_BASE 0x4000 /* 16kB */       033 #define SOS_KMEM_VMM_BASE 0x4000 /* 16kB */
034 #define SOS_KMEM_VMM_TOP  SOS_PAGING_MIRROR_VA    034 #define SOS_KMEM_VMM_TOP  SOS_PAGING_MIRROR_VADDR /* 1GB - 4MB */
035                                                   035 
036 /** Opaque structure used internally and decla    036 /** Opaque structure used internally and declared here for physmem.h */
037 struct sos_kmem_range;                            037 struct sos_kmem_range;
038                                                   038 
039 #include <sos/kmem_slab.h>                        039 #include <sos/kmem_slab.h>
040                                                   040 
041 /**                                               041 /**
042  * Mark the areas belonging to SOS_KMEM_VMM_BA    042  * Mark the areas belonging to SOS_KMEM_VMM_BASE and SOS_KMEM_VMM_TOP
043  * are either used or free. Those that are alr    043  * are either used or free. Those that are already mapped are marked
044  * as "used", and the 0..SOS_KMEM_VMM_BASE vir    044  * as "used", and the 0..SOS_KMEM_VMM_BASE virtual addresses as marked
045  * as "used" too (to detect incorrect pointer     045  * as "used" too (to detect incorrect pointer dereferences).
046  */                                               046  */
047 sos_ret_t                                      !! 047 sos_ret_t sos_kmem_vmm_setup(sos_vaddr_t kernel_core_base,
048 sos_kmem_vmm_subsystem_setup(sos_vaddr_t kerne !! 048                              sos_vaddr_t kernel_core_top);
049                              sos_vaddr_t kerne << 
050                              sos_vaddr_t boots << 
051                              sos_vaddr_t boots << 
052                                                   049 
053                                                   050 
054 /*                                                051 /*
055  * Flags for kmem_vmm_new_range and kmem_vmm_a    052  * Flags for kmem_vmm_new_range and kmem_vmm_alloc
056  */                                               053  */
057 /** Physical pages should be immediately mappe    054 /** Physical pages should be immediately mapped */
058 #define SOS_KMEM_VMM_MAP    (1<<0)                055 #define SOS_KMEM_VMM_MAP    (1<<0)
059 /** Allocation should either success or fail,     056 /** Allocation should either success or fail, without blocking */
060 #define SOS_KMEM_VMM_ATOMIC (1<<1)                057 #define SOS_KMEM_VMM_ATOMIC (1<<1)
061                                                   058 
062 /**                                               059 /**
063  * Allocate a new kernel area spanning one or     060  * Allocate a new kernel area spanning one or multiple pages.
064  *                                                061  *
065  * @param range_base_vaddr If not NULL, the st    062  * @param range_base_vaddr If not NULL, the start address of the range
066  * is stored in this location                     063  * is stored in this location
067  * @eturn a new range structure                   064  * @eturn a new range structure
068  */                                               065  */
069 struct sos_kmem_range *sos_kmem_vmm_new_range(    066 struct sos_kmem_range *sos_kmem_vmm_new_range(sos_size_t  nb_pages,
070                                                   067                                               sos_ui32_t  flags,
071                                                   068                                               sos_vaddr_t *range_base_vaddr);
072 sos_ret_t sos_kmem_vmm_del_range(struct sos_km !! 069 sos_vaddr_t sos_kmem_vmm_del_range(struct sos_kmem_range *range);
073                                                   070 
074                                                   071 
075 /**                                               072 /**
076  * Straighforward variant of sos_kmem_vmm_new_    073  * Straighforward variant of sos_kmem_vmm_new_range() returning the
077  * range's start address instead of the range     074  * range's start address instead of the range structure
078  */                                               075  */
079 sos_vaddr_t sos_kmem_vmm_alloc(sos_size_t nb_p    076 sos_vaddr_t sos_kmem_vmm_alloc(sos_size_t nb_pages,
080                                sos_ui32_t flag    077                                sos_ui32_t flags);
081                                                   078 
082 /**                                               079 /**
083  * @note you are perfectly allowed to give the    080  * @note you are perfectly allowed to give the address of the
084  * kernel image, or the address of the bios ar    081  * kernel image, or the address of the bios area here, it will work:
085  * the kernel/bios WILL be "deallocated". But     082  * the kernel/bios WILL be "deallocated". But if you really want to do
086  * this, well..., do expect some "surprises" ;    083  * this, well..., do expect some "surprises" ;)
087  */                                               084  */
088 sos_ret_t sos_kmem_vmm_free(sos_vaddr_t vaddr) !! 085 sos_vaddr_t sos_kmem_vmm_free(sos_vaddr_t vaddr);
089                                                << 
090                                                << 
091 /**                                            << 
092  * @return TRUE when vaddr is covered by any ( << 
093  */                                            << 
094 sos_bool_t sos_kmem_vmm_is_valid_vaddr(sos_vad << 
095                                                   086 
096                                                   087 
097 /* *****************************                  088 /* *****************************
098  * Reserved to kmem_slab.c ONLY.                  089  * Reserved to kmem_slab.c ONLY.
099  */                                               090  */
100 /**                                               091 /**
101  * Associate the range with the given slab.       092  * Associate the range with the given slab.
102  */                                               093  */
103 sos_ret_t sos_kmem_vmm_set_slab(struct sos_kme    094 sos_ret_t sos_kmem_vmm_set_slab(struct sos_kmem_range *range,
104                                 struct sos_ksl    095                                 struct sos_kslab *slab);
105                                                   096 
106 /**                                               097 /**
107  * Retrieve the (used) slab associated with th !! 098  * Retrieve the slab associated with the
                                                   >> 099  * range covering vaddr.
108  *                                                100  *
109  * @return NULL if the range is not associated    101  * @return NULL if the range is not associated with a KMEM range
110  */                                               102  */
111 struct sos_kslab *sos_kmem_vmm_resolve_slab(so    103 struct sos_kslab *sos_kmem_vmm_resolve_slab(sos_vaddr_t vaddr);
112                                                   104 
113 #endif /* _SOS_KMEM_VMM_H_ */                     105 #endif /* _SOS_KMEM_VMM_H_ */
                                                      

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