mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* SMP: why can't I get this to work?
@ 2001-10-22 20:55 Tommy Faasen
  0 siblings, 0 replies; only message in thread
From: Tommy Faasen @ 2001-10-22 20:55 UTC (permalink / raw)
  To: linux-kernel

In an effort to check all the cpu's for a certain capability I came up with
the following, but you guessed it, it won't work :(

I added this to bitops.h
static int test_bits(int nr, const volatile void * addr,int step,int ncpu){
 int i;
 for(i=0;i<ncpu;i++)
 {
  if(test_bit(nr,&addr+(i*step))==0)return(0);
 }
 return(1);
}

And this to processor.h

#ifdef CONFIG_SMP
extern struct cpuinfo_x86 cpu_data[];
#define current_cpu_data cpu_data[smp_processor_id()]

#define cpu_has_pge (test_bits(X86_FEATURE_PGE,
current_cpu_data.x86_capability,sizeof(struct cpuinfo_x86),NR_CPUS))
#define cpu_has_pse (test_bits(X86_FEATURE_PSE,
current_cpu_data.x86_capability,sizeof(struct cpuinfo_x86),NR_CPUS))
#define cpu_has_pae (test_bits(X86_FEATURE_PAE,
current_cpu_data.x86_capability,sizeof(struct cpuinfo_x86),NR_CPUS))
#define cpu_has_tsc (test_bits(X86_FEATURE_TSC,
current_cpu_data.x86_capability,sizeof(struct cpuinfo_x86),NR_CPUS))
#define cpu_has_de (test_bits(X86_FEATURE_DE,
current_cpu_data.x86_capability,sizeof(struct cpuinfo_x86),NR_CPUS))
#define cpu_has_vme (test_bits(X86_FEATURE_VME,
current_cpu_data.x86_capability,sizeof(struct cpuinfo_x86),NR_CPUS))
#define cpu_has_fxsr (test_bits(X86_FEATURE_FXSR,
current_cpu_data.x86_capability,sizeof(struct cpuinfo_x86),NR_CPUS))
#define cpu_has_xmm (test_bits(X86_FEATURE_XMM,
current_cpu_data.x86_capability,sizeof(struct cpuinfo_x86),NR_CPUS))
#define cpu_has_fpu (test_bits(X86_FEATURE_FPU,
current_cpu_data.x86_capability,sizeof(struct cpuinfo_x86),NR_CPUS))
#define cpu_has_apic (test_bits(X86_FEATURE_APIC,
current_cpu_data.x86_capability,sizeof(struct cpuinfo_x86),NR_CPUS))
#else
#define cpu_data &boot_cpu_data
#define current_cpu_data boot_cpu_data

#define cpu_has_pge (test_bit(X86_FEATURE_PGE,
boot_cpu_data.x86_capability))
#define cpu_has_pse (test_bit(X86_FEATURE_PSE,
boot_cpu_data.x86_capability))
#define cpu_has_pae (test_bit(X86_FEATURE_PAE,
boot_cpu_data.x86_capability))
#define cpu_has_tsc (test_bit(X86_FEATURE_TSC,
boot_cpu_data.x86_capability))
#define cpu_has_de (test_bit(X86_FEATURE_DE,
boot_cpu_data.x86_capability))
#define cpu_has_vme (test_bit(X86_FEATURE_VME,
boot_cpu_data.x86_capability))
#define cpu_has_fxsr (test_bit(X86_FEATURE_FXSR,
boot_cpu_data.x86_capability))
#define cpu_has_xmm (test_bit(X86_FEATURE_XMM,
boot_cpu_data.x86_capability))
#define cpu_has_fpu (test_bit(X86_FEATURE_FPU,
boot_cpu_data.x86_capability))
#define cpu_has_apic (test_bit(X86_FEATURE_APIC,
boot_cpu_data.x86_capability))
#endif



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-10-22 20:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-22 20:55 SMP: why can't I get this to work? Tommy Faasen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®