Hi
I have a very simple problem; I have an array which should store me the results of some inline assembler routine. The question that I have is now how can I move the data from the inline assembler into the array? I am using gcc for compiling on an x86 machine. Consider the following simple code fragement:
int main() {
int result[32];
__asm__ __volatile__( ".mov esi, 32 \n\t");
__asm__ __volatile__( ".mov edi, 32 \n\t");
__asm__ __volatile__( ".rept 32 \n\t");
__asm__ __volatile__( ".mov eax, esi \n\t");
__asm__ __volatile__( ".sub eax, edi \n\t");
__asm__ __volatile__( ".sub edi, 1 \n\t");
//Code here for storing eax in result[0], result[1], ... result[31],
__asm__ __volatile__( ".endr \n\t");
for(i=0; i<32; i++)
printf("%d\n", results[i]);
return (0);
}
At the end, the output should look something like that:
result[0] = 32; result[1] = 31; result[2] = 30; ... result[31] = 1;
Anyone an idea, how this could be simple done?
Thanks!