Skip to content

Commit

Permalink
cg: Pass exit label to trampoline
Browse files Browse the repository at this point in the history
Some trampolines will need to be able to gemerate code for some form of
pre-conditions.  It therefore needs to know a jump label that will be
positioned right after the trampoline being generated.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
  • Loading branch information
kvanhees committed Feb 27, 2023
1 parent d34370c commit c82c1bf
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion libdtrace/dt_cg.c
Original file line number Diff line number Diff line change
Expand Up @@ -7344,7 +7344,7 @@ dt_cg(dt_pcb_t *pcb, dt_node_t *dnp)
assert(pcb->pcb_probe != NULL);

if (pcb->pcb_probe->prov->impl->trampoline != NULL)
pcb->pcb_probe->prov->impl->trampoline(pcb);
pcb->pcb_probe->prov->impl->trampoline(pcb, pcb->pcb_exitlbl);
} else
dt_cg_node(dnp, &pcb->pcb_ir, pcb->pcb_regs);

Expand Down
2 changes: 1 addition & 1 deletion libdtrace/dt_prov_dtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static int populate(dtrace_hdl_t *dtp)
* The trampoline will populate a dt_dctx_t struct and then call the function
* that implements the compiled D clause. It returns 0 to the caller.
*/
static void trampoline(dt_pcb_t *pcb)
static void trampoline(dt_pcb_t *pcb, uint_t exitlbl)
{
dt_irlist_t *dlp = &pcb->pcb_ir;
dt_activity_t act = DT_ACTIVITY_ACTIVE;
Expand Down
2 changes: 1 addition & 1 deletion libdtrace/dt_prov_fbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ static int populate(dtrace_hdl_t *dtp)
* The trampoline will populate a dt_dctx_t struct and then call the function
* that implements the compiled D clause. It returns 0 to the caller.
*/
static void trampoline(dt_pcb_t *pcb)
static void trampoline(dt_pcb_t *pcb, uint_t exitlbl)
{
dt_cg_tramp_prologue(pcb);

Expand Down
2 changes: 1 addition & 1 deletion libdtrace/dt_prov_profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static int provide(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp)
* __u64 addr;
* }
*/
static void trampoline(dt_pcb_t *pcb)
static void trampoline(dt_pcb_t *pcb, uint_t exitlbl)
{
int i;
dt_irlist_t *dlp = &pcb->pcb_ir;
Expand Down
2 changes: 1 addition & 1 deletion libdtrace/dt_prov_rawtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static int populate(dtrace_hdl_t *dtp)
* that implements the compiled D clause. It returns the value that it gets
* back from that function.
*/
static void trampoline(dt_pcb_t *pcb)
static void trampoline(dt_pcb_t *pcb, uint_t exitlbl)
{
int i;
dt_irlist_t *dlp = &pcb->pcb_ir;
Expand Down
2 changes: 1 addition & 1 deletion libdtrace/dt_prov_sdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static int populate(dtrace_hdl_t *dtp)
* that implements the compiled D clause. It returns the value that it gets
* back from that function.
*/
static void trampoline(dt_pcb_t *pcb)
static void trampoline(dt_pcb_t *pcb, uint_t exitlbl)
{
int i;
dt_irlist_t *dlp = &pcb->pcb_ir;
Expand Down
2 changes: 1 addition & 1 deletion libdtrace/dt_prov_syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static int populate(dtrace_hdl_t *dtp)
* The trampoline will populate a dt_dctx_t struct and then call the function
* that implements the compiled D clause. It returns 0 to the caller.
*/
static void trampoline(dt_pcb_t *pcb)
static void trampoline(dt_pcb_t *pcb, uint_t exitlbl)
{
int i;
dt_irlist_t *dlp = &pcb->pcb_ir;
Expand Down
2 changes: 1 addition & 1 deletion libdtrace/dt_prov_uprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ static void enable(dtrace_hdl_t *dtp, dt_probe_t *prp)
* The trampoline will first populate a dt_dctx_t struct. It will then emulate
* the firing of all dependent pid* probes and their clauses.
*/
static void trampoline(dt_pcb_t *pcb)
static void trampoline(dt_pcb_t *pcb, uint_t exitlbl)
{
dt_irlist_t *dlp = &pcb->pcb_ir;
const dt_probe_t *prp = pcb->pcb_probe;
Expand Down
3 changes: 2 additions & 1 deletion libdtrace/dt_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ typedef struct dt_provimpl {
const pid_probespec_t *psp);
void (*enable)(dtrace_hdl_t *dtp, /* enable the given probe */
struct dt_probe *prp);
void (*trampoline)(dt_pcb_t *pcb); /* generate BPF trampoline */
void (*trampoline)(dt_pcb_t *pcb, /* generate BPF trampoline */
uint_t exitlbl);
int (*attach)(dtrace_hdl_t *dtp, /* attach BPF prog to probe */
const struct dt_probe *prp, int bpf_fd);
int (*probe_info)(dtrace_hdl_t *dtp, /* get probe info */
Expand Down

0 comments on commit c82c1bf

Please sign in to comment.