Changeset 7473807 in mainline
- Timestamp:
- 2018-05-11T20:22:42Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d2c5159
- Parents:
- ae89656
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia64/src/ddi/ddi.c
rae89656 r7473807 56 56 { 57 57 if (!task->arch.iomap) { 58 task->arch.iomap = malloc(sizeof(bitmap_t), 0);58 task->arch.iomap = malloc(sizeof(bitmap_t), FRAME_ATOMIC); 59 59 if (task->arch.iomap == NULL) 60 60 return ENOMEM; 61 61 62 void *store = malloc(bitmap_size(IO_MEMMAP_PAGES), 0); 62 void *store = malloc(bitmap_size(IO_MEMMAP_PAGES), 63 FRAME_ATOMIC); 63 64 if (store == NULL) 64 65 return ENOMEM; -
kernel/genarch/src/drivers/ega/ega.c
rae89656 r7473807 609 609 } 610 610 611 instance->backbuf = (uint8_t *) malloc(EGA_VRAM_SIZE, 0);611 instance->backbuf = (uint8_t *) malloc(EGA_VRAM_SIZE, FRAME_ATOMIC); 612 612 if (!instance->backbuf) { 613 613 LOG("Unable to allocate backbuffer."); -
kernel/genarch/src/fb/fb.c
rae89656 r7473807 618 618 } 619 619 620 instance->backbuf = (uint16_t *) malloc(bbsize, 0);620 instance->backbuf = (uint16_t *) malloc(bbsize, FRAME_ATOMIC); 621 621 if (!instance->backbuf) { 622 622 LOG("Unable to allocate backbuffer."); … … 626 626 } 627 627 628 instance->glyphs = (uint8_t *) malloc(glyphsize, 0);628 instance->glyphs = (uint8_t *) malloc(glyphsize, FRAME_ATOMIC); 629 629 if (!instance->glyphs) { 630 630 LOG("Unable to allocate glyphs."); … … 635 635 } 636 636 637 instance->bgscan = malloc(instance->bgscanbytes, 0);637 instance->bgscan = malloc(instance->bgscanbytes, FRAME_ATOMIC); 638 638 if (!instance->bgscan) { 639 639 LOG("Unable to allocate background pixel."); -
kernel/generic/include/synch/rcu.h
rae89656 r7473807 55 55 * 56 56 * // Insert at the beginning of the list. 57 * exam_t *my_exam = malloc(sizeof(exam_t), 0);57 * exam_t *my_exam = malloc(sizeof(exam_t), FRAME_ATOMIC); 58 58 * my_exam->grade = 5; 59 59 * my_exam->next = exam_list; -
kernel/generic/src/console/cmd.c
rae89656 r7473807 1465 1465 return true; 1466 1466 1467 uint64_t *data = (uint64_t *) malloc(sizeof(uint64_t) * cnt, 0); 1467 uint64_t *data = (uint64_t *) malloc(sizeof(uint64_t) * cnt, 1468 FRAME_ATOMIC); 1468 1469 if (data == NULL) { 1469 1470 printf("Error allocating memory for statistics\n"); -
kernel/generic/src/console/console.c
rae89656 r7473807 411 411 412 412 if (size > 0) { 413 data = (char *) malloc(size + 1, 0);413 data = (char *) malloc(size + 1, FRAME_ATOMIC); 414 414 if (!data) 415 415 return (sys_errno_t) ENOMEM; -
kernel/generic/src/console/kconsole.c
rae89656 r7473807 298 298 end++; 299 299 300 tmp = malloc(STR_BOUNDS(end - start + 1), 0); 300 tmp = malloc(STR_BOUNDS(end - start + 1), FRAME_ATOMIC); 301 if (!tmp) 302 return NULL; 301 303 302 304 wstr_to_str(tmp, end - start + 1, &cmdline[start]); -
kernel/generic/src/ipc/irq.c
rae89656 r7473807 82 82 { 83 83 /* Copy the physical base addresses aside. */ 84 uintptr_t *pbase = malloc(rangecount * sizeof(uintptr_t), 0); 84 uintptr_t *pbase = malloc(rangecount * sizeof(uintptr_t), FRAME_ATOMIC); 85 if (!pbase) 86 return ENOMEM; 85 87 for (size_t i = 0; i < rangecount; i++) 86 88 pbase[i] = ranges[i].base; … … 225 227 irq_cmd_t *cmds = NULL; 226 228 227 irq_code_t *code = malloc(sizeof(*code), 0); 229 irq_code_t *code = malloc(sizeof(*code), FRAME_ATOMIC); 230 if (!code) 231 return NULL; 228 232 errno_t rc = copy_from_uspace(code, ucode, sizeof(*code)); 229 233 if (rc != EOK) … … 234 238 goto error; 235 239 236 ranges = malloc(sizeof(code->ranges[0]) * code->rangecount, 0); 240 ranges = malloc(sizeof(code->ranges[0]) * code->rangecount, 241 FRAME_ATOMIC); 242 if (!ranges) 243 goto error; 237 244 rc = copy_from_uspace(ranges, code->ranges, 238 245 sizeof(code->ranges[0]) * code->rangecount); … … 240 247 goto error; 241 248 242 cmds = malloc(sizeof(code->cmds[0]) * code->cmdcount, 0); 249 cmds = malloc(sizeof(code->cmds[0]) * code->cmdcount, FRAME_ATOMIC); 250 if (!cmds) 251 goto error; 243 252 rc = copy_from_uspace(cmds, code->cmds, 244 253 sizeof(code->cmds[0]) * code->cmdcount); -
kernel/generic/src/ipc/ops/dataread.c
rae89656 r7473807 75 75 IPC_SET_ARG1(answer->data, dst); 76 76 77 answer->buffer = malloc(size, 0); 77 answer->buffer = malloc(size, FRAME_ATOMIC); 78 if (!answer->buffer) { 79 IPC_SET_RETVAL(answer->data, ENOMEM); 80 return EOK; 81 } 78 82 errno_t rc = copy_from_uspace(answer->buffer, 79 83 (void *) src, size); … … 84 88 * ipc_call_free(). 85 89 */ 90 return EOK; 86 91 } 87 92 } else if (!size) { -
kernel/generic/src/ipc/ops/datawrite.c
rae89656 r7473807 56 56 } 57 57 58 call->buffer = (uint8_t *) malloc(size, 0); 58 call->buffer = (uint8_t *) malloc(size, FRAME_ATOMIC); 59 if (!call->buffer) 60 return ENOMEM; 59 61 errno_t rc = copy_from_uspace(call->buffer, (void *) src, size); 60 62 if (rc != EOK) { -
kernel/generic/src/lib/gsort.c
rae89656 r7473807 111 111 112 112 if (elem_size > IBUF_SIZE) { 113 slot = (void *) malloc(elem_size, 0);113 slot = (void *) malloc(elem_size, FRAME_ATOMIC); 114 114 if (!slot) 115 115 return false; -
kernel/generic/src/log/log.c
rae89656 r7473807 307 307 switch (operation) { 308 308 case KLOG_WRITE: 309 data = (char *) malloc(size + 1, 0);309 data = (char *) malloc(size + 1, FRAME_ATOMIC); 310 310 if (!data) 311 311 return (sys_errno_t) ENOMEM; … … 326 326 return EOK; 327 327 case KLOG_READ: 328 data = (char *) malloc(size, 0);328 data = (char *) malloc(size, FRAME_ATOMIC); 329 329 if (!data) 330 330 return (sys_errno_t) ENOMEM; -
kernel/generic/src/main/kinit.c
rae89656 r7473807 209 209 size_t arguments_size = str_size(arguments); 210 210 211 void *arguments_copy = malloc(arguments_size, 0);211 void *arguments_copy = malloc(arguments_size, FRAME_ATOMIC); 212 212 if (arguments_copy == NULL) 213 213 continue; -
kernel/generic/src/mm/as.c
rae89656 r7473807 620 620 } 621 621 622 as_area_t *area = (as_area_t *) malloc(sizeof(as_area_t), 0); 622 as_area_t *area = (as_area_t *) malloc(sizeof(as_area_t), FRAME_ATOMIC); 623 if (!area) { 624 mutex_unlock(&as->lock); 625 return NULL; 626 } 623 627 624 628 mutex_initialize(&area->lock, MUTEX_PASSIVE); … … 646 650 */ 647 651 if (!(attrs & AS_AREA_ATTR_PARTIAL)) { 648 si = (share_info_t *) malloc(sizeof(share_info_t), 0); 652 si = (share_info_t *) malloc(sizeof(share_info_t), 653 FRAME_ATOMIC); 654 if (!si) { 655 free(area); 656 mutex_unlock(&as->lock); 657 return NULL; 658 } 649 659 mutex_initialize(&si->lock, MUTEX_PASSIVE); 650 660 si->refcount = 1; … … 1292 1302 1293 1303 /* An array for storing frame numbers */ 1294 uintptr_t *old_frame = malloc(used_pages * sizeof(uintptr_t), 0); 1304 uintptr_t *old_frame = malloc(used_pages * sizeof(uintptr_t), 1305 FRAME_ATOMIC); 1306 if (!old_frame) { 1307 mutex_unlock(&area->lock); 1308 mutex_unlock(&as->lock); 1309 return ENOMEM; 1310 } 1295 1311 1296 1312 page_table_lock(as, false); -
kernel/generic/src/mm/backend_phys.c
rae89656 r7473807 160 160 phys_shared_data_t *data; 161 161 162 data = (phys_shared_data_t *) malloc(sizeof(*data), 0); 162 data = (phys_shared_data_t *) malloc(sizeof(*data), 163 FRAME_ATOMIC); 164 if (!data) 165 return false; 163 166 164 167 data->base = area->backend_data.base; -
kernel/generic/src/proc/program.c
rae89656 r7473807 71 71 errno_t program_create(as_t *as, uintptr_t entry_addr, char *name, program_t *prg) 72 72 { 73 uspace_arg_t *kernel_uarg = (uspace_arg_t *) 74 malloc(sizeof(uspace_arg_t), FRAME_ATOMIC); 75 if (!kernel_uarg) 76 return ENOMEM; 77 73 78 prg->loader_status = EE_OK; 74 79 prg->task = task_create(as, name); 75 if (!prg->task) 80 if (!prg->task) { 81 free(kernel_uarg); 76 82 return ELIMIT; 83 } 77 84 78 85 /* … … 90 97 &anon_backend, NULL, &virt, bound); 91 98 if (!area) { 99 free(kernel_uarg); 92 100 task_destroy(prg->task); 93 101 prg->task = NULL; 94 102 return ENOMEM; 95 103 } 96 97 uspace_arg_t *kernel_uarg = (uspace_arg_t *)98 malloc(sizeof(uspace_arg_t), 0);99 104 100 105 kernel_uarg->uspace_entry = (void *) entry_addr; -
kernel/generic/src/proc/thread.c
rae89656 r7473807 949 949 */ 950 950 uspace_arg_t *kernel_uarg = 951 (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0); 951 (uspace_arg_t *) malloc(sizeof(uspace_arg_t), FRAME_ATOMIC); 952 if (!kernel_uarg) 953 return (sys_errno_t) ENOMEM; 952 954 953 955 rc = copy_from_uspace(kernel_uarg, uspace_uarg, sizeof(uspace_arg_t)); -
kernel/generic/src/synch/futex.c
rae89656 r7473807 339 339 static futex_t *get_and_cache_futex(uintptr_t phys_addr, uintptr_t uaddr) 340 340 { 341 futex_t *futex = malloc(sizeof(futex_t), 0); 341 futex_t *futex = malloc(sizeof(futex_t), FRAME_ATOMIC); 342 if (!futex) 343 return NULL; 342 344 343 345 /* … … 363 365 * Cache the link to the futex object for this task. 364 366 */ 365 futex_ptr_t *fut_ptr = malloc(sizeof(futex_ptr_t), 0); 367 futex_ptr_t *fut_ptr = malloc(sizeof(futex_ptr_t), FRAME_ATOMIC); 368 if (!fut_ptr) { 369 spinlock_lock(&futex_ht_lock); 370 futex_release_ref(futex); 371 spinlock_unlock(&futex_ht_lock); 372 return NULL; 373 } 366 374 cht_link_t *dup_link; 367 375 -
kernel/generic/src/synch/workqueue.c
rae89656 r7473807 187 187 struct work_queue *workq_create(const char *name) 188 188 { 189 struct work_queue *workq = malloc(sizeof(struct work_queue), 0); 189 struct work_queue *workq = malloc(sizeof(struct work_queue), 190 FRAME_ATOMIC); 191 if (!workq) 192 return NULL; 190 193 191 194 if (workq) { -
kernel/generic/src/udebug/udebug_ops.c
rae89656 r7473807 370 370 371 371 /* Allocate a buffer to hold thread IDs */ 372 sysarg_t *id_buffer = malloc(buf_size + 1, 0); 372 sysarg_t *id_buffer = malloc(buf_size + 1, FRAME_ATOMIC); 373 if (!id_buffer) 374 return ENOMEM; 373 375 374 376 mutex_lock(&TASK->udebug.lock); … … 432 434 size_t name_size = str_size(TASK->name) + 1; 433 435 434 *data = malloc(name_size, 0); 436 *data = malloc(name_size, FRAME_ATOMIC); 437 if (!*data) 438 return ENOMEM; 435 439 *data_size = name_size; 436 440 … … 472 476 473 477 /* Prepare a buffer to hold the arguments. */ 474 sysarg_t *arg_buffer = malloc(6 * sizeof(sysarg_t), 0); 478 sysarg_t *arg_buffer = malloc(6 * sizeof(sysarg_t), FRAME_ATOMIC); 479 if (!arg_buffer) { 480 _thread_op_end(thread); 481 return ENOMEM; 482 } 475 483 476 484 /* Copy to a local buffer before releasing the lock. */ … … 514 522 515 523 /* Prepare a buffer to hold the data. */ 516 istate_t *state_buf = malloc(sizeof(istate_t), 0); 524 istate_t *state_buf = malloc(sizeof(istate_t), FRAME_ATOMIC); 525 if (!state_buf) { 526 _thread_op_end(thread); 527 return ENOMEM; 528 } 517 529 518 530 /* Copy to the allocated buffer */ … … 546 558 } 547 559 548 void *data_buffer = malloc(n, 0); 560 void *data_buffer = malloc(n, FRAME_ATOMIC); 561 if (!data_buffer) { 562 mutex_unlock(&TASK->udebug.lock); 563 return ENOMEM; 564 } 549 565 550 566 /* -
kernel/test/mm/falloc1.c
rae89656 r7473807 47 47 48 48 uintptr_t *frames = (uintptr_t *) 49 malloc(MAX_FRAMES * sizeof(uintptr_t), 0);49 malloc(MAX_FRAMES * sizeof(uintptr_t), FRAME_ATOMIC); 50 50 if (frames == NULL) 51 51 return "Unable to allocate frames"; -
uspace/lib/c/include/rcu.h
rae89656 r7473807 55 55 * 56 56 * // Insert at the beginning of the list. 57 * exam_t *my_exam = malloc(sizeof(exam_t) , 0);57 * exam_t *my_exam = malloc(sizeof(exam_t)); 58 58 * my_exam->grade = 5; 59 59 * my_exam->next = exam_list;
Note:
See TracChangeset
for help on using the changeset viewer.