Semaphore_create causes kernel panic

末鹿安然 提交于 2019-12-11 00:11:04

问题


I am developing a kernel extension. I require to use wait and signal mechanism to wait for particular events (programming logics). I am trying to use semaphores as part of the kernel extension to implement the wait and signal methodology.

The creation of semaphore is causing a kernel panic. Need help in figuring out the right implementation. Let me know if I am using it wrong or if there is any other simpler mechanism to wait and signal for kernel development.

The current code which I am using.

semaphore_t CreateWaitEvent() {

    semaphore_t sema;
    //The below semaphore_create line is causing the kernel panic
    if (semaphore_create(current_task(), &sema, SYNC_POLICY_FIFO, 0) != KERN_SUCCESS){
       return NULL;
    }
    return sema;
}

void Wait(semaphore_t event) {
    semaphore_wait(event);
}

void Signal(semaphore_t event) {
    semaphore_signal(event);
}

I am running this kernel extension on VM using parallels software on a MacBookPro. I have enabled kernel debugging.

don't know what I am doing wrong to cause a kernel panic.

来源:https://stackoverflow.com/questions/55627841/semaphore-create-causes-kernel-panic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!