VirtualBox

Ignore:
Timestamp:
Apr 7, 2012 9:01:54 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77335
Message:

The ring-3 SUPLib APIs for talking to the tracer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r40763 r40820  
    23082308}
    23092309
     2310
     2311SUPR3DECL(int) SUPR3TracerOpen(uint32_t uCookie, uintptr_t uArg)
     2312{
     2313    /* fake */
     2314    if (RT_UNLIKELY(g_u32FakeMode))
     2315        return VINF_SUCCESS;
     2316
     2317    /*
     2318     * Issue IOCtl to the SUPDRV kernel module.
     2319     */
     2320    SUPTRACEROPEN Req;
     2321    Req.Hdr.u32Cookie       = g_u32Cookie;
     2322    Req.Hdr.u32SessionCookie= g_u32SessionCookie;
     2323    Req.Hdr.cbIn            = SUP_IOCTL_TRACER_OPEN_SIZE_IN;
     2324    Req.Hdr.cbOut           = SUP_IOCTL_TRACER_OPEN_SIZE_OUT;
     2325    Req.Hdr.fFlags          = SUPREQHDR_FLAGS_DEFAULT;
     2326    Req.Hdr.rc              = VERR_INTERNAL_ERROR;
     2327    Req.u.In.uCookie        = uCookie;
     2328    Req.u.In.uArg           = uArg;
     2329    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_TRACER_OPEN, &Req, SUP_IOCTL_TRACER_OPEN_SIZE);
     2330    if (RT_SUCCESS(rc))
     2331        rc = Req.Hdr.rc;
     2332    return rc;
     2333}
     2334
     2335
     2336SUPR3DECL(int) SUPR3TracerClose(void)
     2337{
     2338    /* fake */
     2339    if (RT_UNLIKELY(g_u32FakeMode))
     2340        return VINF_SUCCESS;
     2341
     2342    /*
     2343     * Issue IOCtl to the SUPDRV kernel module.
     2344     */
     2345    SUPREQHDR Req;
     2346    Req.u32Cookie       = g_u32Cookie;
     2347    Req.u32SessionCookie= g_u32SessionCookie;
     2348    Req.cbIn            = SUP_IOCTL_TRACER_OPEN_SIZE_IN;
     2349    Req.cbOut           = SUP_IOCTL_TRACER_OPEN_SIZE_OUT;
     2350    Req.fFlags          = SUPREQHDR_FLAGS_DEFAULT;
     2351    Req.rc              = VERR_INTERNAL_ERROR;
     2352    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_TRACER_CLOSE, &Req, SUP_IOCTL_TRACER_CLOSE_SIZE);
     2353    if (RT_SUCCESS(rc))
     2354        rc = Req.rc;
     2355    return rc;
     2356}
     2357
     2358
     2359SUPR3DECL(int) SUPR3TracerIoCtl(uintptr_t uCmd, uintptr_t uArg, int32_t *piRetVal)
     2360{
     2361    /* fake */
     2362    if (RT_UNLIKELY(g_u32FakeMode))
     2363    {
     2364        *piRetVal = -1;
     2365        return VERR_NOT_SUPPORTED;
     2366    }
     2367
     2368    /*
     2369     * Issue IOCtl to the SUPDRV kernel module.
     2370     */
     2371    SUPTRACERIOCTL Req;
     2372    Req.Hdr.u32Cookie       = g_u32Cookie;
     2373    Req.Hdr.u32SessionCookie= g_u32SessionCookie;
     2374    Req.Hdr.cbIn            = SUP_IOCTL_TRACER_IOCTL_SIZE_IN;
     2375    Req.Hdr.cbOut           = SUP_IOCTL_TRACER_IOCTL_SIZE_OUT;
     2376    Req.Hdr.fFlags          = SUPREQHDR_FLAGS_DEFAULT;
     2377    Req.Hdr.rc              = VERR_INTERNAL_ERROR;
     2378    Req.u.In.uCmd           = uCmd;
     2379    Req.u.In.uArg           = uArg;
     2380    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_TRACER_IOCTL, &Req, SUP_IOCTL_TRACER_IOCTL_SIZE);
     2381    if (RT_SUCCESS(rc))
     2382    {
     2383        rc = Req.Hdr.rc;
     2384        *piRetVal = Req.u.Out.iRetVal;
     2385    }
     2386    return rc;
     2387}
     2388
Note: See TracChangeset for help on using the changeset viewer.

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