问题
I am trying to do a negative offset for memory addressing. This is to convert a number to a string and make sure that it doesn't print in reverse order since x86 is little endian. Here is what I'm trying to do:
# (b) move the asci number to rbp-8-len (to print in reverse)
movb %al, -8(%rbp, %r12, -1)
I know -1
is not a valid size, but I've shown what I'm trying to do conceptually above. What would be the proper way to do this?
Currently, I am doing it like:
# (b) move the asci number to rbp-8-len (to print in reverse)
# store offset (8+len) in %r13
mov $-8, %r13
sub %r12, %r13
movb %dl, (%rbp, %r13)
来源:https://stackoverflow.com/questions/63965249/how-to-do-a-reverse-offset-index-in-x86