views:

20

answers:

1

How can I prepend a SS: or ES: using AT&T Assembly Syntax without adding in a .byte 0x36 or .byte 0x26?

ie. How would I be able to convert mov dword ptr ss:[esp+0x10], offset foo from Intel syntax to AT&T without using:

.byte   0x36
movl    $foo, 0x10(%esp)

I have tried movl $foo, %ss:0x10(%esp) which assembles without warnings but, looking through the binary, still does not add in SS:

+2  A: 

IIRC, the SS: prefix is not required when used with the ESP and EBP registers, because for these, it is already the default.

This might be the reason why the assembler simply omits it to conserve space; therefore the need to manually emit the SS: prefix as a 0x36 byte, as the assembler won't modify raw bytes.

stakx
Oh, I didn't know that! The MSVC assembler seems to add it in though... But is `movl $foo, %ss:0x10(%esp)` the correct way to add it in?
kotarou3
Okay, just checked, and it is
kotarou3