[PATCH] Remove -DCPU

From: Brian Gerst (bgerst@quark.vpplus.com)
Date: Sun Feb 13 2000 - 20:33:39 EST


This patch changes all occurances of the CPU macro to use CONFIG_*
macros, changes code to use the rdtsc macros, and removes two redundant
TSC checks. It applies to 2.3.45-pre2.

-- 

Brian Gerst

diff -urN linux-2.3.45p2/arch/i386/Makefile linux-2.3.45p2-cpu/arch/i386/Makefile --- linux-2.3.45p2/arch/i386/Makefile Mon Jan 31 19:58:21 2000 +++ linux-2.3.45p2-cpu/arch/i386/Makefile Sun Feb 13 19:57:04 2000 @@ -26,50 +26,38 @@ # only work around strength reduction bug(s) on older gcc versions CFLAGS_NSR := $(shell if $(CC) -march=i486 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo ""; else echo "-fno-strength-reduce"; fi) -CFLAGS := $(CFLAGS) $(CFLAGS_PIPE) $(CFLAGS_NSR) +CFLAGS += $(CFLAGS_PIPE) $(CFLAGS_NSR) # prevent gcc from keeping the stack 16 byte aligned CFLAGS += $(shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi) ifdef CONFIG_M386 -CFLAGS := $(CFLAGS) -m386 -DCPU=386 -AFLAGS := $(AFLAGS) -DCPU=386 +CFLAGS += -m386 endif ifdef CONFIG_M486 -CFLAGS := $(CFLAGS) -DCPU=486 CFLAGS += $(shell if $(CC) -march=i486 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=i486"; else echo "-m486"; fi) -AFLAGS := $(AFLAGS) -DCPU=486 endif ifdef CONFIG_M586 -CFLAGS := $(CFLAGS) -DCPU=586 CFLAGS += $(shell if $(CC) -march=i586 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=i586"; fi) -AFLAGS := $(AFLAGS) -DCPU=586 endif ifdef CONFIG_M586TSC -CFLAGS := $(CFLAGS) -DCPU=586 CFLAGS += $(shell if $(CC) -march=i586 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=i586"; fi) -AFLAGS := $(AFLAGS) -DCPU=586 endif ifdef CONFIG_M686 -CFLAGS := $(CFLAGS) -DCPU=686 CFLAGS += $(shell if $(CC) -march=i686 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=i686"; fi) -AFLAGS := $(AFLAGS) -DCPU=686 endif ifdef CONFIG_MK6 -CFLAGS := $(CFLAGS) -DCPU=586 CFLAGS += $(shell if $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6"; fi) -AFLAGS := $(AFLAGS) -DCPU=586 endif ifdef CONFIG_MK7 -CFLAGS := $(CFLAGS) -DCPU=686 -march=pentiumpro -mpentiumpro -malign-functions=4 -fschedule-insns2 -mwide-multiply -fexpensive-optimizations +CFLAGS += -march=pentiumpro -mpentiumpro -malign-functions=4 -fschedule-insns2 -mwide-multiply -fexpensive-optimizations CFLAGS += $(shell if $(CC) -march=i686 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=i686"; fi) -AFLAGS := $(AFLAGS) -DCPU=686 endif HEAD := arch/i386/kernel/head.o arch/i386/kernel/init_task.o diff -urN linux-2.3.45p2/arch/i386/config.in linux-2.3.45p2-cpu/arch/i386/config.in --- linux-2.3.45p2/arch/i386/config.in Sun Feb 13 18:24:15 2000 +++ linux-2.3.45p2-cpu/arch/i386/config.in Sun Feb 13 19:17:12 2000 @@ -39,6 +39,7 @@ if [ "$CONFIG_M686" = "y" ]; then define_bool CONFIG_X86_GOOD_APIC y define_bool CONFIG_X86_PGE y + define_bool CONFIG_X86_UNROLLED_CSUM y fi if [ "$CONFIG_MK6" = "y" ]; then define_bool CONFIG_X86_TSC y @@ -47,6 +48,7 @@ define_bool CONFIG_X86_TSC y define_bool CONFIG_X86_GOOD_APIC y define_bool CONFIG_X86_USE_3DNOW y + define_bool CONFIG_X86_UNROLLED_CSUM y fi choice 'High Memory Support' \ diff -urN linux-2.3.45p2/arch/i386/lib/checksum.S linux-2.3.45p2-cpu/arch/i386/lib/checksum.S --- linux-2.3.45p2/arch/i386/lib/checksum.S Sun May 16 16:17:22 1999 +++ linux-2.3.45p2-cpu/arch/i386/lib/checksum.S Sun Feb 13 19:17:12 2000 @@ -39,7 +39,7 @@ .align 4 .globl csum_partial -#if CPU!=686 +#ifndef CONFIG_X86_UNROLLED_CSUM /* * Experiments with Ethernet and SLIP connections show that buff @@ -114,7 +114,7 @@ popl %esi ret -#else /* CPU==686 */ +#else /* CONFIG_X86_UNROLLED_CSUM */ csum_partial: pushl %esi @@ -210,7 +210,7 @@ popl %esi ret -#endif /* CPU==686 */ +#endif /* CONFIG_X86_UNROLLED_CSUM */ /* unsigned int csum_partial_copy_generic (const char *src, char *dst, @@ -243,7 +243,7 @@ .align 4 .globl csum_partial_copy_generic -#if CPU!=686 +#ifndef CONFIG_X86_UNROLLED_CSUM #define ARGBASE 16 #define FP 12 @@ -367,7 +367,7 @@ popl %ecx # equivalent to addl $4,%esp ret -#else +#else /* CONFIG_X86_UNROLLED_CSUM */ /* Version for PentiumII/PPro */ @@ -448,4 +448,4 @@ #undef ROUND #undef ROUND1 -#endif /* CPU==i686 */ +#endif /* CONFIG_X86_UNROLLED_CSUM */ diff -urN linux-2.3.45p2/drivers/char/serial.c linux-2.3.45p2-cpu/drivers/char/serial.c --- linux-2.3.45p2/drivers/char/serial.c Mon Jan 31 19:58:24 2000 +++ linux-2.3.45p2-cpu/drivers/char/serial.c Sun Feb 13 19:17:12 2000 @@ -133,7 +133,7 @@ #define RS_STROBE_TIME (10*HZ) #define RS_ISR_PASS_LIMIT 256 -#if (defined(__i386__) && (CPU==386 || CPU==486)) +#if defined(CONFIG_M386) || defined(CONFIG_M486) #define SERIAL_INLINE #endif diff -urN linux-2.3.45p2/drivers/isdn/isdn_audio.c linux-2.3.45p2-cpu/drivers/isdn/isdn_audio.c --- linux-2.3.45p2/drivers/isdn/isdn_audio.c Wed Aug 25 18:18:08 1999 +++ linux-2.3.45p2-cpu/drivers/isdn/isdn_audio.c Sun Feb 13 19:17:12 2000 @@ -90,6 +90,7 @@ */ #define __NO_VERSION__ +#include <linux/config.h> #include <linux/module.h> #include <linux/isdn.h> #include "isdn_audio.h" @@ -297,7 +298,7 @@ * egcs 2.95 complain about invalid asm statement: * "fixed or forbidden register 2 (cx) was spilled for class CREG." */ -#if ((CPU == 386) || (CPU == 486) || (CPU == 586)) && defined(__GNUC__) +#if defined(__GNUC__) && defined(CONFIG_X86) #if __GNUC__ == 2 && __GNUC_MINOR__ < 95 #define ISDN_AUDIO_OPTIMIZE_ON_X386_WITH_ASM_IF_GCC_ALLOW_IT #endif diff -urN linux-2.3.45p2/include/asm-i386/cache.h linux-2.3.45p2-cpu/include/asm-i386/cache.h --- linux-2.3.45p2/include/asm-i386/cache.h Mon Dec 6 22:23:40 1999 +++ linux-2.3.45p2-cpu/include/asm-i386/cache.h Sun Feb 13 19:31:41 2000 @@ -4,11 +4,13 @@ #ifndef __ARCH_I386_CACHE_H #define __ARCH_I386_CACHE_H +#include <linux/config.h> + /* bytes per L1 cache line */ -#if CPU==586 || CPU==686 -#define L1_CACHE_BYTES 32 -#else +#if defined(CONFIG_M386) || defined(CONFIG_M486) #define L1_CACHE_BYTES 16 +#else +#define L1_CACHE_BYTES 32 #endif #endif diff -urN linux-2.3.45p2/include/asm-i386/string.h linux-2.3.45p2-cpu/include/asm-i386/string.h --- linux-2.3.45p2/include/asm-i386/string.h Mon Jan 31 19:57:02 2000 +++ linux-2.3.45p2-cpu/include/asm-i386/string.h Sun Feb 13 19:31:41 2000 @@ -1,6 +1,8 @@ #ifndef _I386_STRING_H_ #define _I386_STRING_H_ +#include <linux/config.h> + #ifdef __KERNEL__ /* * On a 486 or Pentium, we are better off not using the @@ -11,7 +13,7 @@ * Also, the byte strings actually work correctly. Forget * the i486 routines for now as they may be broken.. */ -#if FIXED_486_STRING && (CPU == 486 || CPU == 586) +#ifdef CONFIG_USE_STRING_486 #include <asm/string-486.h> #else diff -urN linux-2.3.45p2/include/asm-i386/system.h linux-2.3.45p2-cpu/include/asm-i386/system.h --- linux-2.3.45p2/include/asm-i386/system.h Wed Dec 8 21:57:28 1999 +++ linux-2.3.45p2-cpu/include/asm-i386/system.h Sun Feb 13 19:31:41 2000 @@ -1,6 +1,7 @@ #ifndef __ASM_SYSTEM_H #define __ASM_SYSTEM_H +#include <linux/config.h> #include <linux/kernel.h> #include <asm/segment.h> #include <linux/bitops.h> /* for LOCK_PREFIX */ @@ -215,7 +216,7 @@ * indicated by comparing RETURN with OLD. */ -#if CPU != 386 +#ifndef CONFIG_M386 #define __HAVE_ARCH_CMPXCHG 1 static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, diff -urN linux-2.3.45p2/include/net/pkt_sched.h linux-2.3.45p2-cpu/include/net/pkt_sched.h --- linux-2.3.45p2/include/net/pkt_sched.h Sun Feb 13 18:24:56 2000 +++ linux-2.3.45p2-cpu/include/net/pkt_sched.h Sun Feb 13 19:40:54 2000 @@ -7,6 +7,7 @@ #define PSCHED_CLOCK_SOURCE PSCHED_JIFFIES +#include <linux/config.h> #include <linux/pkt_sched.h> #include <net/pkt_cls.h> @@ -247,11 +248,12 @@ #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz) -#if CPU == 586 || CPU == 686 +#if defined(CONFIG_X86_TSC) +#include <asm/msr.h> #define PSCHED_GET_TIME(stamp) \ ({ u64 __cur; \ - __asm__ __volatile__ (".byte 0x0f,0x31" :"=A" (__cur)); \ + rdtscll(cur); \ (stamp) = __cur>>psched_clock_scale; \ }) diff -urN linux-2.3.45p2/include/net/profile.h linux-2.3.45p2-cpu/include/net/profile.h --- linux-2.3.45p2/include/net/profile.h Thu Dec 2 19:28:24 1999 +++ linux-2.3.45p2-cpu/include/net/profile.h Sun Feb 13 19:31:50 2000 @@ -25,14 +25,12 @@ extern struct timeval net_profile_adjust; extern void net_profile_irq_adjust(struct timeval *entered, struct timeval* leaved); -#if CPU == 586 || CPU == 686 - +#if defined(CONFIG_X86_TSC) +#include <asm/msr.h> extern __inline__ void net_profile_stamp(struct timeval *pstamp) { - __asm__ __volatile__ (".byte 0x0f,0x31" - :"=a" (pstamp->tv_usec), - "=d" (pstamp->tv_sec)); + rdtsc(pstamp->tv_usec, pstamp->tv_sec); } extern __inline__ void net_profile_accumulate(struct timeval *entered, diff -urN linux-2.3.45p2/net/core/profile.c linux-2.3.45p2-cpu/net/core/profile.c --- linux-2.3.45p2/net/core/profile.c Mon Nov 22 23:48:15 1999 +++ linux-2.3.45p2-cpu/net/core/profile.c Sun Feb 13 19:17:12 2000 @@ -271,12 +271,6 @@ register_netdevice(&whitehole_dev); printk("Evaluating net profiler cost ..."); -#if CPU == 586 || CPU == 686 - if (!(boot_cpu_data.x86_capability & X86_FEATURE_TSC)) { - printk(KERN_ERR "Sorry, your CPU does not support TSC. Net profiler disabled.\n"); - return -1; - } -#endif #ifdef __alpha__ alpha_tick(0); #endif diff -urN linux-2.3.45p2/net/sched/sch_api.c linux-2.3.45p2-cpu/net/sched/sch_api.c --- linux-2.3.45p2/net/sched/sch_api.c Mon Jan 31 19:57:47 2000 +++ linux-2.3.45p2-cpu/net/sched/sch_api.c Sun Feb 13 19:17:12 2000 @@ -1139,11 +1139,6 @@ long rdelay; unsigned long stop; -#if CPU == 586 || CPU == 686 - if (!(boot_cpu_data.x86_capability & X86_FEATURE_TSC)) - return -1; -#endif - #ifdef PSCHED_WATCHER psched_tick(0); #endif

- 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/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:26 EST