tags:

views:

524

answers:

3

I am trying to convert this function from MSVC++ to MINGW (this is the original MSVC function)

    VOID __declspec(naked) BNSTUB()
{
   __asm
   {
      pushad;
      call OnChatPacketReceived;
      TEST EAX,EAX;

      popad;
      jnz oldCall;

        MOV EAX,0;
      MOV DWORD PTR DS:[EBX+0x6FF3EBA0],1
      ret;
oldCall:
        CALL eax;
        MOV DWORD PTR DS:[EBX+0x6FF3EBA0],1
        ret;

   }
}

But I have problems with pushad and popad. they give me a "undeclared identifier"

A: 

In Mingw it might be called "pushall" instead of "pusha": so try "pushalld" and "popalld".

ChrisW
Actually, it's pushal and popal (without the extra 'l')
Joe D
A: 

You can compile something in C and also keep the assembler listing with -S parameter. That should display the AT&T syntax in all its glory.

Cristian Adam
The code which the compiler emits won't necessarily include an instance of the push-all-registers opcode, however.
ChrisW
+1  A: 

pusha popa (without the d)

TaMaN