"Rus V. Brushkoff" wrote: > > No, gcc-2.95 is ok, the only thing is that new gcc is more strict about > asm constraints. > Allright, according to that, I've realized a patch for rtai-0.8 which make compilation with gcc-2.95 correct. I'have not insert, like your patch, an auto freq determination, cause the calibrating modules works well on my machine and I think it is more precise than a one-shoot calibration. So this patch only modify the asm constraint to relax registers contraint already in use. Chris. -- Kumsta Christophe <[EMAIL PROTECTED]> Real-Time System developper RT-Linux/RTAI ( Use the Source Luck !)
diff -ur rtai-0.8/apic_freq_calibration/rt_cal.c rtai-0.8-patched/apic_freq_calibration/rt_cal.c --- rtai-0.8/apic_freq_calibration/rt_cal.c Wed Nov 3 10:28:25 1999 +++ rtai-0.8-patched/apic_freq_calibration/rt_cal.c Thu Nov 18 09:17:00 1999 @@ -34,12 +34,12 @@ gcount++; if (++count == RESET_COUNT) { apic.time = tbase - apic.time; - __asm__ __volatile__("movl %%cr0,%%eax": "=a" (linux_cr0): : "ax"); + __asm__ __volatile__("movl %%cr0,%%eax": "=a" (linux_cr0)); __asm__ __volatile__("clts; fnsave %0": "=m" (fpu_reg)); freq = (double)apic.time_lh[1]*(double)0x100000000LL + (double)apic.time_lh[0]; count = (freq*CLOCK_TICK_RATE)/(((double)gcount)*LATCH) + 0.4999999999999; __asm__ __volatile__("frstor %0" : "=m" (fpu_reg)); - __asm__ __volatile__("movl %%eax,%%cr0": :"a" (linux_cr0): "ax"); + __asm__ __volatile__("movl %%eax,%%cr0": :"a" (linux_cr0)); printk("\n->>> MEASURED APIC_FREQ: %d (Hz) (%d s) <<<-\n", count, gcount/100 + 1); count = 0; } diff -ur rtai-0.8/cpu_freq_calibration/rt_cal.c rtai-0.8-patched/cpu_freq_calibration/rt_cal.c --- rtai-0.8/cpu_freq_calibration/rt_cal.c Wed Nov 3 10:28:25 1999 +++ rtai-0.8-patched/cpu_freq_calibration/rt_cal.c Thu Nov 18 09:11:55 1999 @@ -29,12 +29,12 @@ gcount++; if (++count == RESET_COUNT) { tsc.time -= tbase; - __asm__ __volatile__("movl %%cr0,%%eax": "=a" (linux_cr0): : "ax"); + __asm__ __volatile__("movl %%cr0,%%eax": "=a" (linux_cr0)); __asm__ __volatile__("clts; fnsave %0": "=m" (fpu_reg)); freq = (double)tsc.time_lh[1]*(double)0x100000000LL + (double)tsc.time_lh[0]; count = (freq*CLOCK_TICK_RATE)/(((double)gcount)*LATCH) + 0.4999999999999; __asm__ __volatile__("frstor %0" : "=m" (fpu_reg)); - __asm__ __volatile__("movl %%eax,%%cr0": :"a" (linux_cr0): "ax"); + __asm__ __volatile__("movl %%eax,%%cr0": :"a" (linux_cr0)); printk("\n->>> MEASURED CPU_FREQ: %d (Hz) (%d s) <<<-\n", count, gcount/100 + 1); count = 0; } diff -ur rtai-0.8/include/rtai.h rtai-0.8-patched/include/rtai.h --- rtai-0.8/include/rtai.h Wed Nov 17 16:46:03 1999 +++ rtai-0.8-patched/include/rtai.h Thu Nov 18 09:38:20 1999 @@ -337,9 +337,7 @@ { union {unsigned long long time; unsigned long time_lh[2]; } tsc; __asm__ __volatile__( "rdtsc" - : "=a" (tsc.time_lh[0]), "=d" (tsc.time_lh[1]) - : - :"ax", "dx"); + : "=a" (tsc.time_lh[0]), "=d" (tsc.time_lh[1])); return tsc.time; } @@ -349,23 +347,23 @@ __asm__("imull %%edx ; idiv %%ecx; sal $1,%%edx \n\t" "cmpl %%edx,%%ecx; jge 1f; incl %%eax; 1:" : "=a" (i) - : "a" (i), "d" (mult), "c" (div) - : "%eax", "%ecx", "%edx"); + : "a" (i), "d" (mult), "c" (div)) ; return i; } // returns (long long)ll = (int)ll*(int)(mult)/(int)div. static inline long long llimd(long long ll, int mult, int div) { +int dummy, dummy1; __asm__( "movl %%edx,%%ecx; mull %%esi; movl %%eax,%%ebx; \n\t" "movl %%ecx,%%eax; movl %%edx,%%ecx; mull %%esi; \n\t" "addl %%ecx,%%eax; adcl $0,%%edx; divl %%edi; \n\t" "movl %%eax,%%ecx; movl %%ebx,%%eax; divl %%edi; \n\t" "sal $1,%%edx; cmpl %%edx,%%edi; movl %%ecx,%%edx; \n\t" "jge 1f; addl $1,%%eax; adcl $0,%%edx; 1:" - : "=A" (ll) + : "=A" (ll), "=S" (dummy), "=D" (dummy1) : "A" (ll), "S" (mult), "D" (div) - : "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi" ); + : "%ebx", "%ecx"); return ll; } diff -ur rtai-0.8/include/rtai_lxrt.h rtai-0.8-patched/include/rtai_lxrt.h --- rtai-0.8/include/rtai_lxrt.h Thu Nov 4 13:41:32 1999 +++ rtai-0.8-patched/include/rtai_lxrt.h Thu Nov 18 09:45:35 1999 @@ -26,7 +26,7 @@ { long long retval; __asm__ __volatile__ ("int $0xFC" - : "=A" (retval) : "a" (srq), "d" (arg) : "%eax", "%edx"); + : "=A" (retval) : "a" (srq), "d" (arg) ); return retval; } diff -ur rtai-0.8/include/rtai_shm.h rtai-0.8-patched/include/rtai_shm.h --- rtai-0.8/include/rtai_shm.h Thu Nov 4 13:42:55 1999 +++ rtai-0.8-patched/include/rtai_shm.h Thu Nov 18 09:46:04 1999 @@ -65,7 +65,7 @@ { long long retval; __asm__ __volatile__ ("int $0xFD" - : "=A" (retval) : "a" (srq), "d" (whatever) : "%eax", "%edx"); + : "=A" (retval) : "a" (srq), "d" (whatever) ); return retval; } diff -ur rtai-0.8/mupscheduler/rtai_sched.c rtai-0.8-patched/mupscheduler/rtai_sched.c --- rtai-0.8/mupscheduler/rtai_sched.c Fri Nov 5 14:16:53 1999 +++ rtai-0.8-patched/mupscheduler/rtai_sched.c Thu Nov 18 09:18:20 1999 @@ -106,7 +106,7 @@ popl %%eax\n\t" \ : \ : "c" (&oldtask), "d" (newtask) \ - : "bx", "cx", "dx"); + : "bx"); static RT_TASK *rt_smp_current[NR_RT_CPUS]; Binary files rtai-0.8/newfifos/check and rtai-0.8-patched/newfifos/check differ diff -ur rtai-0.8/posix/examples/clockif_test.c rtai-0.8-patched/posix/examples/clockif_test.c --- rtai-0.8/posix/examples/clockif_test.c Wed Nov 3 10:28:25 1999 +++ rtai-0.8-patched/posix/examples/clockif_test.c Thu Nov 18 09:50:49 1999 @@ -42,8 +42,7 @@ struct timespec t_spec; __asm__("idivl %%ecx\n\t" :"=a" (t_spec.tv_sec), "=d" (t_spec.tv_nsec) - : "A" (t), "c" (NSECS_PER_SEC) - :"cx"); + : "A" (t), "c" (NSECS_PER_SEC)); if (t_spec.tv_nsec < 0) { t_spec.tv_nsec += NSECS_PER_SEC; t_spec.tv_sec --; @@ -56,8 +55,7 @@ { __asm__("idivl %%ecx\n\t" :"=a" (t_spec->tv_sec), "=d" (t_spec->tv_nsec) - : "A" (t), "c" (NSECS_PER_SEC) - :"cx"); + : "A" (t), "c" (NSECS_PER_SEC)); if (t_spec->tv_nsec < 0) { t_spec->tv_nsec += NSECS_PER_SEC; t_spec->tv_sec --; diff -ur rtai-0.8/posix/include/rtai_pthread_int.h rtai-0.8-patched/posix/include/rtai_pthread_int.h --- rtai-0.8/posix/include/rtai_pthread_int.h Wed Nov 3 10:28:25 1999 +++ rtai-0.8-patched/posix/include/rtai_pthread_int.h Thu Nov 18 09:49:00 1999 @@ -111,8 +111,7 @@ { __asm__("idivl %%ecx\n\t" :"=a" (t_spec->tv_sec), "=d" (t_spec->tv_nsec) - : "A" (t), "c" (NSECS_PER_SEC) - :"cx"); + : "A" (t), "c" (NSECS_PER_SEC)); if (t_spec->tv_nsec < 0) { t_spec->tv_nsec += NSECS_PER_SEC; t_spec->tv_sec --; diff -ur rtai-0.8/rtai.c rtai-0.8-patched/rtai.c --- rtai-0.8/rtai.c Thu Nov 4 13:36:41 1999 +++ rtai-0.8-patched/rtai.c Thu Nov 18 09:14:43 1999 @@ -59,7 +59,7 @@ #define SAVE_REG(irq) __asm__ __volatile__ (" \ pushl $"#irq"; pushl %es; pushl %ds; pushl %eax;\n\t \ pushl %ebp; pushl %ecx; pushl %edx;\n\t \ - movl $" STR(__KERNEL_DS) ",%edx; movl %dx,%ds; movl %dx,%es") + movl $" STR(__KERNEL_DS) ",%edx; movl %edx,%ds; movl %edx,%es") #define RSTR_REG __asm__ __volatile__ (" \ popl %edx; popl %ecx; testl %eax,%eax; jnz 1f;\n\t \ @@ -93,7 +93,7 @@ cld; pushl %es; pushl %ds; pushl %ebp;\n\t \ pushl %edi; pushl %esi; pushl %ecx;\n\t \ pushl %ebx; pushl %edx; pushl %eax;\n\t \ - movl $" STR(__KERNEL_DS) ",%ebx; movl %bx,%ds; movl %bx,%es"); + movl $" STR(__KERNEL_DS) ",%ebx; movl %ebx,%ds; movl %ebx,%es"); __asm__ __volatile__ ("call "SYMBOL_NAME_STR(dispatch_srq)); diff -ur rtai-0.8/smpscheduler/rtai_sched.c rtai-0.8-patched/smpscheduler/rtai_sched.c --- rtai-0.8/smpscheduler/rtai_sched.c Fri Nov 5 13:41:34 1999 +++ rtai-0.8-patched/smpscheduler/rtai_sched.c Thu Nov 18 09:15:32 1999 @@ -145,7 +145,7 @@ popl %%eax\n\t" \ : \ : "c" (&oldtask), "d" (newtask) \ - : "bx", "cx", "dx"); + : "bx"); static RT_TASK *rt_smp_current[NR_RT_CPUS]; diff -ur rtai-0.8/upscheduler/rtai_sched.c rtai-0.8-patched/upscheduler/rtai_sched.c --- rtai-0.8/upscheduler/rtai_sched.c Fri Nov 5 14:16:36 1999 +++ rtai-0.8-patched/upscheduler/rtai_sched.c Thu Nov 18 09:16:13 1999 @@ -106,8 +106,7 @@ popl %%ebp\n\t \ popl %%eax\n\t" \ : \ - : "c" (tsk) \ - :"cx"); + : "c" (tsk)); static RT_TASK *rt_current;