-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, there seems to be a problem with the assembler code and -fPIC. My question is, it is a gcc problem or a code problem. And how we can solve it ? Here is the error: pcm_dmix_i386.h: In function `mix_areas1': pcm_dmix_i386.h:45: error: PIC register `ebx' clobbered in `asm' pcm_dmix_i386.h: In function `mix_areas1_mmx': pcm_dmix_i386.h:163: error: PIC register `ebx' clobbered in `asm' pcm_dmix_i386.h: In function `mix_areas2': pcm_dmix_i386.h:245: error: PIC register `ebx' clobbered in `asm' pcm_dmix_i386.h: In function `mix_areas1_smp': pcm_dmix_i386.h:45: error: PIC register `ebx' clobbered in `asm' pcm_dmix_i386.h: In function `mix_areas1_smp_mmx': pcm_dmix_i386.h:163: error: PIC register `ebx' clobbered in `asm' pcm_dmix_i386.h: In function `mix_areas2_smp': pcm_dmix_i386.h:245: error: PIC register `ebx' clobbered in `asm' make[2]: *** [pcm_dmix.lo] Error 1 I have attached the header. - -- Jan Killius -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAJjNg6U6IB8YmOOwRAoyqAKCGu2gSnrGTYJiWOab5VrbPE1fqDgCcCKM9 PR3z9vasWsrTfuJx0mcSvzg= =ucpn -----END PGP SIGNATURE-----
/** * \file pcm/pcm_dmix_i386.h * \ingroup PCM_Plugins * \brief PCM Direct Stream Mixing (dmix) Plugin Interface - I386 assembler code * \author Jaroslav Kysela <perex@xxxxxxx> * \date 2003 */ /* * PCM - Direct Stream Mixing * Copyright (c) 2003 by Jaroslav Kysela <perex@xxxxxxx> * * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * for plain i386 */ static void MIX_AREAS1(unsigned int size, volatile signed short *dst, signed short *src, volatile signed int *sum, size_t dst_step, size_t src_step, size_t sum_step) { /* * ESI - src * EDI - dst * EBX - sum * ECX - old sample * EAX - sample / temporary * EDX - temporary */ __asm__ __volatile__ ( "\n" /* * initialization, load ESI, EDI, EBX registers */ "\tmovl %1, %%edi\n" "\tmovl %2, %%esi\n" "\tmovl %3, %%ebx\n" "\tjmp 2f\n" /* * for (;;) */ "\t.p2align 4,,15\n" "1:" "\tadd %4, %%edi\n" "\tadd %5, %%esi\n" "\tadd %6, %%ebx\n" /* * sample = *src; * sum_sample = *sum; * if (cmpxchg(*dst, 0, 1) == 0) * sample -= sum_sample; * xadd(*sum, sample); */ "2:" "\txor %%ax, %%ax\n" "\tmovw %%ax, %%cx\n" "\tincw %%cx\n" "\tmovl (%%ebx), %%edx\n" "\t" LOCK_PREFIX "cmpxchgw %%cx, (%%edi)\n" "\tmovswl (%%esi), %%ecx\n" "\tjnz 3f\n" "\tsubl %%edx, %%ecx\n" "3:" "\t" LOCK_PREFIX "addl %%ecx, (%%ebx)\n" /* * do { * sample = old_sample = *sum; * saturate(v); * *dst = sample; * } while (v != *sum); */ "4:" "\tmovl (%%ebx), %%ecx\n" "\tcmpl $0x7fff,%%ecx\n" "\tjg 5f\n" "\tcmpl $-0x8000,%%ecx\n" "\tjl 6f\n" "\tmovw %%cx, (%%edi)\n" "\tcmpl %%ecx, (%%ebx)\n" "\tjnz 4b\n" /* * while (size-- > 0) */ "\tdecl %0\n" "\tjz 7f\n" "\tjmp 1b\n" /* * sample > 0x7fff */ "\t.p2align 4,,15\n" "5:" "\tmovw $0x7fff, (%%edi)\n" "\tcmpl %%ecx,(%%ebx)\n" "\tjnz 4b\n" "\tdecl %0\n" "\tjnz 1b\n" "\tjmp 7f\n" /* * sample < -0x8000 */ "\t.p2align 4,,15\n" "6:" "\tmovw $-0x8000, (%%edi)\n" "\tcmpl %%ecx, (%%ebx)\n" "\tjnz 4b\n" "\tdecl %0\n" "\tjnz 1b\n" // "\tjmp 6f\n" "7:" : /* no output regs */ : "m" (size), "m" (dst), "m" (src), "m" (sum), "m" (dst_step), "m" (src_step), "m" (sum_step) : "esi", "edi", "edx", "ecx", "ebx", "eax" ); } /* * MMX optimized */ static void MIX_AREAS1_MMX(unsigned int size, volatile signed short *dst, signed short *src, volatile signed int *sum, size_t dst_step, size_t src_step, size_t sum_step) { /* * ESI - src * EDI - dst * EBX - sum * ECX - old sample * EAX - sample / temporary * EDX - temporary */ __asm__ __volatile__ ( "\n" /* * initialization, load ESI, EDI, EBX registers */ "\tmovl %1, %%edi\n" "\tmovl %2, %%esi\n" "\tmovl %3, %%ebx\n" "\tjmp 2f\n" "\t.p2align 4,,15\n" "1:" "\tadd %4, %%edi\n" "\tadd %5, %%esi\n" "\tadd %6, %%ebx\n" "2:" /* * sample = *src; * sum_sample = *sum; * if (cmpxchg(*dst, 0, 1) == 0) * sample -= sum_sample; * xadd(*sum, sample); */ "\txor %%ax, %%ax\n" "\tmovw %%ax, %%cx\n" "\tincw %%cx\n" "\tmovl (%%ebx), %%edx\n" "\t" LOCK_PREFIX "cmpxchgw %%cx, (%%edi)\n" "\tmovswl (%%esi), %%ecx\n" "\tjnz 3f\n" "\tsubl %%edx, %%ecx\n" "3:" "\t" LOCK_PREFIX "addl %%ecx, (%%ebx)\n" /* * do { * sample = old_sample = *sum; * saturate(v); * *dst = sample; * } while (v != *sum); */ "4:" "\tmovl (%%ebx), %%ecx\n" "\tmovd %%ecx, %%mm0\n" "\tpackssdw %%mm1, %%mm0\n" "\tmovd %%mm0, %%eax\n" "\tmovw %%ax, (%%edi)\n" "\tcmpl %%ecx, (%%ebx)\n" "\tjnz 4b\n" /* * while (size-- > 0) */ "\tdecl %0\n" "\tjnz 1b\n" "\temms\n" : /* no output regs */ : "m" (size), "m" (dst), "m" (src), "m" (sum), "m" (dst_step), "m" (src_step), "m" (sum_step) : "esi", "edi", "edx", "ecx", "ebx", "eax" ); } /* * for plain i386, 32-bit version (24-bit resolution) */ static void MIX_AREAS2(unsigned int size, volatile signed int *dst, signed int *src, volatile signed int *sum, size_t dst_step, size_t src_step, size_t sum_step) { /* * ESI - src * EDI - dst * EBX - sum * ECX - old sample * EAX - sample / temporary * EDX - temporary */ __asm__ __volatile__ ( "\n" /* * initialization, load ESI, EDI, EBX registers */ "\tmovl %1, %%edi\n" "\tmovl %2, %%esi\n" "\tmovl %3, %%ebx\n" "\t.p2align 4,,15\n" "1:" /* * sample = *src; * sum_sample = *sum; * if (cmpxchg(*dst, 0, 1) == 0) * sample -= sum_sample; * xadd(*sum, sample); */ "\tmovl $0, %%eax\n" "\tmovl $1, %%ecx\n" "\tmovl (%%ebx), %%edx\n" "\t" LOCK_PREFIX "cmpxchgl %%ecx, (%%edi)\n" "\tjnz 2f\n" "\tmovl (%%esi), %%ecx\n" /* sample >>= 8 */ "\tsarl $8, %%ecx\n" "\tsubl %%edx, %%ecx\n" "\tjmp 21f\n" "2:" "\tmovl (%%esi), %%ecx\n" /* sample >>= 8 */ "\tsarl $8, %%ecx\n" "21:" "\t" LOCK_PREFIX "addl %%ecx, (%%ebx)\n" /* * do { * sample = old_sample = *sum; * saturate(v); * *dst = sample; * } while (v != *sum); */ "3:" "\tmovl (%%ebx), %%ecx\n" /* * if (sample > 0x7fff00) */ "\tmovl $0x7fffff, %%eax\n" "\tcmpl %%eax, %%ecx\n" "\tjg 4f\n" /* * if (sample < -0x800000) */ "\tmovl $-0x800000, %%eax\n" "\tcmpl %%eax, %%ecx\n" "\tjl 4f\n" "\tmovl %%ecx, %%eax\n" "4:" /* * sample <<= 8; */ "\tsall $8, %%eax\n" "\tmovl %%eax, (%%edi)\n" "\tcmpl %%ecx, (%%ebx)\n" "\tjnz 3b\n" /* * while (size-- > 0) */ "\tdecl %0\n" "\tjz 6f\n" "\tadd %4, %%edi\n" "\tadd %5, %%esi\n" "\tadd %6, %%ebx\n" "\tjmp 1b\n" "6:" : /* no output regs */ : "m" (size), "m" (dst), "m" (src), "m" (sum), "m" (dst_step), "m" (src_step), "m" (sum_step) : "esi", "edi", "edx", "ecx", "ebx", "eax" ); }