Skip to contentSkip to conversation

How getting a pointer on the per-cpu struct tss_struct??

DISCUSSION Marko 3 participants 5 messages Feb 12, 2006 – Feb 13, 2006

lore
Share & tools
lore

Marko

author
#0 lore raw

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

#1 lore raw
Quoted 8 lines · Marko

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();
author
#2 lore raw

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

Quoted 23 lines · On Sun, 12 Feb 2006 15:58:31 -0800 (PST) Zwane Mwaikambo…
Quoted 8 lines · Marko

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();
#3 lore raw
Quoted 7 lines · Marko

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?

#4 lore raw
In reply to Marko
Quoted 7 lines · Marko

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?)