On 04/08/2016 10:20 AM, Tom Hanson wrote: > Is it an option to mask off the tag bits in all cases? Is there any case > it which those bits are valid address bits?
It's not impossible to mask off bits in the address -- we do that for running 32-bit on 64-bit all of the time. It's all a question of how well the average program will perform, I suppose. For instance. Are there more tagged addresses than non-tagged addresses? If we mask off bits, that will affect *every* memory operation. If tagged addresses are rare, then that is a waste. If tagged addresses are common, however, then we may well spend too much time ping-ponging in the TLB. The fastest method I can think of to ignore high order bits is to shift the address comparator left. The TLB comparator would be stored pre-shifted, so this would add only one insn on the fast path. Or perhaps zero in the case of an arm/aarch64 host, where the compare insn itself can perform the shift. Of course, a double-word shift would be completely out of the question when doing 64-bit on 32-bit emulation. But we don't need that -- just shift the high part of the address left to discard bits, leaving a funny looking hole in the middle of the comparator. This is simple enough that it should be relatively easy to patch up all of the tcg backends to match, if we decide to go with it. r~