/** * \file * \brief IPI notification mechanism */ /* * Copyright (c) 2007, 2008, 2010, ETH Zurich. * All rights reserved. * * This file is distributed under the terms in the attached LICENSE file. * If you do not find this file, copies can be found by writing to: * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. */ #include "monitor.h" #include static int glbl_chanid = 1; errval_t notification_set(int chanid, struct capref ep) { return invoke_monitor_ipi_register(ep, chanid); } errval_t notification_allocate(struct capref ep, int *chanid) { *chanid = glbl_chanid; glbl_chanid++; if(get_cap_addr(ep) != CPTR_NULL) { return notification_set(*chanid, ep); } else { return SYS_ERR_OK; } } errval_t notification_create_cap(int chanid, coreid_t coreid, struct capref *retcap) { errval_t err; /* printf("%d: creating notify cap with chanid %d, coreid %d, caller %p\n", */ /* my_core_id, chanid, coreid, __builtin_return_address(0)); */ /* Construct the notification capability */ struct capability notify_cap = { .type = ObjType_Notify_IPI, .rights = CAPRIGHTS_READ_WRITE, // XXX .u.notify_ipi = { .coreid = coreid, .chanid = chanid } }; err = slot_alloc(retcap); if (err_is_fail(err)) { DEBUG_ERR(err, "Failed to allocate slot from channel_alloc"); printf("Failed to allocate slot from channel_alloc\n"); abort(); //XXX } err = monitor_cap_create(*retcap, ¬ify_cap, my_core_id); if (err_is_fail(err)) { DEBUG_ERR(err, "monitor_cap_create failed"); printf("monitor_cap_create failed\n"); abort(); //XXX } return SYS_ERR_OK; }