From: "Tommy Faasen" <faasen@xs4all.nl>
To: <linux-kernel@vger.kernel.org>
Subject: SMP: why can't I get this to work?
Date: Mon, 22 Oct 2001 22:55:54 +0200 [thread overview]
Message-ID: <001501c15b3b$f1052990$6401000a@it0> (raw)
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
reply other threads:[~2001-10-22 20:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001501c15b3b$f1052990$6401000a@it0' \
--to=faasen@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®