Skip to contentSkip to conversation

target-xtensa: return EINVAL for unimplemented simcalls

PATCH Superseded Max Filippov 1 participant 2 messages Aug 22, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-xtensa: return EINVAL for unimplemented simcalls

This prevents guest from proceeding with uninitialised garbage returned from unimplemented simcalls.

---
 target-xtensa/xtensa-semi.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
target-xtensa/xtensa-semi.c +2 -0
index 1c8a19e..9afa99d 100644
@@ -218,6 +218,8 @@ void HELPER(simcall)(CPUXtensaState *env)
 
     default:
         qemu_log("%s(%d): not implemented\n", __func__, regs[2]);
+        regs[2] = -1;
+        regs[3] = EINVAL;
         break;
     }
 }
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 2 lines · Max Filippov

This prevents guest from proceeding with uninitialised garbage returned from unimplemented simcalls.

Oops, looks like ENOSYS is the right errno for that.

Signature · 2 lines
Thanks.
-- Max