]>
git.proxmox.com Git - mirror_qemu.git/blob - scripts/tracetool/format/tcg_helper_c.py
2 # -*- coding: utf-8 -*-
5 Generate trace/generated-helpers.c.
8 __author__
= "Lluís Vilanova <vilanova@ac.upc.edu>"
9 __copyright__
= "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
10 __license__
= "GPL version 2 or (at your option) any later version"
12 __maintainer__
= "Stefan Hajnoczi"
13 __email__
= "stefanha@linux.vnet.ibm.com"
16 from tracetool
import Arguments
, out
17 from tracetool
.transform
import *
21 def vcpu_transform_args(args
, mode
):
23 # NOTE: this name must be kept in sync with the one in "tcg_h"
24 args
= Arguments([(args
.types()[0], "__tcg_" + args
.names()[0])])
27 # Does cast from helper requirements to tracing types
28 ("CPUState *", "env_cpu(%s)" % args
.names()[0]),
32 # NOTE: Current helper code uses TCGv_env (CPUArchState*)
33 ("CPUArchState *", args
.names()[0]),
37 elif mode
== "wrapper":
38 return args
.transform(HOST_2_TCG
)
43 def generate(events
, backend
, group
):
45 header
= "trace-root.h"
49 events
= [e
for e
in events
50 if "disable" not in e
.properties
]
52 out('/* This file is autogenerated by tracetool, do not edit. */',
54 '#include "qemu/osdep.h"',
56 '#include "exec/helper-proto.h"',
57 '#include "%s"' % header
,
62 if "tcg-exec" not in e
.properties
:
65 e_args_api
= tracetool
.vcpu
.transform_args(
66 "tcg_helper_c", e
.original
, "header").transform(
67 HOST_2_TCG_COMPAT
, TCG_2_TCG_HELPER_DEF
)
68 e_args_call
= tracetool
.vcpu
.transform_args(
69 "tcg_helper_c", e
, "code")
71 out('void %(name_tcg)s(%(args_api)s)',
73 # NOTE: the check was already performed at TCG-generation time
74 ' %(name)s(%(args_call)s);',
76 name_tcg
="helper_%s_proxy" % e
.api(),
77 name
=e
.api(e
.QEMU_TRACE_NOCHECK
),
79 args_call
=", ".join(e_args_call
.casted()),