mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* How getting a pointer on the per-cpu struct tss_struct??
@ 2006-02-12 23:27 Marko
  2006-02-12 23:58 ` Zwane Mwaikambo
  0 siblings, 1 reply; 5+ messages in thread
From: Marko @ 2006-02-12 23:27 UTC (permalink / raw)
  To: linux-kernel


Hello,

may anyone tell me where I'm wrong???


What I thought to have found:

I want to access the per-cpu IO Permission Bitmap. Therefore, I try to
get a pointer on the per-cpu struct tss_struct. I found an array of typ
'struct tss_struct' named 'init_tss' (declared in asm/processor.h with
'DECLARE_PER_CPU(struct tss_struct, init_tss);').

So I should be able to get a pointer on the struct tss_struct of the
current cpu, by using the following code:

	int cpu = get_cpu();
	struct tss_struct * t = &per_cpu(init_tss, cpu);

But when I try to compile this, I get the warning:

	*** Warning: "per_cpu__init_tss" [/home/..../module.ko]
	undefined!

and according to this warning an error, when I try to load the module:

	insmod: error inserting 'module.ko': -1 Unknown symbol in module


(I'm using gcc4.0.2 and kernel 2.6.14.2)


Where's my problem??

Thanks,



Marko Euth

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How getting a pointer on the per-cpu struct tss_struct??
  2006-02-12 23:27 How getting a pointer on the per-cpu struct tss_struct?? Marko
@ 2006-02-12 23:58 ` Zwane Mwaikambo
  2006-02-13  0:14   ` Marko
  0 siblings, 1 reply; 5+ messages in thread
From: Zwane Mwaikambo @ 2006-02-12 23:58 UTC (permalink / raw)
  To: Marko; +Cc: Linux Kernel

On Mon, 13 Feb 2006, Marko wrote:

> But when I try to compile this, I get the warning:
> 
> 	*** Warning: "per_cpu__init_tss" [/home/..../module.ko]
> 	undefined!
> 
> and according to this warning an error, when I try to load the module:
> 
> 	insmod: error inserting 'module.ko': -1 Unknown symbol in module

init_tss isn't exported, you would need to do 
EXPORT_PER_CPU_SYMBOL(init_tss).

Also a suggestion, you should use __get_cpu_var instead of per_cpu e.g.

	struct tss_struct *t;
	/* if you don't need cpu variable just preempt_disable */
	int cpu = get_cpu();
	t = __get_cpu_var(init_tss);
...
	put_cpu();

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How getting a pointer on the per-cpu struct tss_struct??
  2006-02-12 23:58 ` Zwane Mwaikambo
@ 2006-02-13  0:14   ` Marko
  2006-02-13  6:13     ` Zwane Mwaikambo
  2006-02-13  7:29     ` Arjan van de Ven
  0 siblings, 2 replies; 5+ messages in thread
From: Marko @ 2006-02-13  0:14 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: linux-kernel


Thanks for answering.

So when I don't want to change the kernel, the only way to get
a pointer on the IO Permission Bitmap is using the TSS entry in
the GDT??

Or is there another way to access the current structure tss_struct??


Marko Euth




On Sun, 12 Feb 2006 15:58:31 -0800 (PST)
Zwane Mwaikambo <zwane@arm.linux.org.uk> wrote:

> On Mon, 13 Feb 2006, Marko wrote:
> 
> > But when I try to compile this, I get the warning:
> > 
> > 	*** Warning: "per_cpu__init_tss" [/home/..../module.ko]
> > 	undefined!
> > 
> > and according to this warning an error, when I try to load the module:
> > 
> > 	insmod: error inserting 'module.ko': -1 Unknown symbol in module
> 
> init_tss isn't exported, you would need to do 
> EXPORT_PER_CPU_SYMBOL(init_tss).
> 
> Also a suggestion, you should use __get_cpu_var instead of per_cpu e.g.
> 
> 	struct tss_struct *t;
> 	/* if you don't need cpu variable just preempt_disable */
> 	int cpu = get_cpu();
> 	t = __get_cpu_var(init_tss);
> ...
> 	put_cpu();
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How getting a pointer on the per-cpu struct tss_struct??
  2006-02-13  0:14   ` Marko
@ 2006-02-13  6:13     ` Zwane Mwaikambo
  2006-02-13  7:29     ` Arjan van de Ven
  1 sibling, 0 replies; 5+ messages in thread
From: Zwane Mwaikambo @ 2006-02-13  6:13 UTC (permalink / raw)
  To: Marko; +Cc: linux-kernel

On Mon, 13 Feb 2006, Marko wrote:

> Thanks for answering.
> 
> So when I don't want to change the kernel, the only way to get
> a pointer on the IO Permission Bitmap is using the TSS entry in
> the GDT??
> 
> Or is there another way to access the current structure tss_struct??

How about saving the GDT and then fetching the TSS from there?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How getting a pointer on the per-cpu struct tss_struct??
  2006-02-13  0:14   ` Marko
  2006-02-13  6:13     ` Zwane Mwaikambo
@ 2006-02-13  7:29     ` Arjan van de Ven
  1 sibling, 0 replies; 5+ messages in thread
From: Arjan van de Ven @ 2006-02-13  7:29 UTC (permalink / raw)
  To: Marko; +Cc: Zwane Mwaikambo, linux-kernel

On Mon, 2006-02-13 at 01:14 +0100, Marko wrote:
> Thanks for answering.
> 
> So when I don't want to change the kernel, the only way to get
> a pointer on the IO Permission Bitmap is using the TSS entry in
> the GDT??
> 
> Or is there another way to access the current structure tss_struct??


what on earth are you trying to do????

(and why can't you change the kernel?)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-02-13  7:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-12 23:27 How getting a pointer on the per-cpu struct tss_struct?? Marko
2006-02-12 23:58 ` Zwane Mwaikambo
2006-02-13  0:14   ` Marko
2006-02-13  6:13     ` Zwane Mwaikambo
2006-02-13  7:29     ` Arjan van de Ven

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®