Messages in this thread Patch in this message | | | Date | Wed, 29 Sep 1999 20:01:55 +0200 (MET DST) | From | Mikael Pettersson <> | Subject | [PATCH] 2.3.18ac10: sbni.c compile failure + fix |
| |
Attempting to build Linux kernel 2.3.18ac10 with CONFIG_SBNI=y and gcc-2.95.1 results in:
sbni.c: In function `sbni_ioctl': sbni.c:1283: warning: assignment makes pointer from integer without a cast sbni.c: In function `calc_crc': sbni.c:1375: Invalid `asm' statement: sbni.c:1375: fixed or forbidden register 1 (dx) was spilled for class DREG. sbni.c:1377: warning: control reaches end of non-void function make[4]: *** [sbni.o] Error 1
There are three problems: 1. sbni.c hasn't been updated to use the new dev_get/dev_put stuff in kernels >= 2.3.15. 2. The asm-optimized version of sbni's calc_crc() function uses illegal asm() which clobbers input registers. 3. The asm-optimized version of sbni's calc_crc() function is type-incorrect since it lacks a return statement.
The patch below fixes these problems. gcc-2.95.1 now generates exactly the same code for calc_crc() as egcs-1.1.2 did for the original code. (The calc_crc() fixes should also be applied to drivers/net/sbni.c in 2.2.13pre.)
/Mikael
--- linux-2.3.18ac10/drivers/net/wan/sbni.c.~1~ Wed Sep 29 14:39:25 1999 +++ linux-2.3.18ac10/drivers/net/wan/sbni.c Wed Sep 29 18:55:18 1999 @@ -1280,10 +1280,12 @@ return -EPERM; if(copy_from_user( tmpstr, ifr->ifr_data, 6)) return -EFAULT; - slave=dev_get(tmpstr); + slave = dev_get_by_name(tmpstr); if(!(slave && slave->flags & IFF_UP && dev->flags & IFF_UP)) { printk("%s: Both devices should be UP to enslave!\n",dev->name); + if (slave) + dev_put(slave); return -EINVAL; } @@ -1304,8 +1306,9 @@ else { printk("%s: one of devices is already slave!\n",dev->name); - return -EBUSY; + error = -EBUSY; } + dev_put(slave); } else { @@ -1359,7 +1362,7 @@ unsigned long calc_crc(char *mem, int len, unsigned initial) { - + unsigned crc, dummy_len; __asm__ ( "xorl %%eax,%%eax\n\t" "1:\n\t" @@ -1367,13 +1370,12 @@ "xorb %%dl,%%al\n\t" "shrl $8,%%edx\n\t" "xorl (%%edi,%%eax,4),%%edx\n\t" - "loop 1b\n\t" - "movl %%edx,%%eax" - : - : "S" (mem), "D" (&crc32tab[0]), "c" (len), "d" (initial) - : "eax", "edx", "ecx" + "loop 1b" + : "=d" (crc), "=c" (dummy_len) + : "S" (mem), "D" (&crc32tab[0]), "1" (len), "0" (initial) + : "eax" ); - /* return crc; */ + return crc; } #else - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |