[DTrace-devel] [PATCH 2/7 v2 REVIEWED] Make dt_cg_ldsize() available to provider implementations
Eugene Loh
eugene.loh at oracle.com
Sat May 28 15:27:11 UTC 2022
On 5/27/22 22:36, Kris Van Hees via DTrace-devel wrote:
> Code generation for probe program trampolines will need dt_cg_ldsize()
> (formetly known as dt_cg_load()) to generate the correct load
> instructions when populating the probe argument data.
formetly
->
formerly
Incidentally, why is the new name ld-specific? I suppose that reflects
current usage, but it could be used for st as well; further, it is
looking stuff up in an array called ldstw[] (which I assume means
load-store width).
I also am not familiar with the code below. What is the "sign bit"
comment referring to?
> diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> @@ -5032,16 +5028,17 @@ dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
> ssize_t size;
>
> /*
> - * Save and restore DT_NF_USERLAND across dt_cg_load():
> - * we need the sign bit from dnp and the user bit from
> - * dnp->dn_child in order to get the proper opcode.
> + * Save and restore DT_NF_USERLAND across
> + * dt_cg_ldsize(): we need the sign bit from dnp and
> + * the user bit from dnp->dn_child in order to get the
> + * proper opcode.
> */
> ubit = dnp->dn_flags & DT_NF_USERLAND;
> dnp->dn_flags |=
> (dnp->dn_child->dn_flags & DT_NF_USERLAND);
>
> dt_cg_check_notnull(dlp, drp, dnp->dn_reg);
> - op = dt_cg_load(dnp, ctfp, dnp->dn_type, &size);
> + op = dt_cg_ldsize(dnp, ctfp, dnp->dn_type, &size);
>
> /*
> * If the child is an alloca pointer, bounds-check it
> @@ -5205,16 +5202,17 @@ dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
> uint_t ubit;
>
> /*
> - * Save and restore DT_NF_USERLAND across dt_cg_load():
> - * we need the sign bit from dnp and the user bit from
> - * dnp->dn_left in order to get the proper opcode.
> + * Save and restore DT_NF_USERLAND across
> + * dt_cg_ldsize(): we need the sign bit from dnp and
> + * the user bit from dnp->dn_left in order to get the
> + * proper opcode.
> */
> ubit = dnp->dn_flags & DT_NF_USERLAND;
> dnp->dn_flags |=
> (dnp->dn_left->dn_flags & DT_NF_USERLAND);
>
> /* FIXME: Does not handle signed and userland */
> - emit(dlp, BPF_LOAD(dt_cg_load(dnp, ctfp, m.ctm_type, NULL),
> + emit(dlp, BPF_LOAD(dt_cg_ldsize(dnp, ctfp, m.ctm_type, NULL),
> dnp->dn_left->dn_reg, dnp->dn_left->dn_reg, 0));
>
> dnp->dn_flags &= ~DT_NF_USERLAND;
> }
More information about the DTrace-devel
mailing list