Lines Matching refs:buf

74 static int intel_pt_get_long_tnt(const unsigned char *buf, size_t len,  in intel_pt_get_long_tnt()  argument
83 payload = le64_to_cpu(*(uint64_t *)buf); in intel_pt_get_long_tnt()
97 static int intel_pt_get_pip(const unsigned char *buf, size_t len, in intel_pt_get_pip() argument
106 memcpy_le64(&payload, buf + 2, 6); in intel_pt_get_pip()
118 static int intel_pt_get_cbr(const unsigned char *buf, size_t len, in intel_pt_get_cbr() argument
124 packet->payload = le16_to_cpu(*(uint16_t *)(buf + 2)); in intel_pt_get_cbr()
128 static int intel_pt_get_vmcs(const unsigned char *buf, size_t len, in intel_pt_get_vmcs() argument
141 memcpy_le64(&packet->payload, buf + 2, count); in intel_pt_get_vmcs()
152 static int intel_pt_get_psb(const unsigned char *buf, size_t len, in intel_pt_get_psb() argument
161 if (buf[i] != 2 || buf[i + 1] != 0x82) in intel_pt_get_psb()
175 static int intel_pt_get_tma(const unsigned char *buf, size_t len, in intel_pt_get_tma() argument
182 packet->payload = buf[2] | (buf[3] << 8); in intel_pt_get_tma()
183 packet->count = buf[5] | ((buf[6] & BIT(0)) << 8); in intel_pt_get_tma()
193 static int intel_pt_get_mnt(const unsigned char *buf, size_t len, in intel_pt_get_mnt() argument
199 memcpy_le64(&packet->payload, buf + 3, 8); in intel_pt_get_mnt()
204 static int intel_pt_get_3byte(const unsigned char *buf, size_t len, in intel_pt_get_3byte() argument
210 switch (buf[2]) { in intel_pt_get_3byte()
212 return intel_pt_get_mnt(buf, len, packet); in intel_pt_get_3byte()
218 static int intel_pt_get_ptwrite(const unsigned char *buf, size_t len, in intel_pt_get_ptwrite() argument
221 packet->count = (buf[1] >> 5) & 0x3; in intel_pt_get_ptwrite()
222 packet->type = buf[1] & BIT(7) ? INTEL_PT_PTWRITE_IP : in intel_pt_get_ptwrite()
229 packet->payload = le32_to_cpu(*(uint32_t *)(buf + 2)); in intel_pt_get_ptwrite()
234 packet->payload = le64_to_cpu(*(uint64_t *)(buf + 2)); in intel_pt_get_ptwrite()
253 static int intel_pt_get_mwait(const unsigned char *buf, size_t len, in intel_pt_get_mwait() argument
259 packet->payload = le64_to_cpu(*(uint64_t *)(buf + 2)); in intel_pt_get_mwait()
263 static int intel_pt_get_pwre(const unsigned char *buf, size_t len, in intel_pt_get_pwre() argument
269 memcpy_le64(&packet->payload, buf + 2, 2); in intel_pt_get_pwre()
273 static int intel_pt_get_pwrx(const unsigned char *buf, size_t len, in intel_pt_get_pwrx() argument
279 memcpy_le64(&packet->payload, buf + 2, 5); in intel_pt_get_pwrx()
283 static int intel_pt_get_bbp(const unsigned char *buf, size_t len, in intel_pt_get_bbp() argument
289 packet->count = buf[2] >> 7; in intel_pt_get_bbp()
290 packet->payload = buf[2] & 0x1f; in intel_pt_get_bbp()
294 static int intel_pt_get_bip_4(const unsigned char *buf, size_t len, in intel_pt_get_bip_4() argument
300 packet->count = buf[0] >> 3; in intel_pt_get_bip_4()
301 memcpy_le64(&packet->payload, buf + 1, 4); in intel_pt_get_bip_4()
305 static int intel_pt_get_bip_8(const unsigned char *buf, size_t len, in intel_pt_get_bip_8() argument
311 packet->count = buf[0] >> 3; in intel_pt_get_bip_8()
312 memcpy_le64(&packet->payload, buf + 1, 8); in intel_pt_get_bip_8()
332 static int intel_pt_get_ext(const unsigned char *buf, size_t len, in intel_pt_get_ext() argument
338 if ((buf[1] & 0x1f) == 0x12) in intel_pt_get_ext()
339 return intel_pt_get_ptwrite(buf, len, packet); in intel_pt_get_ext()
341 switch (buf[1]) { in intel_pt_get_ext()
343 return intel_pt_get_long_tnt(buf, len, packet); in intel_pt_get_ext()
345 return intel_pt_get_pip(buf, len, packet); in intel_pt_get_ext()
349 return intel_pt_get_cbr(buf, len, packet); in intel_pt_get_ext()
351 return intel_pt_get_vmcs(buf, len, packet); in intel_pt_get_ext()
355 return intel_pt_get_psb(buf, len, packet); in intel_pt_get_ext()
359 return intel_pt_get_tma(buf, len, packet); in intel_pt_get_ext()
361 return intel_pt_get_3byte(buf, len, packet); in intel_pt_get_ext()
367 return intel_pt_get_mwait(buf, len, packet); in intel_pt_get_ext()
369 return intel_pt_get_pwre(buf, len, packet); in intel_pt_get_ext()
371 return intel_pt_get_pwrx(buf, len, packet); in intel_pt_get_ext()
373 return intel_pt_get_bbp(buf, len, packet); in intel_pt_get_ext()
401 static int intel_pt_get_cyc(unsigned int byte, const unsigned char *buf, in intel_pt_get_cyc() argument
414 byte = buf[offs++]; in intel_pt_get_cyc()
424 const unsigned char *buf, size_t len, in intel_pt_get_ip() argument
439 packet->payload = le16_to_cpu(*(uint16_t *)(buf + 1)); in intel_pt_get_ip()
445 packet->payload = le32_to_cpu(*(uint32_t *)(buf + 1)); in intel_pt_get_ip()
452 memcpy_le64(&packet->payload, buf + 1, 6); in intel_pt_get_ip()
458 packet->payload = le64_to_cpu(*(uint64_t *)(buf + 1)); in intel_pt_get_ip()
469 static int intel_pt_get_mode(const unsigned char *buf, size_t len, in intel_pt_get_mode() argument
475 switch (buf[1] >> 5) { in intel_pt_get_mode()
478 switch (buf[1] & 3) { in intel_pt_get_mode()
494 if ((buf[1] & 3) == 3) in intel_pt_get_mode()
496 packet->payload = buf[1] & 3; in intel_pt_get_mode()
505 static int intel_pt_get_tsc(const unsigned char *buf, size_t len, in intel_pt_get_tsc() argument
511 memcpy_le64(&packet->payload, buf + 1, 7); in intel_pt_get_tsc()
515 static int intel_pt_get_mtc(const unsigned char *buf, size_t len, in intel_pt_get_mtc() argument
521 packet->payload = buf[1]; in intel_pt_get_mtc()
525 static int intel_pt_do_get_packet(const unsigned char *buf, size_t len, in intel_pt_do_get_packet() argument
536 byte = buf[0]; in intel_pt_do_get_packet()
543 return intel_pt_get_bip_4(buf, len, packet); in intel_pt_do_get_packet()
547 return intel_pt_get_bip_8(buf, len, packet); in intel_pt_do_get_packet()
557 return intel_pt_get_ext(buf, len, packet); in intel_pt_do_get_packet()
562 return intel_pt_get_cyc(byte, buf, len, packet); in intel_pt_do_get_packet()
566 return intel_pt_get_ip(INTEL_PT_TIP, byte, buf, len, packet); in intel_pt_do_get_packet()
568 return intel_pt_get_ip(INTEL_PT_TIP_PGE, byte, buf, len, in intel_pt_do_get_packet()
571 return intel_pt_get_ip(INTEL_PT_TIP_PGD, byte, buf, len, in intel_pt_do_get_packet()
574 return intel_pt_get_ip(INTEL_PT_FUP, byte, buf, len, packet); in intel_pt_do_get_packet()
578 return intel_pt_get_mode(buf, len, packet); in intel_pt_do_get_packet()
580 return intel_pt_get_tsc(buf, len, packet); in intel_pt_do_get_packet()
582 return intel_pt_get_mtc(buf, len, packet); in intel_pt_do_get_packet()
640 int intel_pt_get_packet(const unsigned char *buf, size_t len, in intel_pt_get_packet() argument
645 ret = intel_pt_do_get_packet(buf, len, packet, *ctx); in intel_pt_get_packet()
647 while (ret < 8 && len > (size_t)ret && !buf[ret]) in intel_pt_get_packet()
654 int intel_pt_pkt_desc(const struct intel_pt_pkt *packet, char *buf, in intel_pt_pkt_desc() argument
668 return snprintf(buf, buf_len, "%s", name); in intel_pt_pkt_desc()
672 ret = snprintf(buf, blen, "%s ", name); in intel_pt_pkt_desc()
675 buf += ret; in intel_pt_pkt_desc()
679 ret = snprintf(buf, blen, "T"); in intel_pt_pkt_desc()
681 ret = snprintf(buf, blen, "N"); in intel_pt_pkt_desc()
684 buf += ret; in intel_pt_pkt_desc()
688 ret = snprintf(buf, blen, " (%d)", packet->count); in intel_pt_pkt_desc()
699 return snprintf(buf, buf_len, "%s no ip", name); in intel_pt_pkt_desc()
707 return snprintf(buf, buf_len, "%s 0x%llx", name, payload); in intel_pt_pkt_desc()
709 return snprintf(buf, buf_len, "%s CTC 0x%x FC 0x%x", name, in intel_pt_pkt_desc()
712 return snprintf(buf, buf_len, "%s %lld", name, payload); in intel_pt_pkt_desc()
714 return snprintf(buf, buf_len, "%s TXAbort:%u InTX:%u", in intel_pt_pkt_desc()
720 ret = snprintf(buf, buf_len, "%s 0x%llx (NR=%d)", in intel_pt_pkt_desc()
724 return snprintf(buf, buf_len, "%s 0x%llx IP:0", name, payload); in intel_pt_pkt_desc()
726 return snprintf(buf, buf_len, "%s 0x%llx IP:1", name, payload); in intel_pt_pkt_desc()
729 return snprintf(buf, buf_len, "%s IP:0", name); in intel_pt_pkt_desc()
732 return snprintf(buf, buf_len, "%s IP:1", name); in intel_pt_pkt_desc()
734 return snprintf(buf, buf_len, "%s 0x%llx Hints 0x%x Extensions 0x%x", in intel_pt_pkt_desc()
738 return snprintf(buf, buf_len, "%s 0x%llx HW:%u CState:%u Sub-CState:%u", in intel_pt_pkt_desc()
743 return snprintf(buf, buf_len, "%s 0x%llx Last CState:%u Deepest CState:%u Wake Reason 0x%x", in intel_pt_pkt_desc()
749 return snprintf(buf, buf_len, "%s SZ %s-byte Type 0x%llx", in intel_pt_pkt_desc()
752 return snprintf(buf, buf_len, "%s ID 0x%02x Value 0x%llx", in intel_pt_pkt_desc()
757 return snprintf(buf, buf_len, "%s 0x%llx (%d)", in intel_pt_pkt_desc()