# 作者(author): 孙海勇 # 发布协议(License): GPL v2 # 邮件(email): youbest@sina.com # 说明:此补丁用于修正Linux-2.6.26在gcc-4.4的snapshot版本中的编译为龙芯2f优化的编译问题。 diff -Nur linux-2.6.26.orig/Makefile linux-2.6.26.2e/Makefile --- linux-2.6.26.orig/Makefile 2008-07-14 05:51:29.000000000 +0800 +++ linux-2.6.26.2e/Makefile 2008-08-04 11:50:35.994537879 +0800 @@ -330,7 +330,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) -KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ +KBUILD_CFLAGS := -march=loongson2f -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common \ -Werror-implicit-function-declaration KBUILD_AFLAGS := -D__ASSEMBLY__ diff -Nur linux-2.6.26.orig/arch/mips/Makefile linux-2.6.26.2e/arch/mips/Makefile --- linux-2.6.26.orig/arch/mips/Makefile 2008-07-14 05:51:29.000000000 +0800 +++ linux-2.6.26.2e/arch/mips/Makefile 2008-08-04 11:47:15.828028497 +0800 @@ -119,7 +119,8 @@ cflags-$(CONFIG_CPU_VR41XX) += -march=r4100 -Wa,--trap cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap -cflags-$(CONFIG_CPU_LOONGSON2) += -march=r4600 -Wa,--trap +cflags-$(CONFIG_CPU_LOONGSON2) += -march=loongson2e -Wa,--trap +cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f -Wa,--trap cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ -Wa,-mips32 -Wa,--trap cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ diff -Nur linux-2.6.26.orig/drivers/usb/core/urb.c linux-2.6.26.2e/drivers/usb/core/urb.c --- linux-2.6.26.orig/drivers/usb/core/urb.c 2008-07-14 05:51:29.000000000 +0800 +++ linux-2.6.26.2e/drivers/usb/core/urb.c 2008-08-12 09:46:14.352370137 +0800 @@ -444,7 +444,7 @@ return -EINVAL; } /* Round down to a power of 2, no more than max */ - urb->interval = min(max, 1 << ilog2(urb->interval)); + urb->interval = min(max, 1 << __ilog2_u64(urb->interval)); } return usb_hcd_submit_urb(urb, mem_flags); diff -Nur linux-2.6.26.orig/include/asm-mips/delay.h linux-2.6.26.2e/include/asm-mips/delay.h --- linux-2.6.26.orig/include/asm-mips/delay.h 2008-07-14 05:51:29.000000000 +0800 +++ linux-2.6.26.2e/include/asm-mips/delay.h 2008-08-04 16:02:17.692042089 +0800 @@ -82,12 +82,14 @@ : "=h" (usecs), "=l" (lo) : "r" (usecs), "r" (lpj) : GCC_REG_ACCUM); - else if (sizeof(long) == 8 && !R4000_WAR) - __asm__("dmultu\t%2, %3" - : "=h" (usecs), "=l" (lo) - : "r" (usecs), "r" (lpj) - : GCC_REG_ACCUM); - else if (sizeof(long) == 8 && R4000_WAR) + else if (sizeof(long) == 8 && !R4000_WAR){ + //__asm__("dmultu\t%2, %3" + //: "=h" (usecs), "=l" (lo) + //: "r" (usecs), "r" (lpj) + //: GCC_REG_ACCUM); + typedef unsigned int uint128_t __attribute__((mode(TI))); + usecs = ((uint128_t) usecs * lpj) >> 64; + }else if (sizeof(long) == 8 && R4000_WAR) __asm__("dmultu\t%3, %4\n\tmfhi\t%0" : "=r" (usecs), "=h" (hi), "=l" (lo) : "r" (usecs), "r" (lpj)