include/exec/helper-head.h: support "const void *" in helper calls
authorDavid Hildenbrand <david@redhat.com>
Thu, 21 Feb 2019 09:34:59 +0000 (10:34 +0100)
committerRichard Henderson <richard.henderson@linaro.org>
Thu, 21 Feb 2019 18:22:24 +0000 (10:22 -0800)
commit8c6edfdd90522caa4fc429144d393aba5b99f584
tree7e4e2ffbd3d2526ac2e0b9c6a86f3a66d25572fe
parent9e564a1dde5abc7ae4cebc115142f685d98938d7
include/exec/helper-head.h: support "const void *" in helper calls

Especially when dealing with out-of-line gvec helpers, it is often
helpful to specify some vector pointers as constant. E.g. when
we have two inputs and one output, marking the two inputs as consts
pointers helps to avoid bugs.

Const pointers can be specified via "cptr", however behave in TCG just
like ordinary pointers. We can specify helpers like:

DEF_HELPER_FLAGS_4(gvec_vbperm, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)

void HELPER(gvec_vbperm)(void *v1, const void *v2, const void *v3,
                         uint32_t desc)

And make sure that here, only v1 will be written (as long as const is
not casted away, of course).

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190221093459.22547-1-david@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
include/exec/helper-head.h