diff --git a/src/backend/x64/a64_emit_x64.cpp b/src/backend/x64/a64_emit_x64.cpp index c9755392..a0f54edc 100644 --- a/src/backend/x64/a64_emit_x64.cpp +++ b/src/backend/x64/a64_emit_x64.cpp @@ -707,9 +707,9 @@ void A64EmitX64::EmitA64SetExclusive(A64EmitContext& ctx, IR::Inst* inst) { } static Xbyak::RegExp EmitVAddrLookup(BlockOfCode& code, A64EmitContext& ctx, Xbyak::Label& abort, Xbyak::Reg64 vaddr, boost::optional arg_scratch = {}) { - constexpr size_t PAGE_BITS = 12; - constexpr size_t PAGE_SIZE = 1 << PAGE_BITS; - const size_t valid_page_index_bits = ctx.conf.page_table_address_space_bits - PAGE_BITS; + constexpr size_t page_bits = 12; + constexpr size_t page_size = 1 << page_bits; + const size_t valid_page_index_bits = ctx.conf.page_table_address_space_bits - page_bits; const size_t unused_top_bits = 64 - ctx.conf.page_table_address_space_bits; Xbyak::Reg64 page_table = arg_scratch.value_or_eval([&]{ return ctx.reg_alloc.ScratchGpr(); }); @@ -717,18 +717,18 @@ static Xbyak::RegExp EmitVAddrLookup(BlockOfCode& code, A64EmitContext& ctx, Xby code.mov(page_table, reinterpret_cast(ctx.conf.page_table)); code.mov(tmp, vaddr); if (unused_top_bits == 0) { - code.shr(tmp, int(PAGE_BITS)); + code.shr(tmp, int(page_bits)); } else if (ctx.conf.silently_mirror_page_table) { if (valid_page_index_bits >= 32) { code.shl(tmp, int(unused_top_bits)); - code.shr(tmp, int(unused_top_bits + PAGE_BITS)); + code.shr(tmp, int(unused_top_bits + page_bits)); } else { - code.shr(tmp, int(PAGE_BITS)); + code.shr(tmp, int(page_bits)); code.and_(tmp, u32((1 << valid_page_index_bits) - 1)); } } else { ASSERT(valid_page_index_bits < 32); - code.shr(tmp, int(PAGE_BITS)); + code.shr(tmp, int(page_bits)); code.test(tmp, u32(-(1 << valid_page_index_bits))); code.jnz(abort, code.T_NEAR); } @@ -736,7 +736,7 @@ static Xbyak::RegExp EmitVAddrLookup(BlockOfCode& code, A64EmitContext& ctx, Xby code.test(page_table, page_table); code.jz(abort, code.T_NEAR); code.mov(tmp, vaddr); - code.and_(tmp, static_cast(PAGE_SIZE - 1)); + code.and_(tmp, static_cast(page_size - 1)); return page_table + tmp; }