267,8 → 267,15 |
} |
|
/* Allocate a buffer and copy down the threads' ids */ |
id_buffer = malloc(num_threads * sizeof(unative_t), 0); // ??? |
//FIXME!!! must not malloc when locks are held |
id_buffer = malloc(num_threads * sizeof(unative_t), 0); |
if (!id_buffer) { |
spinlock_unlock(&TASK->lock); |
interrupts_restore(ipl); |
|
return ENOMEM; |
} |
|
copied_ids = 0; |
for (cur = TASK->th_head.next; cur != &TASK->th_head; cur = cur->next) { |
t = list_get_instance(cur, thread_t, th_link); |
302,6 → 309,10 |
|
klog_printf("udebug_args_read()"); |
|
/* Prepare a buffer to hold the arguments */ |
arg_buffer = malloc(6 * sizeof(unative_t), 0); |
if (!arg_buffer) return ENOMEM; |
|
ipl = interrupts_disable(); |
|
/* On success, this will lock t->debug_lock */ |
320,7 → 331,6 |
} |
|
/* Copy to a local buffer before releasing the lock */ |
arg_buffer = malloc(6 * sizeof(unative_t), 0); // ??? |
memcpy(arg_buffer, t->syscall_args, 6 * sizeof(unative_t)); |
|
_thread_op_end(t); |
339,6 → 349,10 |
|
klog_printf("udebug_regs_read()"); |
|
/* Prepare a buffer to hold the registers */ |
regs_buffer = malloc(sizeof(istate_t), 0); |
if (!regs_buffer) return ENOMEM; |
|
ipl = interrupts_disable(); |
|
/* On success, this will lock t->debug_lock */ |
356,8 → 370,7 |
return EBUSY; |
} |
|
/* Copy to an allocated buffer */ |
regs_buffer = malloc(sizeof(istate_t), 0); // ??? |
/* Copy to the allocated buffer */ |
memcpy(regs_buffer, state, sizeof(istate_t)); |
|
_thread_op_end(t); |
413,7 → 426,9 |
|
klog_printf("udebug_mem_read()"); |
|
data_buffer = malloc(n, 0); // ??? |
data_buffer = malloc(n, 0); |
if (!data_buffer) return ENOMEM; |
|
klog_printf("udebug_mem_read: src=%u, size=%u", uspace_addr, n); |
|
/* NOTE: this is not strictly from a syscall... but that shouldn't |