VirtualBox

Changeset 6280 in vbox


Ignore:
Timestamp:
Jan 8, 2008 2:19:00 PM (17 years ago)
Author:
vboxsync
Message:

Guest Additions: added a ring 3 library function to set the interrupt filter and the corresponding Linux kernel code

Location:
trunk/src/VBox/Additions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp

    r6246 r6280  
    269269 * @returns IPRT status code
    270270 *
    271  * @remakes This currently does not accept more than 255 bytes of data at
     271 * @remarks This currently does not accept more than 255 bytes of data at
    272272 *          one time. It should probably be rewritten to use pass a pointer
    273273 *          in the IOCtl.
     
    290290}
    291291
     292/**
     293 * Change the IRQ filter mask.
     294 *
     295 * @returns IPRT status code
     296 */
     297VBGLR3DECL(int) VbglR3CtlFilterMask(uint32_t u32OrMask, uint32_t u32NotMask)
     298{
     299    VBoxGuestFilterMaskInfo info;
     300
     301    info.u32OrMask = u32OrMask;
     302    info.u32NotMask = u32NotMask;
     303    return vbglR3DoIOCtl(VBOXGUEST_IOCTL_CTL_FILTER_MASK, &info, sizeof(info));
     304}
     305
  • trunk/src/VBox/Additions/linux/module/vboxmod.c

    r6279 r6280  
    313313
    314314/**
     315 * IOCtl handler.  Control the interrupt filter mask to specify which VMMDev interrupts
     316 * we know how to handle.
     317 *
     318 * @returns iprt status code
     319 * @param pInfo kernel space pointer to the filter mask change info
     320 */
     321static int vboxadd_control_filter_mask(VBoxGuestFilterMaskInfo *pInfo)
     322{
     323    VMMDevCtlGuestFilterMask *pReq;
     324    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_CtlGuestFilterMask);
     325    if (RT_FAILURE(rc))
     326    {
     327        Log(("VBoxGuestCommonIOCtl: CTL_FILTER_MASK: failed to allocate %u (%#x) bytes to cache the request. rc=%d!!\n",
     328             sizeof(*pReq), sizeof(*pReq), rc));
     329        return rc;
     330    }
     331
     332    pReq->u32OrMask = pInfo->u32OrMask;
     333    pReq->u32NotMask = pInfo->u32NotMask;
     334
     335    rc = VbglGRPerform(&pReq->header);
     336    if (RT_FAILURE(rc))
     337        Log(("VBoxGuestCommonIOCtl: CTL_FILTER_MASK: VbglGRPerform failed, rc=%Rrc!\n", rc));
     338    else if (RT_FAILURE(pReq->header.rc))
     339    {
     340        Log(("VBoxGuestCommonIOCtl: CTL_FILTER_MASK: The request failed; VMMDev rc=%Rrc!\n", pReq->header.rc));
     341        rc = pReq->header.rc;
     342    }
     343
     344    VbglGRFree(&pReq->header);
     345    return rc;
     346}
     347
     348/**
    315349 * IOCTL handler
    316350 *
     
    446480                break;
    447481
     482        case VBOXGUEST_IOCTL_CTL_FILTER_MASK:
     483        {
     484                VBoxGuestFilterMaskInfo info;
     485                if (copy_to_user((void*)arg, (void*)&info, sizeof(info)))
     486                {
     487                    LogRelFunc(("VBOXGUEST_IOCTL_CTL_FILTER_MASK: error getting parameters from user space!\n"));
     488                    rc = -EFAULT;
     489                    break;
     490                }
     491                rc = -RTErrConvertToErrno(vboxadd_control_filter_mask(&info));
     492                break;
     493        }
    448494        default:
    449495                LogRelFunc(("unknown command: %x\n", cmd));
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette