Lines Matching full:pos
67 static const uint8_t *pt_find_psb(const uint8_t *pos, in pt_find_psb() argument
73 if (!pos || !config) in pt_find_psb()
84 if (*pos != pt_psb_hi) in pt_find_psb()
85 pos++; in pt_find_psb()
87 for (; (pos + 1) < end; pos += 2) { in pt_find_psb()
90 hi = pos[0]; in pt_find_psb()
91 lo = pos[1]; in pt_find_psb()
103 pos -= ptps_psb; in pt_find_psb()
106 if (pos < begin) in pt_find_psb()
110 if (pos[0] != pt_opc_psb || pos[1] != pt_ext_psb) in pt_find_psb()
113 errcode = pt_pkt_read_psb(pos, config); in pt_find_psb()
117 return pos; in pt_find_psb()
120 static int pt_sync_within_bounds(const uint8_t *pos, const uint8_t *begin, in pt_sync_within_bounds() argument
123 /* We allow @pos == @end representing the very end of the trace. in pt_sync_within_bounds()
125 * This will result in -pte_eos when we actually try to read from @pos. in pt_sync_within_bounds()
127 return (begin <= pos) && (pos <= end); in pt_sync_within_bounds()
130 int pt_sync_set(const uint8_t **sync, const uint8_t *pos, in pt_sync_set() argument
136 if (!sync || !pos || !config) in pt_sync_set()
142 if (!pt_sync_within_bounds(pos, begin, end)) in pt_sync_set()
145 if (end < pos + 2) in pt_sync_set()
149 if (pos[0] != pt_opc_psb || pos[1] != pt_ext_psb) in pt_sync_set()
152 errcode = pt_pkt_read_psb(pos, config); in pt_sync_set()
156 *sync = pos; in pt_sync_set()
161 int pt_sync_forward(const uint8_t **sync, const uint8_t *pos, in pt_sync_forward() argument
166 if (!sync || !pos || !config) in pt_sync_forward()
169 start = pos; in pt_sync_forward()
173 if (!pt_sync_within_bounds(pos, begin, end)) in pt_sync_forward()
177 pos = align(pos, sizeof(*psb_pattern)); in pt_sync_forward()
181 const uint8_t *current = pos; in pt_sync_forward()
184 pos += sizeof(uint64_t); in pt_sync_forward()
185 if (end < pos) in pt_sync_forward()
194 current = pt_find_psb(pos, config); in pt_sync_forward()
209 int pt_sync_backward(const uint8_t **sync, const uint8_t *pos, in pt_sync_backward() argument
214 if (!sync || !pos || !config) in pt_sync_backward()
220 if (!pt_sync_within_bounds(pos, begin, end)) in pt_sync_backward()
224 pos = truncate(pos, sizeof(*psb_pattern)); in pt_sync_backward()
228 const uint8_t *next = pos; in pt_sync_backward()
231 pos -= sizeof(uint64_t); in pt_sync_backward()
232 if (pos < begin) in pt_sync_backward()
235 val = * (const uint64_t *) pos; in pt_sync_backward()