Index: projects/mips/share/mk/bsd.cpu.mk =================================================================== --- projects/mips/share/mk/bsd.cpu.mk (revision 195668) +++ projects/mips/share/mk/bsd.cpu.mk (revision 195669) @@ -1,224 +1,224 @@ # $FreeBSD$ # Set default CPU compile flags and baseline CPUTYPE for each arch. The # compile flags must support the minimum CPU type for each architecture but # may tune support for more advanced processors. .if !defined(CPUTYPE) || empty(CPUTYPE) _CPUCFLAGS = . if ${MACHINE_ARCH} == "i386" MACHINE_CPU = i486 . elif ${MACHINE_ARCH} == "amd64" MACHINE_CPU = amd64 sse2 sse . elif ${MACHINE_ARCH} == "ia64" MACHINE_CPU = itanium . elif ${MACHINE_ARCH} == "powerpc" MACHINE_CPU = aim . elif ${MACHINE_ARCH} == "sparc64" . elif ${MACHINE_ARCH} == "arm" MACHINE_CPU = arm . elif ${MACHINE_ARCH} == "mips" MACHINE_CPU = mips . endif .else # Handle aliases (not documented in make.conf to avoid user confusion # between e.g. i586 and pentium) . if ${MACHINE_ARCH} == "i386" . if ${CPUTYPE} == "nocona" CPUTYPE = prescott . elif ${CPUTYPE} == "core" || ${CPUTYPE} == "core2" CPUTYPE = prescott . elif ${CPUTYPE} == "p4" CPUTYPE = pentium4 . elif ${CPUTYPE} == "p4m" CPUTYPE = pentium4m . elif ${CPUTYPE} == "p3" CPUTYPE = pentium3 . elif ${CPUTYPE} == "p3m" CPUTYPE = pentium3m . elif ${CPUTYPE} == "p-m" CPUTYPE = pentium-m . elif ${CPUTYPE} == "p2" CPUTYPE = pentium2 . elif ${CPUTYPE} == "i686" CPUTYPE = pentiumpro . elif ${CPUTYPE} == "i586/mmx" CPUTYPE = pentium-mmx . elif ${CPUTYPE} == "i586" CPUTYPE = pentium . elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \ ${CPUTYPE} == "k8" CPUTYPE = athlon-mp . elif ${CPUTYPE} == "k7" CPUTYPE = athlon . endif . elif ${MACHINE_ARCH} == "amd64" . if ${CPUTYPE} == "prescott" || ${CPUTYPE} == "core2" CPUTYPE = nocona . endif . endif ############################################################################### # Logic to set up correct gcc optimization flag. This must be included # after /etc/make.conf so it can react to the local value of CPUTYPE # defined therein. Consult: # http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html # http://gcc.gnu.org/onlinedocs/gcc/IA_002d64-Options.html # http://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html # http://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html # http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html . if ${MACHINE_ARCH} == "i386" . if ${CPUTYPE} == "crusoe" _CPUCFLAGS = -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0 . elif ${CPUTYPE} == "k5" _CPUCFLAGS = -march=pentium . else _CPUCFLAGS = -march=${CPUTYPE} . endif # GCC on 'i386' . if ${CPUTYPE} == "crusoe" _ICC_CPUCFLAGS = -tpp6 -xiM . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \ ${CPUTYPE} == "athlon-4" _ICC_CPUCFLAGS = -tpp6 -xiMK . elif ${CPUTYPE} == "athlon-tbird" || ${CPUTYPE} == "athlon" _ICC_CPUCFLAGS = -tpp6 -xiM . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" || ${CPUTYPE} == "k6" _ICC_CPUCFLAGS = -tpp6 -xi . elif ${CPUTYPE} == "k5" _ICC_CPUCFLAGS = -tpp5 . elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m" _ICC_CPUCFLAGS = -tpp7 -xiMKW . elif ${CPUTYPE} == "pentium3" || ${CPUTYPE} == "pentium3m" || \ ${CPUTYPE} == "pentium-m" _ICC_CPUCFLAGS = -tpp6 -xiMK . elif ${CPUTYPE} == "pentium2" || ${CPUTYPE} == "pentiumpro" _ICC_CPUCFLAGS = -tpp6 -xiM . elif ${CPUTYPE} == "pentium-mmx" _ICC_CPUCFLAGS = -tpp5 -xM . elif ${CPUTYPE} == "pentium" _ICC_CPUCFLAGS = -tpp5 . else _ICC_CPUCFLAGS = . endif # ICC on 'i386' . elif ${MACHINE_ARCH} == "amd64" _CPUCFLAGS = -march=${CPUTYPE} . elif ${MACHINE_ARCH} == "arm" . if ${CPUTYPE} == "xscale" #XXX: gcc doesn't seem to like -mcpu=xscale, and dies while rebuilding itself #_CPUCFLAGS = -mcpu=xscale _CPUCFLAGS = -march=armv5te -D__XSCALE__ . else _CPUCFLAGS = -mcpu=${CPUTYPE} . endif . elif ${MACHINE_ARCH} == "powerpc" . if ${CPUTYPE} == "e500" MACHINE_CPU = booke _CPUCFLAGS = -Wa,-me500 -msoft-float . else _CPUCFLAGS = -mcpu=${CPUTYPE} -mno-powerpc64 . endif . elif ${MACHINE_ARCH} == "mips" . if ${CPUTYPE} == "mips32" _CPUCFLAGS = -march=mips32 . elif ${CPUTYPE} == "mips32r2" _CPUCFLAGS = -march=mips32r2 . elif ${CPUTYPE} == "mips64" _CPUCFLAGS = -march=mips64 . elif ${CPUTYPE} == "mips64r2" _CPUCFLAGS = -march=mips64r2 . elif ${CPUTYPE} == "mips4kc" _CPUCFLAGS = -march=4kc . elif ${CPUTYPE} == "mips24kc" _CPUCFLAGS = -march=24kc . endif . endif # Set up the list of CPU features based on the CPU type. This is an # unordered list to make it easy for client makefiles to test for the # presence of a CPU feature. . if ${MACHINE_ARCH} == "i386" . if ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" MACHINE_CPU = athlon-xp athlon k7 3dnow sse2 sse mmx k6 k5 i586 i486 i386 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \ ${CPUTYPE} == "athlon-4" MACHINE_CPU = athlon-xp athlon k7 3dnow sse mmx k6 k5 i586 i486 i386 . elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird" MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386 . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386 . elif ${CPUTYPE} == "k6" MACHINE_CPU = mmx k6 k5 i586 i486 i386 . elif ${CPUTYPE} == "k5" MACHINE_CPU = k5 i586 i486 i386 . elif ${CPUTYPE} == "c3" MACHINE_CPU = 3dnow mmx i586 i486 i386 . elif ${CPUTYPE} == "c3-2" MACHINE_CPU = sse mmx i586 i486 i386 . elif ${CPUTYPE} == "c7" MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386 . elif ${CPUTYPE} == "prescott" MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386 . elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m" || ${CPUTYPE} == "pentium-m" MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386 . elif ${CPUTYPE} == "pentium3" || ${CPUTYPE} == "pentium3m" MACHINE_CPU = sse i686 mmx i586 i486 i386 . elif ${CPUTYPE} == "pentium2" MACHINE_CPU = i686 mmx i586 i486 i386 . elif ${CPUTYPE} == "pentiumpro" MACHINE_CPU = i686 i586 i486 i386 . elif ${CPUTYPE} == "pentium-mmx" MACHINE_CPU = mmx i586 i486 i386 . elif ${CPUTYPE} == "pentium" MACHINE_CPU = i586 i486 i386 . elif ${CPUTYPE} == "i486" MACHINE_CPU = i486 i386 . elif ${CPUTYPE} == "i386" MACHINE_CPU = i386 . endif . elif ${MACHINE_ARCH} == "amd64" . if ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || ${CPUTYPE} == "k8" MACHINE_CPU = k8 3dnow . elif ${CPUTYPE} == "nocona" MACHINE_CPU = sse3 . endif MACHINE_CPU += amd64 sse2 sse mmx . elif ${MACHINE_ARCH} == "ia64" . if ${CPUTYPE} == "itanium" MACHINE_CPU = itanium . endif . endif .endif .if ${MACHINE_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN) CFLAGS += -mbig-endian LDFLAGS += -mbig-endian LD += -EB .endif .if ${MACHINE_ARCH} == "mips" . if defined(TARGET_BIG_ENDIAN) CFLAGS += -EB LDFLAGS += -Wl,-EB LD += -EB . else CFLAGS += -EL LDFLAGS += -Wl,-EL LD += -EL . endif -CFLAGS += -msoft-float -G0 -mno-dsp -mabicalls +CFLAGS += -msoft-float -G0 -mabicalls .endif # NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk .if !defined(NO_CPU_CFLAGS) . if ${CC} == "icc" CFLAGS += ${_ICC_CPUCFLAGS} . else CFLAGS += ${_CPUCFLAGS} . endif .endif Index: projects/mips/sys/conf/Makefile.mips =================================================================== --- projects/mips/sys/conf/Makefile.mips (revision 195668) +++ projects/mips/sys/conf/Makefile.mips (revision 195669) @@ -1,127 +1,127 @@ # Makefile.mips # $FreeBSD$ # # Makefile for FreeBSD # # This makefile is constructed from a machine description: # config machineid # Most changes should be made in the machine description # /sys/mips/conf/``machineid'' # after which you should do # config machineid # Generic makefile changes should be made in # /sys/conf/Makefile.mips # after which config should be rerun for all machines. # # Which version of config(8) is required. %VERSREQ= 600004 STD8X16FONT?= iso .if !defined(S) .if exists(./@/.) S= ./@ .else S= ../../.. .endif .endif .include "$S/conf/kern.pre.mk" SYSTEM_LD:= ${SYSTEM_LD:$S/conf/ldscript.$M=ldscript.$M} SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscript.$M=ldscript.$M} # XXX: Such sweeping assumptions... MACHINE=mips MACHINE_ARCH=mips KERNLOADADDR?=0x80001000 # This obscure value is defined by CFE for WR160N # To be changed later TRAMPLOADADDR?=0x807963c0 MKMODULESENV+= MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} # We default to the MIPS32 ISA, if none specified in the # kernel configuration file. ARCH_FLAGS?=-march=mips32 -EXTRA_FLAGS=-fno-pic -mno-abicalls -mno-dsp -G0 +EXTRA_FLAGS=-fno-pic -mno-abicalls -G0 HACK_EXTRA_FLAGS=-shared .if defined(TARGET_BIG_ENDIAN) CFLAGS+=-EB SYSTEM_LD+=-EB EXTRA_FLAGS+=-EB TRAMP_LDFLAGS+=-Wl,-EB HACK_EXTRA_FLAGS+=-EB -Wl,-EB .if defined(TARGET_64BIT) SYSTEM_LD+=-m elf64btsmip_fbsd HACK_EXTRA_FLAGS+=-Wl,-m,elf64btsmip_fbsd .endif .else CFLAGS+=-EL SYSTEM_LD+=-EL EXTRA_FLAGS+=-EL TRAMP_LDFLAGS+=-Wl,-EL HACK_EXTRA_FLAGS+=-EL -Wl,-EL .if defined(TARGET_64BIT) SYSTEM_LD+=-m elf64ltsmip_fbsd HACK_EXTRA_FLAGS+=-Wl,-m,elf64ltsmip_fbsd .endif .endif # We add the -fno-pic flag to kernels because otherwise performance # is extremely poor, as well as -mno-abicalls to force no ABI usage. CFLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS) HACK_EXTRA_FLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS) # XXX hardcoded kernel entry point ASM_CFLAGS+=${CFLAGS} -D_LOCORE -DLOCORE KERNEL_EXTRA=trampoline trampoline: ${KERNEL_KO}.tramp.bin ${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/$M/$M/elf_trampoline.c \ $S/$M/$M/inckern.S ${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \ -g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp sed s/${KERNLOADADDR}/${TRAMPLOADADDR}/ ldscript.$M | \ sed s/" + SIZEOF_HEADERS"// > ldscript.$M.tramp.noheader # Generate .S file that setups stack and jumps to trampoline echo "#include " >tmphack.S echo "ENTRY(_start)" >>tmphack.S echo "la t0, kernel_end" >>tmphack.S echo "move sp, t0" >>tmphack.S echo "add sp, 0x2000" >>tmphack.S echo "and sp, ~0x7" >>tmphack.S echo "la t0, _startC" >>tmphack.S echo "j t0" >>tmphack.S echo "END(_start)" >>tmphack.S echo "#define KERNNAME \"${KERNEL_KO}.tmp\"" >opt_kernname.h ${CC} -O -nostdlib -I. -I$S ${EXTRA_FLAGS} ${TRAMP_LDFLAGS} -Xlinker \ -T -Xlinker ldscript.$M.tramp.noheader tmphack.S \ $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \ -o ${KERNEL_KO}.tramp.noheader ${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \ ${KERNEL_KO}.tramp.bin \ %BEFORE_DEPEND %OBJS %FILES.c %FILES.s %FILES.m %CLEAN CLEAN+= ldscript.$M ldscript.$M.tramp.noheader \ ${KERNEL_KO}.tramp.noheader ${KERNEL_KO}.tramp.bin ldscript.$M: $S/conf/ldscript.$M cat $S/conf/ldscript.$M|sed s/KERNLOADADDR/${KERNLOADADDR}/g \ > ldscript.$M %RULES .include "$S/conf/kern.post.mk" Index: projects/mips/sys/conf/kern.mk =================================================================== --- projects/mips/sys/conf/kern.mk (revision 195668) +++ projects/mips/sys/conf/kern.mk (revision 195669) @@ -1,117 +1,117 @@ # $FreeBSD$ # # Warning flags for compiling the kernel and components of the kernel. # # Note that the newly added -Wcast-qual is responsible for generating # most of the remaining warnings. Warnings introduced with -Wall will # also pop up, but are easier to fix. .if ${CC} == "icc" #CWARNFLAGS= -w2 # use this if you are terribly bored CWARNFLAGS= .else CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \ ${_wundef} ${_Wno_pointer_sign} -fformat-extensions .if !defined(WITH_GCC3) _Wno_pointer_sign=-Wno-pointer-sign .endif .if !defined(NO_UNDEF) _wundef= -Wundef .endif .endif # # The following flags are next up for working on: # -W # # On the i386, do not align the stack to 16-byte boundaries. Otherwise GCC # 2.95 adds code to the entry and exit point of every function to align the # stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack # per function call. While the 16-byte alignment may benefit micro benchmarks, # it is probably an overall loss as it makes the code bigger (less efficient # use of code cache tag lines) and uses more stack (less efficient use of data # cache tag lines). Explicitly prohibit the use of SSE and other SIMD # operations inside the kernel itself. These operations are exclusively # reserved for user applications. # .if ${MACHINE_ARCH} == "i386" && ${CC} != "icc" CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 \ -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 INLINE_LIMIT?= 8000 .endif .if ${MACHINE_ARCH} == "arm" INLINE_LIMIT?= 8000 .endif # # For IA-64, we use r13 for the kernel globals pointer and we only use # a very small subset of float registers for integer divides. # .if ${MACHINE_ARCH} == "ia64" CFLAGS+= -ffixed-r13 -mfixed-range=f32-f127 -fpic #-mno-sdata INLINE_LIMIT?= 15000 .endif # # For sparc64 we want medlow code model, and we tell gcc to use floating # point emulation. This avoids using floating point registers for integer # operations which it has a tendency to do. # .if ${MACHINE_ARCH} == "sparc64" CFLAGS+= -mcmodel=medany -msoft-float INLINE_LIMIT?= 15000 .endif # # For AMD64, we explicitly prohibit the use of FPU, SSE and other SIMD # operations inside the kernel itself. These operations are exclusively # reserved for user applications. # .if ${MACHINE_ARCH} == "amd64" CFLAGS+= -mcmodel=kernel -mno-red-zone \ -mfpmath=387 -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow \ -msoft-float -fno-asynchronous-unwind-tables INLINE_LIMIT?= 8000 .endif # # For PowerPC we tell gcc to use floating point emulation. This avoids using # floating point registers for integer operations which it has a tendency to do. # Also explicitly disable Altivec instructions inside the kernel. # .if ${MACHINE_ARCH} == "powerpc" CFLAGS+= -msoft-float -mno-altivec INLINE_LIMIT?= 15000 .endif # # For MIPS we also tell gcc to use floating point emulation and # disable MIPS DSP ASE Instruction set. # .if ${MACHINE_ARCH} == "mips" -CFLAGS+= -msoft-float -mno-dsp +CFLAGS+= -msoft-float INLINE_LIMIT?= 8000 .endif # # GCC 3.0 and above like to do certain optimizations based on the # assumption that the program is linked against libc. Stop this. # .if ${CC} == "icc" CFLAGS+= -nolib_inline .else CFLAGS+= -ffreestanding .endif .if ${CC} == "icc" CFLAGS+= -restrict .endif # # GCC SSP support. # .if ${MK_SSP} != "no" && ${CC} != "icc" && ${MACHINE_ARCH} != "ia64" && \ ${MACHINE_ARCH} != "arm" && ${MACHINE_ARCH} != "mips" CFLAGS+= -fstack-protector .endif