[RFC 05/16] objtool: arm64: Handle hypercalls as nops

From: Raphael Gault
Date: Thu May 16 2019 - 06:40:56 EST


We consider that the hypervisor/secure-monitor is behaving
correctly. This enables us to handle hvc/smc/svc context switching
instructions as nop since we consider that the context is restored
correctly. This enables us to get rid of the "unsupported instruction
in callable function" warning which is not really useful.

Note that those instruction/warnings are caused by hypervisor-related
calls.

Signed-off-by: Raphael Gault <raphael.gault@xxxxxxx>
---
tools/objtool/arch/arm64/decode.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/objtool/arch/arm64/decode.c b/tools/objtool/arch/arm64/decode.c
index 721152342dd3..6c77ad1a08ec 100644
--- a/tools/objtool/arch/arm64/decode.c
+++ b/tools/objtool/arch/arm64/decode.c
@@ -577,8 +577,11 @@ int arm_decode_except_gen(u32 instr, unsigned char *type,
case INSN_SVC:
case INSN_HVC:
case INSN_SMC:
- *immediate = imm16;
- *type = INSN_CONTEXT_SWITCH;
+ /*
+ * We consider that the context will be restored correctly
+ * with an unchanged sp and the same general registers
+ */
+ *type = INSN_NOP;
return 0;
case INSN_BRK:
if (imm16 == 0x800)
--
2.17.1