blob: 3b7024b9b08b1fa1c5fd8059c22847cb75ba5c86 (
plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// SPDX-License-Identifier: GPL-2.0
#if defined(__x86_64__)
/*
* Include usdt.h with default nop,nop10 instructions combo.
*/
#include "usdt.h"
__attribute__((aligned(16)))
void usdt_2(void)
{
USDT(optimized_attach, usdt_2);
}
/*
* Force the nop1,nop10 combo of the USDT probe to a spot where the nop10
* crosses a page boundary: .balign starts the padding exactly at a page
* start regardless of the compiler-generated prologue size, and the 4086
* one-byte nops put the nop1 at page offset 4086, so the following nop10
* occupies the last 9 bytes of that page and 1 byte of the next one.
* The kernel can't optimize such nop10, so libbpf must keep the uprobe
* on the 1-byte nop.
*/
__attribute__((noinline))
void usdt_2_cross_page(void)
{
asm volatile (".balign 4096, 0x90\n\t.skip 4086, 0x90");
USDT(optimized_attach, usdt_2_cross_page);
}
static volatile unsigned long usdt_red_zone_arg1 = 0xDEADBEEF;
static volatile unsigned long usdt_red_zone_arg2 = 0xCAFEBABE;
static volatile unsigned long usdt_red_zone_arg3 = 0xFEEDFACE;
void __attribute__((noinline)) usdt_red_zone_trigger(void)
{
unsigned long a1 = usdt_red_zone_arg1;
unsigned long a2 = usdt_red_zone_arg2;
unsigned long a3 = usdt_red_zone_arg3;
USDT(optimized_attach, usdt_red_zone, a1, a2, a3);
}
#endif
|