What's the meaning of MOV EAX, DWORD PTR SS:[EBP+8h] and how can I translate it into AT&T format?

亡梦爱人 提交于 2019-12-11 06:26:13

问题


I'm using Code::Blocks to code, but one of the code I referenced is from Visual C++,so I have difficulties on the difference...:(

the full code are here

NAKED void ijlWrite()
{
__asm {
    PUSH    EBP
    MOV     EBP, ESP
    MOV     EAX, DWORD PTR SS:[EBP+8h]
    MOV     ECX, ssQuality
    MOV     DWORD PTR DS:[EAX+50h], ECX
    MOV     EDX, DWORD PTR SS:[EBP+0Ch]
    PUSH    EDX
    MOV     EAX, DWORD PTR SS:[EBP+08h]
    PUSH    EAX
    CALL    lpfnIJLWrite //a global variable
    POP     EBP
    RETN
}
}

I'll be very grateful if you translate them all.

P.S. I also don't know how to translate RETN. how to do it? The cheatsheet doesn't have such things:(


回答1:


MOV     EAX, DWORD PTR SS:[EBP+8h]

is equivalent to

movl %ss:8(%ebp), %eax

You just swap the order of the source and destination, the DWORD translates to an l suffix. The %ss: prefix is strictly unnecessary, it's the default when using EBP based memory access.




回答2:


Can't you just write the function in C++? A little more type information would help, but how about this?

void ijlWrite(int* p, int i)
{
    p[80] = ssQuality;
    lpfnIJLWrite(p, i);
}



回答3:


I think it's

movl %ss:8(%ebp), %eax

See this for a quick reference.



来源:https://stackoverflow.com/questions/6160975/whats-the-meaning-of-mov-eax-dword-ptr-ssebp8h-and-how-can-i-translate-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!