mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 17:12:06 +00:00
x86/vdso: Change the PER_CPU segment to use struct desc_struct
This makes it easier to see what's going on. It produces exactly the same segment descriptor as the old code. Signed-off-by: Andy Lutomirski <luto@amacapital.net> Link: http://lkml.kernel.org/r/d492f7b55136cbc60f016adae79160707b2e03b7.1411494540.git.luto@amacapital.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
d4f829dd90
commit
258801563b
@ -248,7 +248,7 @@ __setup("vdso=", vdso_setup);
|
|||||||
*/
|
*/
|
||||||
static void vsyscall_set_cpu(int cpu)
|
static void vsyscall_set_cpu(int cpu)
|
||||||
{
|
{
|
||||||
unsigned long d;
|
struct desc_struct d;
|
||||||
unsigned long node = 0;
|
unsigned long node = 0;
|
||||||
#ifdef CONFIG_NUMA
|
#ifdef CONFIG_NUMA
|
||||||
node = cpu_to_node(cpu);
|
node = cpu_to_node(cpu);
|
||||||
@ -257,13 +257,18 @@ static void vsyscall_set_cpu(int cpu)
|
|||||||
write_rdtscp_aux((node << 12) | cpu);
|
write_rdtscp_aux((node << 12) | cpu);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Store cpu number in limit so that it can be loaded quickly
|
* Store cpu number in limit so that it can be loaded
|
||||||
* in user space in vgetcpu. (12 bits for the CPU and 8 bits for the node)
|
* quickly in user space in vgetcpu. (12 bits for the CPU
|
||||||
|
* and 8 bits for the node)
|
||||||
*/
|
*/
|
||||||
d = 0x0f40000000000ULL;
|
d = (struct desc_struct) {
|
||||||
d |= cpu;
|
.limit0 = cpu | ((node & 0xf) << 12),
|
||||||
d |= (node & 0xf) << 12;
|
.limit = node >> 4,
|
||||||
d |= (node >> 4) << 48;
|
.type = 4, /* RO data, expand down */
|
||||||
|
.dpl = 3, /* Visible to user code */
|
||||||
|
.s = 1, /* Not a system segment */
|
||||||
|
.p = 1, /* Present */
|
||||||
|
};
|
||||||
|
|
||||||
write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PER_CPU, &d, DESCTYPE_S);
|
write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PER_CPU, &d, DESCTYPE_S);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user