tcg: set up tb->page_addr before insertion

This ensures that if we find the TB on the slow path that tb->page_addr
is correctly set before being tested.

Backports commit 2e1ae44a4f4a6149fbb9dc812243522f07284700 from qemu
This commit is contained in:
Alex Bennée 2018-02-26 01:49:56 -05:00 committed by Lioncash
parent 30845ae475
commit 62aa0abd02
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -1237,12 +1237,6 @@ static void tb_link_page(struct uc_struct *uc,
uint32_t h;
TranslationBlock **ptb;
/* add in the hash table */
h = tb_hash_func(phys_pc, tb->pc, tb->flags);
ptb = &tcg_ctx->tb_ctx.tb_phys_hash[h];
tb->phys_hash_next = *ptb;
*ptb = tb;
/* add in the page list */
tb_alloc_page(uc, tb, 0, phys_pc & TARGET_PAGE_MASK);
if (phys_page2 != -1) {
@ -1251,6 +1245,12 @@ static void tb_link_page(struct uc_struct *uc,
tb->page_addr[1] = -1;
}
/* add in the hash table */
h = tb_hash_func(phys_pc, tb->pc, tb->flags);
ptb = &tcg_ctx->tb_ctx.tb_phys_hash[h];
tb->phys_hash_next = *ptb;
*ptb = tb;
#ifdef DEBUG_TB_CHECK
tb_page_check();
#endif