Add support for ALLOC and TRANS opcodes to apf_disassemble()
Support ALLOC and TRANS opcodes in apf_disassemble() and export it in
libapfdisassembler for JNI use.
Bug: 293811969
Test: TH
Change-Id: Ie077ab9f4eefbfac15e0da1ccb101fc39df33ec5
diff --git a/disassembler.c b/disassembler.c
index 830e621..091ff9e 100644
--- a/disassembler.c
+++ b/disassembler.c
@@ -17,7 +17,7 @@
#include <stdint.h>
#include <stdio.h>
-#include "apf.h"
+#include "v5/apf.h"
// If "c" is of a signed type, generate a compile warning that gets promoted to an error.
// This makes bounds checking simpler because ">= 0" can be avoided. Otherwise adding
@@ -344,6 +344,28 @@
ASSERT_RET_INBOUND(ret);
offset += ret;
break;
+ case ALLOC_EXT_OPCODE:
+ ret = print_opcode("alloc", output_buffer,
+ output_buffer_len, offset);
+ ASSERT_RET_INBOUND(ret);
+ offset += ret;
+ ret =
+ snprintf(output_buffer + offset,
+ output_buffer_len - offset, "r%d", reg_num);
+ ASSERT_RET_INBOUND(ret);
+ offset += ret;
+ break;
+ case TRANS_EXT_OPCODE:
+ ret = print_opcode("trans", output_buffer,
+ output_buffer_len, offset);
+ ASSERT_RET_INBOUND(ret);
+ offset += ret;
+ ret =
+ snprintf(output_buffer + offset,
+ output_buffer_len - offset, "r%d", reg_num);
+ ASSERT_RET_INBOUND(ret);
+ offset += ret;
+ break;
default:
ret = snprintf(output_buffer + offset,
output_buffer_len - offset, "unknown_ext %u",