Why is this machine code created for "inc qword [rsp]"?

Consider this assembly of NASA x64 syntax:

inc qword [rax]
inc qword [rcx]
inc qword [rdx]
inc qword [rbx]
inc qword [rsp]
inc qword [rbp]
inc qword [rsi]
inc qword [rdi]

After building using nasm (and linking to gnu ld) objdump -dit reports the following:

4000b0:       48 ff 00                incq   (%rax)
4000b3:       48 ff 01                incq   (%rcx)
4000b6:       48 ff 02                incq   (%rdx)
4000b9:       48 ff 03                incq   (%rbx)
4000bc:       48 ff 04 24             incq   (%rsp)
4000c0:       48 ff 45 00             incq   0x0(%rbp)
4000c4:       48 ff 06                incq   (%rsi)
4000c7:       48 ff 07                incq   (%rdi)

The code generated for inc qword [rbp]makes sense since a mod field is specified. However, I canโ€™t understand where it comes from 24during assembly inc qword [rsp]. I looked at coder64 #xFF and nothing there tells me that 24 should be generated. I am clearly missing something at a higher level.

+5
source share
1 answer

No [RSP] ModR / M bytes. Therefore, it uses [sib] ModR / M. Sib stands for sib byte , and 0x24 stands for sib byte for RSP.

+7
source

All Articles