title: RDTSC in C inline assembly causes segmentation fault!
body: <p>Thanks to some help of you guys I got my little inline assembler program almost there where I want it to have. However, there now seems to happen something very strange with the rdtsc command; basically, I get a segmentation fault when calling it.</p>
  
  <pre><code>int timings[64*N];
  int main(void)
  {
  
      int i;
  
      __asm__ __volatile__ (  
         "lea edx, [timings] \n\t"  
         "rdtsc \n\t"  
         ".rept 32 \n\t"  
         "mov eax,[edx] \n\t"  
         "inc eax \n\t"  
         "mov dword ptr [edx], eax \n\t"  
         "add edx, 4 \n\t"  
         ".endr \n\t"  
      : 
      : [timings] "m" (*timings)
     );
  
     for(i=0; i&lt;32; i++)
        printf("%d\n", timings[i]); 
  
     return 0;
  }
  </code></pre>
  
  <p>Leaving out the rdtsc, then the program compiles and it does what it should do. But adding the rdtsc line causes the segmentation fault. I am running this stuff on a dual core machine and use for compilation: gcc -masm=intel test.c</p>
  
  <p>Help would be appreciated!</p>