I wrote an assembler function to speed up the image processing (images are created using CreateDIBSection).
For Win32, the assembler code works without problems, but for Win64 I get a crash as soon as I try to access the array data.
I put the relevant information in a structure, and my assembler function gets a pointer to that structure. The structure pointer is placed in ebx / rbx and with indexing I read the data from the structure.
Any idea what I'm doing wrong? I use nasm with Visual Studio 2008, and for Win64 I set "default rel".
C ++ Code:
struct myData {
tUInt32 ulParam1;
void* pData;
};
CallMyAssemblerFunction(&myData);
Assembly code:
Win32:
...
push ebp;
mov ebp,esp
mov ebx, [ebp + 8]; pointer to our struct
mov eax, [ebx]; ulParam1
mov esi, [ebx + 4]; pData, 4 byte pointer
movd xmm0, [esi];
...
Win64:
...
mov rbx, rcx; pointer to our struct
mov eax, [rbx]; ulParam1
mov rsi, [rbx + 4]; pData, 8 byte pointer
movd xmm0, [rsi]; CRASH!
...