summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/aggregate_ret_target.c
blob: cffd8d7d3241aff698ddc614011723722f0d3741 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include "bpf_misc.h"

/* freplace target: a global subprogram returning 16 bytes in R0:R2. */
__naked unsigned __int128 agg_ret_target_func(void)
{
	asm volatile (
	"r0 = 0x1234;"
	"r2 = 0x5678;"
	"exit;"
	);
}

SEC("tc")
__naked int agg_ret_target(void)
{
	asm volatile (
	"call %[agg_ret_target_func];"
	"r0 = 0;"
	"exit;"
	:
	: __imm(agg_ret_target_func)
	: __clobber_all);
}

char _license[] SEC("license") = "GPL";