1

Please ignore my irritation while writing this, it's been a long day and I haven't been able to find an answer for the past few hours.

Let me be very verbose; I am trying to use C inline asm (seen below) to hook an OpenGL function, I am compiling on Windows, in 64-bit, and with the -masm=intel flag. I've run into an issue where 90% of the asm I try to use throws an error from the assembler. I'm well aware this is because I'm not using Intel-Masm syntax, my main issue is I am unable to find documentation on this specific type of asm. Any help is appreciated.

void __declspec(naked) SwapTrampoline(){
    // asm(
    //     "pushfq\n" // throws error
    //     "call openGlSwapBufferHook\n"
    //     "popfq\n"
    //     "jmp 0x6506CD2B"
    // );
    asm(
        "JMP 7FF94E1C0B8h\n" // (Error: junk `FF94E1C0B8h' after expression)
        "mov [rsp+10], rsi" // throws error
    );
}
Potoo
  • 13
  • 5
  • It's [working](https://godbolt.org/z/aj3bz493W) for me. Are you looking for docs on [inline asm](https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html) or just masm assembler? – David Wohlferd Jul 31 '23 at 01:20
  • @DavidWohlferd Im looking for the docs on whatever I need for inline asm, something that has all instructions, opcodes, ect... And idk if the Compiler Explorer environment is compiling in 64bit b/c im 90% sure thats the problem – Potoo Jul 31 '23 at 01:27
  • Adding `-v` to the compiler options on the Compiler Explorer link gives that it's using `gcc version 13.1.0 (MinGW-W64 x86_64-ucrt-mcf-seh, built by Brecht Sanders)`. Which one do you have locally? – Michael Aug 02 '23 at 15:19
  • @Michael I got `gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)` – Potoo Aug 02 '23 at 20:25

0 Answers0