tcg: forbid ld/st function to modify globals

Mapping a memory address using a global and accessing it through
ld/st operations is currently broken. As it doesn't make any sense
to do that performance wise, let's forbid that.

Update the TCG documentation, and remove partial support for that.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
Aurelien Jarno 2012-10-09 21:53:08 +02:00
parent 344028ba0f
commit b202d41ee7
2 changed files with 10 additions and 7 deletions

View File

@ -349,6 +349,9 @@ st32_i64 t0, t1, offset
write(t0, t1 + offset) write(t0, t1 + offset)
Write 8, 16, 32 or 64 bits to host memory. Write 8, 16, 32 or 64 bits to host memory.
All this opcodes assume that the pointed host memory doesn't correspond
to a global. In the latter case the behaviour is unpredictable.
********* 64-bit target on 32-bit host support ********* 64-bit target on 32-bit host support
The following opcodes are internal to TCG. Thus they are to be implemented by The following opcodes are internal to TCG. Thus they are to be implemented by

View File

@ -57,9 +57,9 @@ DEF(ld8s_i32, 1, 1, 1, 0)
DEF(ld16u_i32, 1, 1, 1, 0) DEF(ld16u_i32, 1, 1, 1, 0)
DEF(ld16s_i32, 1, 1, 1, 0) DEF(ld16s_i32, 1, 1, 1, 0)
DEF(ld_i32, 1, 1, 1, 0) DEF(ld_i32, 1, 1, 1, 0)
DEF(st8_i32, 0, 2, 1, TCG_OPF_SIDE_EFFECTS) DEF(st8_i32, 0, 2, 1, 0)
DEF(st16_i32, 0, 2, 1, TCG_OPF_SIDE_EFFECTS) DEF(st16_i32, 0, 2, 1, 0)
DEF(st_i32, 0, 2, 1, TCG_OPF_SIDE_EFFECTS) DEF(st_i32, 0, 2, 1, 0)
/* arith */ /* arith */
DEF(add_i32, 1, 2, 0, 0) DEF(add_i32, 1, 2, 0, 0)
DEF(sub_i32, 1, 2, 0, 0) DEF(sub_i32, 1, 2, 0, 0)
@ -115,10 +115,10 @@ DEF(ld16s_i64, 1, 1, 1, IMPL64)
DEF(ld32u_i64, 1, 1, 1, IMPL64) DEF(ld32u_i64, 1, 1, 1, IMPL64)
DEF(ld32s_i64, 1, 1, 1, IMPL64) DEF(ld32s_i64, 1, 1, 1, IMPL64)
DEF(ld_i64, 1, 1, 1, IMPL64) DEF(ld_i64, 1, 1, 1, IMPL64)
DEF(st8_i64, 0, 2, 1, TCG_OPF_SIDE_EFFECTS | IMPL64) DEF(st8_i64, 0, 2, 1, IMPL64)
DEF(st16_i64, 0, 2, 1, TCG_OPF_SIDE_EFFECTS | IMPL64) DEF(st16_i64, 0, 2, 1, IMPL64)
DEF(st32_i64, 0, 2, 1, TCG_OPF_SIDE_EFFECTS | IMPL64) DEF(st32_i64, 0, 2, 1, IMPL64)
DEF(st_i64, 0, 2, 1, TCG_OPF_SIDE_EFFECTS | IMPL64) DEF(st_i64, 0, 2, 1, IMPL64)
/* arith */ /* arith */
DEF(add_i64, 1, 2, 0, IMPL64) DEF(add_i64, 1, 2, 0, IMPL64)
DEF(sub_i64, 1, 2, 0, IMPL64) DEF(sub_i64, 1, 2, 0, IMPL64)