Changeset 683 for trunk/kernel/libk/elf.c
- Timestamp:
- Jan 13, 2021, 12:36:17 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/elf.c
r671 r683 161 161 { 162 162 type = VSEG_TYPE_CODE; 163 process->vmm.code_vpn_base = vbase >> CONFIG_PPM_PAGE_ SHIFT;163 process->vmm.code_vpn_base = vbase >> CONFIG_PPM_PAGE_ORDER; 164 164 } 165 165 else // found DATA segment 166 166 { 167 167 type = VSEG_TYPE_DATA; 168 process->vmm.data_vpn_base = vbase >> CONFIG_PPM_PAGE_ SHIFT;168 process->vmm.data_vpn_base = vbase >> CONFIG_PPM_PAGE_ORDER; 169 169 } 170 170 … … 215 215 { 216 216 uint32_t new_offset; // unused, required by vfs_lseek() 217 kmem_req_t req; // kmem request for program header218 217 Elf_Ehdr header; // local buffer for .elf header 219 218 void * segs_base; // pointer on buffer for segment descriptors array … … 278 277 279 278 // allocate memory for segment descriptors array 280 req.type = KMEM_KCM; 281 req.order = bits_log2(segs_size); 282 req.flags = AF_KERNEL; 283 segs_base = kmem_alloc( &req ); 279 segs_base = kmem_alloc( bits_log2(segs_size) , AF_NONE ); 284 280 285 281 if( segs_base == NULL ) … … 295 291 { 296 292 printk("\n[ERROR] in %s : cannot seek for descriptors array\n", __FUNCTION__ ); 297 req.ptr = segs_base; 298 kmem_free( &req ); 293 kmem_free( segs_base , bits_log2(segs_size) ); 299 294 return -1; 300 295 } … … 314 309 { 315 310 printk("\n[ERROR] in %s : cannot read segments descriptors\n", __FUNCTION__ ); 316 req.ptr = segs_base; 317 kmem_free( &req ); 311 kmem_free( segs_base , bits_log2(segs_size) ); 318 312 return -1; 319 313 } … … 331 325 if( error ) 332 326 { 333 req.ptr = segs_base;334 kmem_free( &req);327 printk("\n[ERROR] in %s : cannot register segments descriptors\n", __FUNCTION__ ); 328 kmem_free( segs_base , bits_log2(segs_size) ); 335 329 return -1; 336 330 } … … 343 337 344 338 // release allocated memory for program header 345 req.ptr = segs_base; 346 kmem_free(&req); 339 kmem_free( segs_base , bits_log2(segs_size) ); 347 340 348 341 #if DEBUG_ELF_LOAD
Note: See TracChangeset
for help on using the changeset viewer.