1

ptr16:16/ptr16:32 -> The value to the left of the colon is a 16-bit selector or value destined for the code segment register. The value to the right corresponds to the offset within the destination segment

So I assume that code like fs:[0x00] counts as a ptr16:32, right? Or does it not? What is a selector?

m16&32, m16&16, m32&32 -> A memory operand consisting of data item pairs whose sizes are indicated on the left and the right side of the ampersand.

This one I do not understand at all. I have seen the : notation before in assembly code, hence why I figured a possible meaning to the notation above, but for this one I have absolutely no idea.

I have read through the relevant parts of the latest Intel manual, but have not gone trough all 5000+ pages so perhaps this is explained somewhere and I do not know.

I would like to understand what these are and how they would look in an example assembly code and how to interpret them, if possible.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Carol Victor
  • 331
  • 1
  • 7
  • A 16:16 or 16:32 pointer can be an immediate operand (in far [call](https://ulukai.org/ecm/doc/insref.htm#insCALL) opcode 9Ah or far [jmp](https://ulukai.org/ecm/doc/insref.htm#insJMP) opcode EAh) or a memory operand (opcode FFh /3 or FFh /5). The memory operand of a far pointer is a type of m16&16 or m16&32. Other instructions that use multi-item memory operands are for example [bound](https://ulukai.org/ecm/doc/insref.htm#insBOUND) and [lgdt](https://ulukai.org/ecm/doc/insref.htm#insLGDT) alikes (lidt, lldt). – ecm Dec 02 '20 at 11:45
  • 1
    `fs:[0x00]` is an addressing mode (with a segment override prefix). It could *point to* a `m32`, a `m16:32` or whatever in memory. It can't *be* a `ptr16:32`, that's only for absolute direct far jump / call. https://www.felixcloutier.com/x86/call. This is discussed some in [How to read the Intel Opcode notation](https://stackoverflow.com/q/15017659) – Peter Cordes Dec 02 '20 at 11:51
  • The duplicates I found aren't *exact* duplicates, but do show examples of syntax for far `jmp ptr16:32`, or at least the 16-bit mode equivalent `ptr16:16`. Perhaps we should reopen this if someone wants to write a short answer that directly answers it. It's not something you'll ever use unless you're writing 16-bit code, or developing an OS, not even for thread-local storage like `fs:[0]`. – Peter Cordes Dec 02 '20 at 11:59
  • So if the example with FS could be any of those, why are they separated to begin with? If it's just an immediate value, that I assume can only either be 8, 16 or 32-bits in 32-bit x86 assembly, why are they separated that way? – Carol Victor Dec 02 '20 at 12:02
  • 1
    No, `ptr16:32` is 48 bits total. A 32-bit mode far pointer, including a segment selector value. That's what makes them special, and why `fs:[0]` is not an example of it. – Peter Cordes Dec 02 '20 at 12:17
  • So immediate operands can be longer than the size of a standard word of the processor it runs on? Is M80Dec an 80-bit immediate operand? Is Xmm/M128 a 128-bit immediate operand? – Carol Victor Dec 02 '20 at 12:32

0 Answers0