Results 1 to 2 of 2
Dear all,
I am trying to install Window make r in my Fedora core 6 , i686 arch,
but when i compile it using make , it gives me this ...
- 03-12-2008 #1Just Joined!
- Join Date
- Oct 2006
- Posts
- 47
problem compiling inline assembly code in c
Dear all,
I am trying to install Window make r in my Fedora core 6 , i686 arch,
but when i compile it using make , it gives me this error
Please give me light on this.......Code:[root@sourabha-lnx WindowMaker-0.92.0]# make Making all in wrlib make[1]: Entering directory `/root/WindowMaker-0.92.0/wrlib' cd .. && automake-1.4 --gnu --include-deps wrlib/Makefile cd .. \ && CONFIG_FILES=wrlib/Makefile CONFIG_HEADERS= /bin/sh ./config.status config.status: creating wrlib/Makefile config.status: executing default-1 commands make[1]: Leaving directory `/root/WindowMaker-0.92.0/wrlib' make[1]: Entering directory `/root/WindowMaker-0.92.0/wrlib' Making all in . make[2]: Entering directory `/root/WindowMaker-0.92.0/wrlib' `echo /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../src -I/usr/local/include -g -O2 | sed -e s/-fomit-frame-pointer//` -O0 -fomit-frame-pointer -c x86_specific.c gcc -DHAVE_CONFIG_H -I. -I. -I../src -I/usr/local/include -g -O2 -O0 -fomit-frame-pointer -c x86_specific.c -fPIC -DPIC -o .libs/x86_specific.o x86_specific.c: In function 'x86_mmx_TrueColor_32_to_16': x86_specific.c:107: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm' make[2]: *** [x86_specific.lo] Error 1 make[2]: Leaving directory `/root/WindowMaker-0.92.0/wrlib' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/root/WindowMaker-0.92.0/wrlib' make: *** [all-recursive] Error 1 [root@sourabha-lnx WindowMaker-0.92.0]#
- 03-12-2008 #2Just Joined!
- Join Date
- Oct 2006
- Posts
- 47
Dear all,
I am trying to install Window maker in my Fedora core 6 , i686 arch,
but when i compile it using make , it gives me this error
Please give me light on this.......Code:[root@sourabha-lnx WindowMaker-0.92.0]# make Making all in wrlib make[1]: Entering directory `/root/WindowMaker-0.92.0/wrlib' cd .. && automake-1.4 --gnu --include-deps wrlib/Makefile cd .. \ && CONFIG_FILES=wrlib/Makefile CONFIG_HEADERS= /bin/sh ./config.status config.status: creating wrlib/Makefile config.status: executing default-1 commands make[1]: Leaving directory `/root/WindowMaker-0.92.0/wrlib' make[1]: Entering directory `/root/WindowMaker-0.92.0/wrlib' Making all in . make[2]: Entering directory `/root/WindowMaker-0.92.0/wrlib' `echo /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../src -I/usr/local/include -g -O2 | sed -e s/-fomit-frame-pointer//` -O0 -fomit-frame-pointer -c x86_specific.c gcc -DHAVE_CONFIG_H -I. -I. -I../src -I/usr/local/include -g -O2 -O0 -fomit-frame-pointer -c x86_specific.c -fPIC -DPIC -o .libs/x86_specific.o x86_specific.c: In function 'x86_mmx_TrueColor_32_to_16': x86_specific.c:107: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm' make[2]: *** [x86_specific.lo] Error 1 make[2]: Leaving directory `/root/WindowMaker-0.92.0/wrlib' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/root/WindowMaker-0.92.0/wrlib' make: *** [all-recursive] Error 1 [root@sourabha-lnx WindowMaker-0.92.0]#
code of x86_specific.c is as follows:
Code:void x86_mmx_TrueColor_32_to_16(unsigned char *image, unsigned short *ximage, short *err, short *nerr, short *rtable, short *gtable, short *btable, int dr, int dg, int db, unsigned int roffs, unsigned int goffs, unsigned int boffs, int width, int height, int line_offset) { long long rrggbbaa; long long pixel; short *tmp_err; short *tmp_nerr; int x; asm volatile ( "pushal \n\t" // pack dr, dg and db into mm6 "movl %7, %%eax \n\t" "movl %8, %%ebx \n\t" "movl %9, %%ecx \n\t" "movw %%ax, %16 \n\t" "movw %%bx, %17 \n\t" "movw %%cx, %18 \n\t" "movw $0, %19 \n\t" "movq %16, %%mm6 \n\t" // dr dg db 0 // pack 4|4|4|4 into mm7, for shifting (/16) "movl $0x00040004, %16 \n\t" "movl $0x00040004, %18 \n\t" "movq %16, %%mm7 \n\t" // store constant values for using with mmx when dithering "movl $0x00070007, %16 \n\t" "movl $0x00070007, %18 \n\t" "movq %16, %%mm5 \n\t" "movl $0x00050005, %16 \n\t" "movl $0x00050005, %18 \n\t" "movq %16, %%mm4 \n\t" "movl $0x00030003, %16 \n\t" "movl $0x00030003, %18 \n\t" "movq %16, %%mm3 \n\t" // process 1 pixel / cycle, each component treated as 16bit "movl %0, %%esi \n" // esi = image->data ".LoopYa: \n\t" "movl %13, %%eax \n\t" "movl %%eax, %26 \n\t" // x = width "movl %14, %%eax \n\t" "decl %%eax \n\t" // y-- "movl %%eax, %14 \n\t" "js .Enda \n\t" // if y < 0, goto end "andl $1, %%eax \n\t" "jz .LoopY_1a \n" // if (y&1) goto LoopY_1 ".LoopY_0a: \n\t" "movl %2, %%ebx \n\t" // ebx = err "movl %%ebx, %25 \n\t" // [-36] = err "movl %3, %%eax \n\t" // "movl %%eax, %24 \n\t" // [-32] = nerr "jmp .LoopXa \n" ".LoopY_1a: \n\t" "movl %3, %%ebx \n\t" // ebx = nerr "movl %%ebx, %25 \n\t" // [-36] = nerr "movl %2, %%eax \n\t" // "movl %%eax, %24 \n\t" // [-32] = eerr ".align 16 \n" ".LoopXa: \n\t" // calculate errors and pixel components // depend on ebx, esi, mm6 "movq (%%ebx), %%mm1 \n\t" // mm1 = error[0..3] "punpcklbw (%%esi), %%mm0 \n\t" // mm0 = image->data[0..3] "psrlw $8, %%mm0 \n\t" // fixup mm0 "paddusb %%mm1, %%mm0 \n\t" // mm0 = mm0 + mm1 (sat. to 255) "movq %%mm0, %20 \n\t" // save the pixel "movzwl %20, %%ecx \n\t" // ecx = pixel.red "movl %4, %%edi \n\t" // edi = rtable //agi "leal (%%edi, %%ecx, 2), %%eax \n\t" // eax = &rtable[pixel.red] // agi "movw (%%eax), %%dx \n\t" // dx = rtable[pixel.red] "movw %%dx, %16 \n\t" // save rr "movzwl %21, %%ecx \n\t" // ecx = pixel.green "movl %5, %%edi \n\t" // edi = gtable //agi "leal (%%edi, %%ecx, 2), %%eax \n\t" // eax = >able[pixel.green] //agi "movw (%%eax), %%dx \n\t" // dx = gtable[pixel.green] "movw %%dx, %17 \n\t" // save gg "movzwl %22, %%ecx \n\t" // ecx = pixel.blue "movl %6, %%edi \n\t" // ebx = btable //agi "leal (%%edi, %%ecx, 2), %%eax \n\t" // eax = &btable[pixel.blue] //agi "movw (%%eax), %%dx \n\t" // dx = btable[pixel.blue] "movw %%dx, %18 \n\t" // save bb "movw $0, %19 \n\t" // save dummy aa "movq %16, %%mm1 \n\t" // load mm1 with rrggbbaa "pmullw %%mm6, %%mm1 \n\t" // mm1 = rr*dr|... "psubsw %%mm1, %%mm0 \n\t" // error = pixel - mm1 // distribute the error // depend on mm0, mm7, mm3, mm4, mm5 "movl %25, %%ebx \n\t" "movq %%mm0, %%mm1 \n\t" "pmullw %%mm5, %%mm1 \n\t" // mm1 = mm1*7 "psrlw %%mm7, %%mm1 \n\t" // mm1 = mm1/16 "paddw 8(%%ebx), %%mm1 \n\t" "movq %%mm1, 8(%%ebx) \n\t" // err[x+1,y] = rer*7/16 "movl %24, %%ebx \n\t" "movq %%mm0, %%mm1 \n\t" "pmullw %%mm4, %%mm1 \n\t" // mm1 = mm1*5 "psrlw %%mm7, %%mm1 \n\t" // mm1 = mm1/16 "paddw -8(%%ebx), %%mm1 \n\t" "movq %%mm1, -8(%%ebx) \n\t" // err[x-1,y+1] += rer*3/16 "movq %%mm0, %%mm1 \n\t" "pmullw %%mm3, %%mm1 \n\t" // mm1 = mm1*3 "psrlw %%mm7, %%mm1 \n\t" // mm1 = mm1/16 "paddw 8(%%ebx), %%mm1 \n\t" "movq %%mm1, (%%ebx) \n\t" // err[x,y+1] += rer*5/16 "psrlw %%mm7, %%mm0 \n\t" // mm0 = mm0/16 "movq %%mm0, 8(%%ebx) \n\t" // err[x+1,y+1] = rer/16 // calculate final pixel value and store "movl %10, %%ecx \n\t" "movw %16, %%ax \n\t" "shlw %%cl, %%ax \n\t" //NP* ax = r<<roffs "movl %11, %%ecx \n\t" "movw %17, %%bx \n\t" "shlw %%cl, %%bx \n\t" //NP* "orw %%bx, %%ax \n\t" "movl %12, %%ecx \n\t" "movw %18, %%bx \n\t" "shlw %%cl, %%bx \n\t" //NP* "orw %%bx, %%ax \n\t" "movl %1, %%edx \n\t" "movw %%ax, (%%edx) \n\t" "addl $2, %%edx \n\t" // increment ximage "movl %%edx, %1 \n\t" // prepare for next iteration on X "addl $8, %24 \n\t" // nerr += 8 "movl %25, %%ebx \n\t" "addl $8, %%ebx \n\t" "movl %%ebx, %25 \n\t" // ebx = err += 8 // Note: in the last pixel, this would cause an invalid memory access // because, punpcklbw is used (which reads 8 bytes) and the last // pixel is only 4 bytes. This is no problem because the image data // was allocated with extra 4 bytes when created. "addl $4, %%esi \n\t" // image->data += 4 "decl %26 \n\t" // x-- "jnz .LoopXa \n\t" // if x>0, goto .LoopX // depend on edx "addl %15, %%edx \n\t" // add extra offset to ximage "movl %%edx, %1 \n\t" "jmp .LoopYa \n" ".Enda: \n\t" // THE END "emms \n\t" "popal \n\t" : : "m" (image), // %0 "m" (ximage), // %1 "m" (err), // %2 "m" (nerr), // %3 "m" (rtable), // %4 "m" (gtable), // %5 "m" (btable), // %6 "m" (dr), // %7 "m" (dg), // %8 "m" (db), // %9 "m" (roffs), // %10 "m" (goffs), // %11 "m" (boffs), // %12 "m" (width), // %13 "m" (height), // %14 "m" (line_offset), // %15 "m" (rrggbbaa), // %16 (access to rr) "m" ((*((short*)(&rrggbbaa)+1))), // %17 (access to gg) "m" ((*((short*)(&rrggbbaa)+2))), // %18 (access to bb) "m" ((*((short*)(&rrggbbaa)+3))), // %19 (access to aa) "m" (pixel), // %20 (access to pixel.r) "m" ((*((short*)(&pixel)+1))), // %21 (access to pixel.g) "m" ((*((short*)(&pixel)+2))), // %22 (access to pixel.b) "m" ((*((short*)(&pixel)+3))), // %23 (access to pixel.a) "m" (tmp_err), // %24 "m" (tmp_nerr), // %25 "m" (x) // %26 ); }


Reply With Quote