libipt, block: use pt_insn_decode() for handling SKD022

When checking for SKD022, we need to decode an instruction at the event's IP.
Use pt_insn_decode() for that to support instructions crossing section
boundaries.

Change-Id: Ideea9068f8a1c64b6706faf9f349a3ad044574ef
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
diff --git a/libipt/src/pt_block_decoder.c b/libipt/src/pt_block_decoder.c
index 8cb93da..9a97b39 100644
--- a/libipt/src/pt_block_decoder.c
+++ b/libipt/src/pt_block_decoder.c
@@ -1513,7 +1513,7 @@
 {
 	struct pt_insn_ext iext;
 	struct pt_insn insn;
-	int size, errcode;
+	int errcode;
 
 	if (!decoder || !ev)
 		return -pte_internal;
@@ -1521,17 +1521,7 @@
 	insn.mode = decoder->mode;
 	insn.ip = ev->variant.async_disabled.at;
 
-	size = pt_image_read(decoder->image, &insn.isid, insn.raw,
-			     sizeof(insn.raw), &decoder->asid, insn.ip);
-	if (size < 0)
-		return 0;
-
-	/* We initialize @insn.size to the maximal possible size.  It will be
-	 * set to the actual size during instruction decode.
-	 */
-	insn.size = (uint8_t) size;
-
-	errcode = pt_ild_decode(&insn, &iext);
+	errcode = pt_insn_decode(&insn, &iext, decoder->image, &decoder->asid);
 	if (errcode < 0)
 		return 0;