hi Why is "can't find a register in class ‘AREG’ while reloading ‘asm’" ?
hi all: The codes is: static int match(int len,const char * name,struct dir_entry * de) { register int same __asm__("ax"); if (!de || !de->inode || len > NAME_LEN) return 0; if (len < NAME_LEN && de->name[len]) return 0; *__asm__ ("cld\n\t"* "fs ; repe ; cmpsb\n\t" "setz %%al" :"=a" (same) :"0" (0),"S" ((long) name),"D" ((long) de->name),"c" (len) :"cx","di","si"); return same; } When I make it, the error messages is: *namei.c:35: error: can't find a register in class ‘AREG’ while reloading ‘asm’* * * *This is why? * *Thank you*
I tried compiling this but I get slightly different error: error: can’t find a register in class ‘CREG’ while reloading ‘asm’ this error is because of explicit clobber list which is not needed in this case as all registers in clobber list are input list. Note that it is CREG because it encounter "cx" in clobber list first. -Rajat On Mon, May 27, 2013 at 1:21 PM, lx <lxlenovostar@gmail.com> wrote:
hi all: The codes is: static int match(int len,const char * name,struct dir_entry * de) { register int same __asm__("ax");
if (!de || !de->inode || len > NAME_LEN) return 0; if (len < NAME_LEN && de->name[len]) return 0; *__asm__ ("cld\n\t"* "fs ; repe ; cmpsb\n\t" "setz %%al" :"=a" (same) :"0" (0),"S" ((long) name),"D" ((long) de->name),"c" (len) :"cx","di","si"); return same; }
When I make it, the error messages is: *namei.c:35: error: can't find a register in class ‘AREG’ while reloading ‘asm’* * * *This is why? * *Thank you*
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On Mon, 27 May 2013 15:51:26 +0800, lx said:
When I make it, the error messages is: *namei.c:35: error: can't find a register in class
*This is why? *
Possibility 1: You screwed up the constrains on your asm and didn't leave the compiler any way to allocate CPU registers.. I havent had enough caffeine yet to check that in detail, you're on your own. ;) Possibility 2: Your compiler has a bug in it,. Such thinks happen. If you're using something older than gcc 4.8, either update it or get your vendor to update it, and then try again. If you're using 4.8 and your asm constraints have been verified as OK, please consider filing a gcc bug with your vendor and/or with the GCC team. (I had to keep a copy of gcc 4.6.3 around for a *long* time, because 4.7 would miscompile the NVidia module - I suspect the famous bug where it split a 64-bit operation that needed to be atomic. Then gcc developed another bug where the optimizer choked on one of the VirtualBox modules. Fedora finally shipped a patched 4.8 that didn't have either bug)
participants (3)
-
lx -
Rajat Sharma -
Valdis.Kletnieks@vt.edu