Proton/vrclient_x64/flatapi.c
Józef Kucia d687b83fcb vrclient: Generate call_flat_method() functions.
In order to remove hardcoded limit for parameter count in C API
functions.
2018-07-30 09:34:15 +02:00

140 lines
4.1 KiB
C

/* This file is auto-generated, do not edit. */
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "cxx.h"
#include "flatapi.h"
#ifdef __i386__
__ASM_GLOBAL_FUNC(call_flat_method,
"popl %eax\n\t"
"pushl %ecx\n\t"
"pushl %eax\n\t"
"jmp *%edx");
#else
// handles "this" and up to 3 parameters
__ASM_GLOBAL_FUNC(call_flat_method,
"movq %r8, %r9\n\t" // shift over arguments
"movq %rdx, %r8\n\t"
"movq %rcx, %rdx\n\t"
"movq %r10, %rcx\n\t" // add This pointer
"jmp *%r11");
extern void call_flat_method(void);
__ASM_GLOBAL_FUNC(call_flat_method4,
"subq $0x28, %rsp\n\t"
"movq %r9, 0x20(%rsp)\n\t"
"movq %r8, %r9\n\t" // shift over arguments
"movq %rdx, %r8\n\t"
"movq %rcx, %rdx\n\t"
"movq %r10, %rcx\n\t" // add This pointer
"call *%r11\n\t"
"addq $0x28, %rsp\n\t"
"ret");
extern void call_flat_method4(void);
__ASM_GLOBAL_FUNC(call_flat_method5,
"subq $0x38, %rsp\n\t"
"movq %r9, 0x20(%rsp)\n\t"
"movq 0x60(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x28(%rsp)\n\t"
"movq %r8, %r9\n\t" // shift over arguments
"movq %rdx, %r8\n\t"
"movq %rcx, %rdx\n\t"
"movq %r10, %rcx\n\t" // add This pointer
"call *%r11\n\t"
"addq $0x38, %rsp\n\t"
"ret");
extern void call_flat_method5(void);
__ASM_GLOBAL_FUNC(call_flat_method6,
"subq $0x38, %rsp\n\t"
"movq %r9, 0x20(%rsp)\n\t"
"movq 0x60(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x28(%rsp)\n\t"
"movq 0x68(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x30(%rsp)\n\t"
"movq %r8, %r9\n\t" // shift over arguments
"movq %rdx, %r8\n\t"
"movq %rcx, %rdx\n\t"
"movq %r10, %rcx\n\t" // add This pointer
"call *%r11\n\t"
"addq $0x38, %rsp\n\t"
"ret");
extern void call_flat_method6(void);
__ASM_GLOBAL_FUNC(call_flat_method7,
"subq $0x48, %rsp\n\t"
"movq %r9, 0x20(%rsp)\n\t"
"movq 0x70(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x28(%rsp)\n\t"
"movq 0x78(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x30(%rsp)\n\t"
"movq 0x80(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x38(%rsp)\n\t"
"movq %r8, %r9\n\t" // shift over arguments
"movq %rdx, %r8\n\t"
"movq %rcx, %rdx\n\t"
"movq %r10, %rcx\n\t" // add This pointer
"call *%r11\n\t"
"addq $0x48, %rsp\n\t"
"ret");
extern void call_flat_method7(void);
__ASM_GLOBAL_FUNC(call_flat_method8,
"subq $0x48, %rsp\n\t"
"movq %r9, 0x20(%rsp)\n\t"
"movq 0x70(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x28(%rsp)\n\t"
"movq 0x78(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x30(%rsp)\n\t"
"movq 0x80(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x38(%rsp)\n\t"
"movq 0x88(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x40(%rsp)\n\t"
"movq %r8, %r9\n\t" // shift over arguments
"movq %rdx, %r8\n\t"
"movq %rcx, %rdx\n\t"
"movq %r10, %rcx\n\t" // add This pointer
"call *%r11\n\t"
"addq $0x48, %rsp\n\t"
"ret");
extern void call_flat_method8(void);
__ASM_GLOBAL_FUNC(call_flat_method9,
"subq $0x58, %rsp\n\t"
"movq %r9, 0x20(%rsp)\n\t"
"movq 0x80(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x28(%rsp)\n\t"
"movq 0x88(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x30(%rsp)\n\t"
"movq 0x90(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x38(%rsp)\n\t"
"movq 0x98(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x40(%rsp)\n\t"
"movq 0xa0(%rsp), %rax\n\t" // copy parameter
"movq %rax, 0x48(%rsp)\n\t"
"movq %r8, %r9\n\t" // shift over arguments
"movq %rdx, %r8\n\t"
"movq %rcx, %rdx\n\t"
"movq %r10, %rcx\n\t" // add This pointer
"call *%r11\n\t"
"addq $0x58, %rsp\n\t"
"ret");
extern void call_flat_method9(void);
pfn_call_flat_method get_call_flat_method_pfn( int param_count )
{
if (param_count <= 3) return call_flat_method;
if (param_count == 4) return call_flat_method4;
if (param_count == 5) return call_flat_method5;
if (param_count == 6) return call_flat_method6;
if (param_count == 7) return call_flat_method7;
if (param_count == 8) return call_flat_method8;
return call_flat_method9;
}
#endif