diff options
author | Andy Lutomirski <luto@amacapital.net> | 2014-09-23 13:50:53 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-10-28 06:22:10 -0400 |
commit | 258801563ba1be05793f2417ae30557b43a24e4e (patch) | |
tree | 85089560726a211649a3eafa13d5fba74a80b29b | |
parent | d4f829dd9026797bd5db8715a30192f23b22afaa (diff) |
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>
-rw-r--r-- | arch/x86/vdso/vma.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c index a155dca5edb5..261b1349acc9 100644 --- a/arch/x86/vdso/vma.c +++ b/arch/x86/vdso/vma.c | |||
@@ -248,7 +248,7 @@ __setup("vdso=", vdso_setup); | |||
248 | */ | 248 | */ |
249 | static void vsyscall_set_cpu(int cpu) | 249 | static void vsyscall_set_cpu(int cpu) |
250 | { | 250 | { |
251 | unsigned long d; | 251 | struct desc_struct d; |
252 | unsigned long node = 0; | 252 | unsigned long node = 0; |
253 | #ifdef CONFIG_NUMA | 253 | #ifdef CONFIG_NUMA |
254 | node = cpu_to_node(cpu); | 254 | node = cpu_to_node(cpu); |
@@ -257,13 +257,18 @@ static void vsyscall_set_cpu(int cpu) | |||
257 | write_rdtscp_aux((node << 12) | cpu); | 257 | write_rdtscp_aux((node << 12) | cpu); |
258 | 258 | ||
259 | /* | 259 | /* |
260 | * Store cpu number in limit so that it can be loaded quickly | 260 | * Store cpu number in limit so that it can be loaded |
261 | * in user space in vgetcpu. (12 bits for the CPU and 8 bits for the node) | 261 | * quickly in user space in vgetcpu. (12 bits for the CPU |
262 | * and 8 bits for the node) | ||
262 | */ | 263 | */ |
263 | d = 0x0f40000000000ULL; | 264 | d = (struct desc_struct) { |
264 | d |= cpu; | 265 | .limit0 = cpu | ((node & 0xf) << 12), |
265 | d |= (node & 0xf) << 12; | 266 | .limit = node >> 4, |
266 | d |= (node >> 4) << 48; | 267 | .type = 4, /* RO data, expand down */ |
268 | .dpl = 3, /* Visible to user code */ | ||
269 | .s = 1, /* Not a system segment */ | ||
270 | .p = 1, /* Present */ | ||
271 | }; | ||
267 | 272 | ||
268 | write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PER_CPU, &d, DESCTYPE_S); | 273 | write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PER_CPU, &d, DESCTYPE_S); |
269 | } | 274 | } |