Hello,
I've noticed a possible discrepancy between the comment and the behavior
of i386's prepare_host_addr (located at tcg/i386/tcg-target.c.inc, line
2157-2260):
```
/*
* For softmmu, perform the TLB load and compare.
* For useronly, perform any required alignment tests.
* In both cases, return a TCGLabelQemuLdst structure if the slow path
* is required and fill in @h with the host address for the fast path.
*/
static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h,
TCGReg addr, MemOpIdx oi,
bool is_ld)
{
TCGLabelQemuLdst *ldst = NULL;
...
if (tcg_use_softmmu) {
...
ldst = new_ldst_label(s);
ldst->is_ld = is_ld;
ldst->oi = oi;
ldst->addr_reg = addr;
...
} else if (a_mask) {
...
}
return ldst;
}
```
The code appears to always assign (in case of softmmu) a label to `ldst`
and return it,
contrary to what the comment suggests (that, "in both cases [of softmmu
and useronly],
return a TCGLabelQemuLdst structure *if the slow path is required*".)
As I understand it, there is no way to determine, at this point, which
of the two paths to use;
the generated machine code (see L2233-2237), not the C code here,
performs the TLB comparison.
I am currently building a modified version of QEMU for my undergraduate
project, and this is
one of the most complicated code paths I've had to deal with.
I hope this is the right place to ask these kinds of questions, and if
not, please let me know.
Thanks,
Shusaku KURAMITSU
Dept. of Computer Science and Networks
School of Computer Science and Systems Engineering
Kyushu Institute of Technology, Japan