Commit 661ce781 authored by Adrian Hunter's avatar Adrian Hunter Committed by Namhyung Kim

perf intel-pt: Prefer get_unaligned_le64 to memcpy_le64

Use get_unaligned_le64() instead of memcpy_le64(..., 8) because it produces
simpler code.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Acked-by: default avatarIan Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20231005190451.175568-6-adrian.hunter@intel.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent 3b4fa67f
...@@ -190,7 +190,7 @@ static int intel_pt_get_mnt(const unsigned char *buf, size_t len, ...@@ -190,7 +190,7 @@ static int intel_pt_get_mnt(const unsigned char *buf, size_t len,
if (len < 11) if (len < 11)
return INTEL_PT_NEED_MORE_BYTES; return INTEL_PT_NEED_MORE_BYTES;
packet->type = INTEL_PT_MNT; packet->type = INTEL_PT_MNT;
memcpy_le64(&packet->payload, buf + 3, 8); packet->payload = get_unaligned_le64(buf + 3);
return 11; return 11;
} }
...@@ -302,7 +302,7 @@ static int intel_pt_get_bip_8(const unsigned char *buf, size_t len, ...@@ -302,7 +302,7 @@ static int intel_pt_get_bip_8(const unsigned char *buf, size_t len,
return INTEL_PT_NEED_MORE_BYTES; return INTEL_PT_NEED_MORE_BYTES;
packet->type = INTEL_PT_BIP; packet->type = INTEL_PT_BIP;
packet->count = buf[0] >> 3; packet->count = buf[0] >> 3;
memcpy_le64(&packet->payload, buf + 1, 8); packet->payload = get_unaligned_le64(buf + 1);
return 9; return 9;
} }
...@@ -341,7 +341,7 @@ static int intel_pt_get_evd(const unsigned char *buf, size_t len, ...@@ -341,7 +341,7 @@ static int intel_pt_get_evd(const unsigned char *buf, size_t len,
packet->type = INTEL_PT_EVD; packet->type = INTEL_PT_EVD;
packet->count = buf[2] & 0x3f; packet->count = buf[2] & 0x3f;
packet->payload = buf[3]; packet->payload = buf[3];
memcpy_le64(&packet->payload, buf + 3, 8); packet->payload = get_unaligned_le64(buf + 3);
return 11; return 11;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment