Changeset 18 for trunk/kernel/mm/kmem.c
- Timestamp:
- Jun 3, 2017, 4:42:49 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/kmem.c
r14 r18 63 63 if( kcm != NULL ) 64 64 { 65 if( index == kcm->type ) 65 if( index == kcm->type ) 66 66 { 67 67 printk(" - KCM[%s] (at address %x) is OK\n", 68 68 kmem_type_str( index ) , (intptr_t)kcm ); 69 69 } 70 else 70 else 71 71 { 72 72 printk(" - KCM[%s] (at address %x) is KO : has type %s\n", 73 73 kmem_type_str( index ) , (intptr_t)kcm , kmem_type_str( kcm->type ) ); 74 } 74 } 75 75 } 76 76 } … … 100 100 else if( type == KMEM_SEM ) return sizeof( remote_sem_t ); 101 101 else return 0; 102 } 102 } 103 103 104 104 ///////////////////////////////////// … … 121 121 else if( type == KMEM_VFS_CTX ) return "KMEM_VFS_CTX"; 122 122 else if( type == KMEM_VFS_INODE ) return "KMEM_VFS_INODE"; 123 else if( type == KMEM_VFS_DENTRY ) return "KMEM_VFS_DENTRY"; 123 else if( type == KMEM_VFS_DENTRY ) return "KMEM_VFS_DENTRY"; 124 124 else if( type == KMEM_VFS_FILE ) return "KMEM_VFS_FILE"; 125 125 else if( type == KMEM_SEM ) return "KMEM_SEM"; … … 153 153 } 154 154 155 // initializes the new KCM allocator 155 // initializes the new KCM allocator 156 156 kcm_init( kcm , type ); 157 157 … … 168 168 } // end kmem_create_kcm() 169 169 170 170 171 171 172 172 ///////////////////////////////////// … … 184 184 size = req->size; 185 185 flags = req->flags; 186 186 187 187 assert( (type < KMEM_TYPES_NR) , __FUNCTION__ , "illegal KMEM request type" ); 188 188 189 189 kmem_dmsg("\n[INFO] %s : enters in cluster %x for type %s / size %d\n", 190 190 __FUNCTION__ , local_cxy , kmem_type_str( type ) , size ); … … 192 192 // analyse request type 193 193 if( type == KMEM_PAGE ) // PPM allocator 194 { 194 { 195 195 // allocate the number of requested pages 196 196 ptr = (void *)ppm_alloc_pages( size ); … … 198 198 // reset page if required 199 199 if( flags & AF_ZERO ) page_zero( (page_t *)ptr ); 200 200 201 201 kmem_dmsg("\n[INFO] %s : exit in cluster %x for type %s / page = %x / base = %x\n", 202 __FUNCTION__, local_cxy , kmem_type_str( type ) , 202 __FUNCTION__, local_cxy , kmem_type_str( type ) , 203 203 (intptr_t)ptr , (intptr_t)ppm_page2base( ptr ) ); 204 204 } … … 218 218 // initialize the KCM allocator if not already done 219 219 if( cluster->kcm_tbl[type] == NULL ) 220 { 220 { 221 221 spinlock_lock( &cluster->kcm_lock ); 222 222 error_t error = kmem_create_kcm( type ); … … 225 225 } 226 226 227 // allocate memory from KCM 227 // allocate memory from KCM 228 228 ptr = kcm_alloc( cluster->kcm_tbl[type] ); 229 229 … … 237 237 if( ptr == NULL ) 238 238 { 239 printk("\n[ERROR] in %s : failed for type %d / size %d in cluster %x\n", 239 printk("\n[ERROR] in %s : failed for type %d / size %d in cluster %x\n", 240 240 __FUNCTION__ , type , size , local_cxy ); 241 241 242 242 return NULL; 243 243 } … … 255 255 hal_core_sleep(); 256 256 } 257 257 258 258 switch(req->type) 259 259 {
Note: See TracChangeset
for help on using the changeset viewer.