Commit a92f101b authored by Andrew Morton's avatar Andrew Morton Committed by Thomas Gleixner

x86: vdso: Fix build with older gcc

gcc-4.4.4:

arch/x86/vdso/vma.c: In function 'vgetcpu_cpu_init':
arch/x86/vdso/vma.c:247: error: unknown field 'limit0' specified in initializer
arch/x86/vdso/vma.c:247: warning: missing braces around initializer
arch/x86/vdso/vma.c:247: warning: (near initialization for '(anonymous).<anonymous>')
arch/x86/vdso/vma.c:248: error: unknown field 'limit' specified in initializer
arch/x86/vdso/vma.c:248: warning: excess elements in struct initializer
arch/x86/vdso/vma.c:248: warning: (near initialization for '(anonymous)')
....

I couldn't find any way of tricking it into accepting an initializer
format :(
Reported-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
Fixes: 25880156 ("x86/vdso: Change the PER_CPU segment to use struct desc_struct")
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 1c0c1b93
...@@ -230,7 +230,7 @@ __setup("vdso=", vdso_setup); ...@@ -230,7 +230,7 @@ __setup("vdso=", vdso_setup);
static void vgetcpu_cpu_init(void *arg) static void vgetcpu_cpu_init(void *arg)
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
struct desc_struct 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);
...@@ -243,15 +243,13 @@ static void vgetcpu_cpu_init(void *arg) ...@@ -243,15 +243,13 @@ static void vgetcpu_cpu_init(void *arg)
* quickly in user space in vgetcpu. (12 bits for the CPU * quickly in user space in vgetcpu. (12 bits for the CPU
* and 8 bits for the node) * and 8 bits for the node)
*/ */
d = (struct desc_struct) { d.limit0 = cpu | ((node & 0xf) << 12);
.limit0 = cpu | ((node & 0xf) << 12), d.limit = node >> 4;
.limit = node >> 4, d.type = 5; /* RO data, expand down, accessed */
.type = 5, /* RO data, expand down, accessed */ d.dpl = 3; /* Visible to user code */
.dpl = 3, /* Visible to user code */ d.s = 1; /* Not a system segment */
.s = 1, /* Not a system segment */ d.p = 1; /* Present */
.p = 1, /* Present */ d.d = 1; /* 32-bit */
.d = 1, /* 32-bit */
};
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);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment