Lines Matching +full:preserved +full:- +full:memory +full:- +full:map
1 /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
17 * map that keeps track of USDT argument specifications. This might be
24 * map that keeps track of IP (memory address) mapping to USDT argument
26 * Note, if kernel supports BPF cookies, this map is not used and could be
27 * resized all the way to 1 to save a bit of memory.
49 * sign-extended to cast arguments that are 1, 2, or 4 bytes
50 * long into final 8-byte u64/s64 value returned to user
87 return spec_id_ptr ? *spec_id_ptr : -ESRCH;
102 return -ESRCH;
106 return -ESRCH;
108 return spec->arg_cnt;
111 /* Returns the size in bytes of the #*arg_num* (zero-indexed) USDT argument.
123 return -ESRCH;
127 return -ESRCH;
130 return -ENOENT;
132 if (arg_num >= spec->arg_cnt)
133 return -ENOENT;
135 arg_spec = &spec->args[arg_num];
137 /* arg_spec->arg_bitshift = 64 - arg_sz * 8
138 * so: arg_sz = (64 - arg_spec->arg_bitshift) / 8
140 return (unsigned int)(64 - arg_spec->arg_bitshift) / 8;
143 /* Fetch USDT argument #*arg_num* (zero-indexed) and put its value into *res.
159 return -ESRCH;
163 return -ESRCH;
166 return -ENOENT;
168 if (arg_num >= spec->arg_cnt)
169 return -ENOENT;
171 arg_spec = &spec->args[arg_num];
172 switch (arg_spec->arg_type) {
174 /* Arg is just a constant ("-4@$-9" in USDT arg spec).
175 * value is recorded in arg_spec->val_off directly.
177 val = arg_spec->val_off;
182 * struct pt_regs. To keep things simple user-space parts
183 * record offsetof(struct pt_regs, <regname>) in arg_spec->reg_off.
185 err = bpf_probe_read_kernel(&val, sizeof(val), (void *)ctx + arg_spec->reg_off);
190 /* Arg is in memory addressed by register, plus some offset
191 * (e.g., "-4@-1204(%rbp)" in USDT arg spec). Register is
193 * is in arg_spec->val_off. We first fetch register contents
194 * from pt_regs, then do another user-space probe read to
197 err = bpf_probe_read_kernel(&val, sizeof(val), (void *)ctx + arg_spec->reg_off);
200 err = bpf_probe_read_user(&val, sizeof(val), (void *)val + arg_spec->val_off);
204 val >>= arg_spec->arg_bitshift;
208 return -EINVAL;
215 val <<= arg_spec->arg_bitshift;
216 if (arg_spec->arg_signed)
217 val = ((long)val) >> arg_spec->arg_bitshift;
219 val = val >> arg_spec->arg_bitshift;
224 /* Retrieve user-specified cookie value provided during attach as
244 return spec->usdt_cookie;
266 * Original struct pt_regs * context is preserved as 'ctx' argument.
275 _Pragma("GCC diagnostic ignored \"-Wint-conversion\"") \