Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ipc.c

    rabf6c01 rbab75df6  
    108108 * TASK->answerbox.
    109109 *
    110  * @return Initialized kernel call structure with one reference, or NULL.
    111  *
    112  */
    113 call_t *ipc_call_alloc(void)
    114 {
    115         // TODO: Allocate call and kobject in single allocation
    116 
    117         call_t *call = slab_alloc(call_cache, FRAME_ATOMIC);
     110 * @param flags Parameters for slab_alloc (e.g FRAME_ATOMIC).
     111 *
     112 * @return If flags permit it, return NULL, or initialized kernel
     113 *         call structure with one reference.
     114 *
     115 */
     116call_t *ipc_call_alloc(unsigned int flags)
     117{
     118        call_t *call = slab_alloc(call_cache, flags);
    118119        if (!call)
    119120                return NULL;
    120121
    121         kobject_t *kobj = (kobject_t *) malloc(sizeof(kobject_t));
     122        kobject_t *kobj;
     123        if (flags & FRAME_ATOMIC)
     124                kobj = (kobject_t *) malloc(sizeof(kobject_t));
     125        else
     126                kobj = (kobject_t *) nfmalloc(sizeof(kobject_t));
     127
    122128        if (!kobj) {
    123129                slab_free(call_cache, call);
     
    213219errno_t ipc_call_sync(phone_t *phone, call_t *request)
    214220{
    215         answerbox_t *mybox = slab_alloc(answerbox_cache, FRAME_ATOMIC);
    216         if (!mybox)
    217                 return ENOMEM;
    218 
     221        answerbox_t *mybox = slab_alloc(answerbox_cache, 0);
    219222        ipc_answerbox_init(mybox, TASK);
    220223
     
    480483                kobject_put(phone->kobject);
    481484
    482                 call_t *call = phone->hangup_call;
    483                 phone->hangup_call = NULL;
    484                 assert(call);
    485 
     485                call_t *call = ipc_call_alloc(0);
    486486                IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
    487487                call->request_method = IPC_M_PHONE_HUNGUP;
     
    685685                         * to exist as soon as we release it.
    686686                         */
    687                         call_t *call = phone->hangup_call;
    688                         phone->hangup_call = NULL;
    689                         assert(call);
    690 
     687                        call_t *call = ipc_call_alloc(0);
    691688                        IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
    692689                        call->request_method = IPC_M_PHONE_HUNGUP;
Note: See TracChangeset for help on using the changeset viewer.