Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions win32/win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -2580,7 +2580,7 @@ set_pioinfo_extra(void)
const uint32_t adrp_id = 0x90000000;
const uint32_t adrp_mask = 0x9f000000;
const uint32_t add_id = 0x11000000;
const uint32_t add_mask = 0x3fc00000;
const uint32_t add_mask = 0x7fc00000;
for(; pc > start; pc--) {
if (IS_INSN(pc, adrp) && IS_INSN(pc + 1, add)) {
break;
Expand All @@ -2600,17 +2600,14 @@ set_pioinfo_extra(void)
const uint32_t adrp_insn = *pc;
const uint32_t adrp_immhi = (adrp_insn & 0x00ffffe0) >> 5;
const uint32_t adrp_immlo = (adrp_insn & 0x60000000) >> (5 + 19 + 5);
/* imm = immhi:immlo:Zeros(12), 64 */
const uint64_t adrp_imm = ((adrp_immhi << 2) | adrp_immlo) << 12;
const int64_t adrp_sign = (adrp_insn & 0x00800000) ? ~0x001fffff : 0;
/* imm = SignExtend(immhi:immlo:Zeros(12), 64) */
const int64_t adrp_imm = (adrp_sign | (adrp_immhi << 2) | adrp_immlo) << 12;
/* base = PC64<63:12>:Zeros(12) */
const uint64_t adrp_base = (uint64_t)pc & 0xfffffffffffff000;

const uint32_t add_insn = *(pc + 1);
const uint32_t add_sh = (add_insn & 0x400000) >> (12 + 5 + 5);
/* case sh of
when '0' imm = ZeroExtend(imm12, datasize);
when '1' imm = ZeroExtend(imm12:Zeros(12), datasize); */
const uint64_t add_imm = ((add_insn & 0x3ffc00) >> (5 + 5)) << (add_sh ? 12 : 0);
const uint64_t add_imm = (add_insn & 0x3ffc00) >> (5 + 5);

__pioinfo = (ioinfo**)(adrp_base + adrp_imm + add_imm);
#else /* _M_ARM64 */
Expand Down
Loading