1

I've tried hard to figure out what addr32 means in assembly code. For example, I use gdb to trace a binary; below is part of the code.

adcx   %r13,%r13                                #! PC = 0x55555557d9fb
adox   %rcx,%r10                                #! PC = 0x55555557da01
adcx   %r14,%r14                                #! PC = 0x55555557da07
addr32 mulx %rdx,%rcx,%rbp                      #! PC = 0x55555557da0d
mov    0x98(%rsi),%rdx                          #! EA = L0x7fffffffdc68; Value = 0x0000000000000000; PC = 0x55555557da13
adox   %rax,%r11                                #! PC = 0x55555557da1a
adcx   %r15,%r15                                #! PC = 0x55555557da20
adox   %rcx,%r12                                #! PC = 0x55555557da26
mov    $0x20,%rsi                               #! PC = 0x55555557da2c
adox   %rbp,%r13                                #! PC = 0x55555557da33
addr32 addr32 mulx %rdx,%rcx,%rax               #! PC = 0x55555557da39

What does the addr32 in line4 exactly mean? And why there's a double addr32 in the last line?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Alex Lai
  • 33
  • 4

1 Answers1

3

addr32 is the prefix 67h. It does not have an effect on instructions without memory operands.

On instructions with memory operands, it changes the address size to 32 bit.

Now as for why the prefix is used here, I don't know. It could be some sort of padding or to avoid some sort of microarchitectural bug.

fuz
  • 88,405
  • 25
  • 200
  • 352
  • 3
    I wouldn't be surprised if this is from [How can I mitigate the impact of the Intel jcc erratum on gcc?](https://stackoverflow.com/q/61256646) padding to make a later macro-fused cmp/jcc not touch a 32-byte boundary. Or if assemblers have gotten smarter about using instruction-padding to implement `.p2align` in general instead of using NOPs, could be that! It does look like a sensible sequence of instructions mixing mulx and ado/cx, not disassembly of non-code data. – Peter Cordes Jul 07 '22 at 04:17
  • To note: the `asize` prefix is `a32` in 64-bit and 16-bit code segments, but is `a16` in 32-bit code segments. (All of them default to address size matching the code segment bitness. `a64` is only available in a 64-bit code segment, and `a16` is only available in code segments that are not 64 bits.) – ecm Jul 07 '22 at 07:53