403Webshell
Server IP : 104.21.25.180  /  Your IP : 104.23.197.122
Web Server : Apache/2.4.37
System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64
User : ricodeal ( 1046)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/qemu-kvm/tracetool/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/qemu-kvm/tracetool/vcpu.py
# -*- coding: utf-8 -*-

"""
Generic management for the 'vcpu' property.

"""

__author__     = "Lluís Vilanova <[email protected]>"
__copyright__  = "Copyright 2016, Lluís Vilanova <[email protected]>"
__license__    = "GPL version 2 or (at your option) any later version"

__maintainer__ = "Stefan Hajnoczi"
__email__      = "[email protected]"


from tracetool import Arguments, try_import


def transform_event(event):
    """Transform event to comply with the 'vcpu' property (if present)."""
    if "vcpu" in event.properties:
        # events with 'tcg-trans' and 'tcg-exec' are auto-generated from
        # already-patched events
        assert "tcg-trans" not in event.properties
        assert "tcg-exec" not in event.properties

        event.args = Arguments([("void *", "__cpu"), event.args])
        if "tcg" in event.properties:
            fmt = "\"cpu=%p \""
            event.fmt = [fmt + event.fmt[0],
                         fmt + event.fmt[1]]
        else:
            fmt = "\"cpu=%p \""
            event.fmt = fmt + event.fmt
    return event


def transform_args(format, event, *args, **kwargs):
    """Transforms the arguments to suit the specified format.

    The format module must implement function 'vcpu_args', which receives the
    implicit arguments added by the 'vcpu' property, and must return suitable
    arguments for the given format.

    The function is only called for events with the 'vcpu' property.

    Parameters
    ==========
    format : str
        Format module name.
    event : Event
    args, kwargs
        Passed to 'vcpu_transform_args'.

    Returns
    =======
    Arguments
        The transformed arguments, including the non-implicit ones.

    """
    if "vcpu" in event.properties:
        ok, func = try_import("tracetool.format." + format,
                              "vcpu_transform_args")
        assert ok
        assert func
        return Arguments([func(event.args[:1], *args, **kwargs),
                          event.args[1:]])
    else:
        return event.args

Youez - 2016 - github.com/yon3zu
LinuXploit