Lines Matching +full:loc +full:- +full:code
1 /* SPDX-License-Identifier: GPL-2.0 */
7 fetch_store_raw(unsigned long val, struct fetch_insn *code, void *buf) in fetch_store_raw() argument
9 switch (code->size) { in fetch_store_raw()
29 fetch_apply_bitfield(struct fetch_insn *code, void *buf) in fetch_apply_bitfield() argument
31 switch (code->basesize) { in fetch_apply_bitfield()
33 *(u8 *)buf <<= code->lshift; in fetch_apply_bitfield()
34 *(u8 *)buf >>= code->rshift; in fetch_apply_bitfield()
37 *(u16 *)buf <<= code->lshift; in fetch_apply_bitfield()
38 *(u16 *)buf >>= code->rshift; in fetch_apply_bitfield()
41 *(u32 *)buf <<= code->lshift; in fetch_apply_bitfield()
42 *(u32 *)buf >>= code->rshift; in fetch_apply_bitfield()
45 *(u64 *)buf <<= code->lshift; in fetch_apply_bitfield()
46 *(u64 *)buf >>= code->rshift; in fetch_apply_bitfield()
57 process_fetch_insn(struct fetch_insn *code, void *rec, void *edata,
84 * Fetch a null-terminated symbol string + offset. Caller MUST set *(u32 *)buf
94 return -ENOMEM; in fetch_store_symstring()
103 process_common_fetch_insn(struct fetch_insn *code, unsigned long *val) in process_common_fetch_insn() argument
105 switch (code->op) { in process_common_fetch_insn()
107 *val = code->immediate; in process_common_fetch_insn()
110 *val = (unsigned long)current->comm; in process_common_fetch_insn()
113 *val = (unsigned long)code->data; in process_common_fetch_insn()
116 return -EILSEQ; in process_common_fetch_insn()
123 process_fetch_insn_bottom(struct fetch_insn *code, unsigned long val, in process_fetch_insn_bottom() argument
128 u32 loc = 0; in process_fetch_insn_bottom() local
134 if (code->op == FETCH_OP_DEREF) { in process_fetch_insn_bottom()
136 ret = probe_mem_read(&val, (void *)val + code->offset, in process_fetch_insn_bottom()
138 } else if (code->op == FETCH_OP_UDEREF) { in process_fetch_insn_bottom()
141 (void *)val + code->offset, sizeof(val)); in process_fetch_insn_bottom()
146 code++; in process_fetch_insn_bottom()
149 s3 = code; in process_fetch_insn_bottom()
153 switch (code->op) { in process_fetch_insn_bottom()
155 ret = fetch_store_strlen(val + code->offset); in process_fetch_insn_bottom()
156 code++; in process_fetch_insn_bottom()
159 ret = fetch_store_strlen_user(val + code->offset); in process_fetch_insn_bottom()
160 code++; in process_fetch_insn_bottom()
163 ret = fetch_store_symstrlen(val + code->offset); in process_fetch_insn_bottom()
164 code++; in process_fetch_insn_bottom()
167 return -EILSEQ; in process_fetch_insn_bottom()
171 switch (code->op) { in process_fetch_insn_bottom()
173 fetch_store_raw(val, code, dest); in process_fetch_insn_bottom()
176 probe_mem_read(dest, (void *)val + code->offset, code->size); in process_fetch_insn_bottom()
179 probe_mem_read_user(dest, (void *)val + code->offset, code->size); in process_fetch_insn_bottom()
182 loc = *(u32 *)dest; in process_fetch_insn_bottom()
183 ret = fetch_store_string(val + code->offset, dest, base); in process_fetch_insn_bottom()
186 loc = *(u32 *)dest; in process_fetch_insn_bottom()
187 ret = fetch_store_string_user(val + code->offset, dest, base); in process_fetch_insn_bottom()
190 loc = *(u32 *)dest; in process_fetch_insn_bottom()
191 ret = fetch_store_symstring(val + code->offset, dest, base); in process_fetch_insn_bottom()
194 return -EILSEQ; in process_fetch_insn_bottom()
196 code++; in process_fetch_insn_bottom()
199 if (code->op == FETCH_OP_MOD_BF) { in process_fetch_insn_bottom()
200 fetch_apply_bitfield(code, dest); in process_fetch_insn_bottom()
201 code++; in process_fetch_insn_bottom()
206 if (code->op == FETCH_OP_LP_ARRAY) { in process_fetch_insn_bottom()
210 if (++i < code->param) { in process_fetch_insn_bottom()
211 code = s3; in process_fetch_insn_bottom()
212 if (s3->op != FETCH_OP_ST_STRING && in process_fetch_insn_bottom()
213 s3->op != FETCH_OP_ST_USTRING) { in process_fetch_insn_bottom()
214 dest += s3->size; in process_fetch_insn_bottom()
215 val += s3->size; in process_fetch_insn_bottom()
218 code--; in process_fetch_insn_bottom()
222 *(u32 *)dest = update_data_loc(loc, ret); in process_fetch_insn_bottom()
226 code++; in process_fetch_insn_bottom()
230 return code->op == FETCH_OP_END ? ret : -EILSEQ; in process_fetch_insn_bottom()
240 for (i = 0; i < tp->nr_args; i++) { in __get_data_size()
241 arg = tp->args + i; in __get_data_size()
242 if (unlikely(arg->dynamic)) { in __get_data_size()
243 len = process_fetch_insn(arg->code, regs, edata, NULL, NULL); in __get_data_size()
258 void *base = data - header_size; in store_trace_args()
259 void *dyndata = data + tp->size; in store_trace_args()
263 for (i = 0; i < tp->nr_args; i++) { in store_trace_args()
264 arg = tp->args + i; in store_trace_args()
265 dl = data + arg->offset; in store_trace_args()
267 if (unlikely(arg->dynamic)) in store_trace_args()
268 *dl = make_data_loc(maxlen, dyndata - base); in store_trace_args()
269 ret = process_fetch_insn(arg->code, rec, edata, dl, base); in store_trace_args()
270 if (arg->dynamic && likely(ret > 0)) { in store_trace_args()
272 maxlen -= ret; in store_trace_args()