I need to insert a pointer into EAX and the other into the EBX register. At first I solved this with:
register int eax asm("eax"); register int ebx asm("ebx"); int main() { eax = ptr1; ebx = ptr2; }
Which worked like a charm. However, when I added this to another code, I got strange errors stating that gcc could not find the register to spill in the AREG class, in a completely unrelated part of the code. I googled, and it turned out that this is actually a bug in gcc -.-. So, I need another way to insert two pointers into the eax and ebx registers. Does anyone have any ideas?
Edit:
As people ask what I'm trying to achieve here, I thought I would explain a little.
I need to change eax and ebx for some assembler code that I am trying to run in my program. I need to execute this assembler code and give a pointer to a parameter through the eax and ebx registers. I execute the assembler code by clicking the pointer to it in ebx and calling ebx. When I do not call the register, globally, but locally, the assembly code crashes. If I call it globally, I get this strange error at the end of a random function. When I delete these functions, it throws the same error into another random function. Until my functions run out, then it works, but then I miss the rest of the code: P
source share