Commit 121d7bf5 authored by Jan Beulich's avatar Jan Beulich Committed by Thomas Gleixner

x86: misc. constifications

Miscellaneous x86 stuff that can live in .rodata.

[ tglx: arch/x86 adaptation ]
Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent df5ddf62
...@@ -63,11 +63,11 @@ __setup("noreplace-paravirt", setup_noreplace_paravirt); ...@@ -63,11 +63,11 @@ __setup("noreplace-paravirt", setup_noreplace_paravirt);
/* Use inline assembly to define this because the nops are defined /* Use inline assembly to define this because the nops are defined
as inline assembly strings in the include files and we cannot as inline assembly strings in the include files and we cannot
get them easily into strings. */ get them easily into strings. */
asm("\t.data\nintelnops: " asm("\t.section .rodata, \"a\"\nintelnops: "
GENERIC_NOP1 GENERIC_NOP2 GENERIC_NOP3 GENERIC_NOP4 GENERIC_NOP5 GENERIC_NOP6 GENERIC_NOP1 GENERIC_NOP2 GENERIC_NOP3 GENERIC_NOP4 GENERIC_NOP5 GENERIC_NOP6
GENERIC_NOP7 GENERIC_NOP8); GENERIC_NOP7 GENERIC_NOP8);
extern unsigned char intelnops[]; extern const unsigned char intelnops[];
static unsigned char *intel_nops[ASM_NOP_MAX+1] = { static const unsigned char *const intel_nops[ASM_NOP_MAX+1] = {
NULL, NULL,
intelnops, intelnops,
intelnops + 1, intelnops + 1,
...@@ -81,11 +81,11 @@ static unsigned char *intel_nops[ASM_NOP_MAX+1] = { ...@@ -81,11 +81,11 @@ static unsigned char *intel_nops[ASM_NOP_MAX+1] = {
#endif #endif
#ifdef K8_NOP1 #ifdef K8_NOP1
asm("\t.data\nk8nops: " asm("\t.section .rodata, \"a\"\nk8nops: "
K8_NOP1 K8_NOP2 K8_NOP3 K8_NOP4 K8_NOP5 K8_NOP6 K8_NOP1 K8_NOP2 K8_NOP3 K8_NOP4 K8_NOP5 K8_NOP6
K8_NOP7 K8_NOP8); K8_NOP7 K8_NOP8);
extern unsigned char k8nops[]; extern const unsigned char k8nops[];
static unsigned char *k8_nops[ASM_NOP_MAX+1] = { static const unsigned char *const k8_nops[ASM_NOP_MAX+1] = {
NULL, NULL,
k8nops, k8nops,
k8nops + 1, k8nops + 1,
...@@ -99,11 +99,11 @@ static unsigned char *k8_nops[ASM_NOP_MAX+1] = { ...@@ -99,11 +99,11 @@ static unsigned char *k8_nops[ASM_NOP_MAX+1] = {
#endif #endif
#ifdef K7_NOP1 #ifdef K7_NOP1
asm("\t.data\nk7nops: " asm("\t.section .rodata, \"a\"\nk7nops: "
K7_NOP1 K7_NOP2 K7_NOP3 K7_NOP4 K7_NOP5 K7_NOP6 K7_NOP1 K7_NOP2 K7_NOP3 K7_NOP4 K7_NOP5 K7_NOP6
K7_NOP7 K7_NOP8); K7_NOP7 K7_NOP8);
extern unsigned char k7nops[]; extern const unsigned char k7nops[];
static unsigned char *k7_nops[ASM_NOP_MAX+1] = { static const unsigned char *const k7_nops[ASM_NOP_MAX+1] = {
NULL, NULL,
k7nops, k7nops,
k7nops + 1, k7nops + 1,
...@@ -119,25 +119,25 @@ static unsigned char *k7_nops[ASM_NOP_MAX+1] = { ...@@ -119,25 +119,25 @@ static unsigned char *k7_nops[ASM_NOP_MAX+1] = {
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
extern char __vsyscall_0; extern char __vsyscall_0;
static inline unsigned char** find_nop_table(void) static inline const unsigned char*const * find_nop_table(void)
{ {
return k8_nops; return k8_nops;
} }
#else /* CONFIG_X86_64 */ #else /* CONFIG_X86_64 */
static struct nop { static const struct nop {
int cpuid; int cpuid;
unsigned char **noptable; const unsigned char *const *noptable;
} noptypes[] = { } noptypes[] = {
{ X86_FEATURE_K8, k8_nops }, { X86_FEATURE_K8, k8_nops },
{ X86_FEATURE_K7, k7_nops }, { X86_FEATURE_K7, k7_nops },
{ -1, NULL } { -1, NULL }
}; };
static unsigned char** find_nop_table(void) static const unsigned char*const * find_nop_table(void)
{ {
unsigned char **noptable = intel_nops; const unsigned char *const *noptable = intel_nops;
int i; int i;
for (i = 0; noptypes[i].cpuid >= 0; i++) { for (i = 0; noptypes[i].cpuid >= 0; i++) {
...@@ -154,7 +154,7 @@ static unsigned char** find_nop_table(void) ...@@ -154,7 +154,7 @@ static unsigned char** find_nop_table(void)
/* Use this to add nops to a buffer, then text_poke the whole buffer. */ /* Use this to add nops to a buffer, then text_poke the whole buffer. */
static void add_nops(void *insns, unsigned int len) static void add_nops(void *insns, unsigned int len)
{ {
unsigned char **noptable = find_nop_table(); const unsigned char *const *noptable = find_nop_table();
while (len > 0) { while (len > 0) {
unsigned int noplen = len; unsigned int noplen = len;
......
...@@ -968,7 +968,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -968,7 +968,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
* applications want to get the raw CPUID data, they should access * applications want to get the raw CPUID data, they should access
* /dev/cpu/<cpu_nr>/cpuid instead. * /dev/cpu/<cpu_nr>/cpuid instead.
*/ */
static char *x86_cap_flags[] = { static const char *const x86_cap_flags[] = {
/* Intel-defined */ /* Intel-defined */
"fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
"cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
...@@ -1022,7 +1022,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -1022,7 +1022,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
}; };
static char *x86_power_flags[] = { static const char *const x86_power_flags[] = {
"ts", /* temperature sensor */ "ts", /* temperature sensor */
"fid", /* frequency id control */ "fid", /* frequency id control */
"vid", /* voltage id control */ "vid", /* voltage id control */
......
...@@ -102,8 +102,8 @@ u8 apicid_2_node[MAX_APICID]; ...@@ -102,8 +102,8 @@ u8 apicid_2_node[MAX_APICID];
* Trampoline 80x86 program as an array. * Trampoline 80x86 program as an array.
*/ */
extern unsigned char trampoline_data []; extern const unsigned char trampoline_data [];
extern unsigned char trampoline_end []; extern const unsigned char trampoline_end [];
static unsigned char *trampoline_base; static unsigned char *trampoline_base;
static int trampoline_exec; static int trampoline_exec;
......
...@@ -102,8 +102,8 @@ EXPORT_PER_CPU_SYMBOL(cpu_core_map); ...@@ -102,8 +102,8 @@ EXPORT_PER_CPU_SYMBOL(cpu_core_map);
* Trampoline 80x86 program as an array. * Trampoline 80x86 program as an array.
*/ */
extern unsigned char trampoline_data[]; extern const unsigned char trampoline_data[];
extern unsigned char trampoline_end[]; extern const unsigned char trampoline_end[];
/* State of each CPU */ /* State of each CPU */
DEFINE_PER_CPU(int, cpu_state) = { 0 }; DEFINE_PER_CPU(int, cpu_state) = { 0 };
......
...@@ -36,11 +36,11 @@ ...@@ -36,11 +36,11 @@
#include <asm/segment.h> #include <asm/segment.h>
#include <asm/page.h> #include <asm/page.h>
.data
/* We can free up trampoline after bootup if cpu hotplug is not supported. */ /* We can free up trampoline after bootup if cpu hotplug is not supported. */
#ifndef CONFIG_HOTPLUG_CPU #ifndef CONFIG_HOTPLUG_CPU
.section ".init.data","aw",@progbits .section ".init.data","aw",@progbits
#else
.section .rodata,"a",@progbits
#endif #endif
.code16 .code16
......
...@@ -33,7 +33,12 @@ ...@@ -33,7 +33,12 @@
#include <asm/msr.h> #include <asm/msr.h>
#include <asm/segment.h> #include <asm/segment.h>
.data /* We can free up trampoline after bootup if cpu hotplug is not supported. */
#ifndef CONFIG_HOTPLUG_CPU
.section .init.data, "aw", @progbits
#else
.section .rodata, "a", @progbits
#endif
.code16 .code16
......
...@@ -442,8 +442,8 @@ static __u32 __init ...@@ -442,8 +442,8 @@ static __u32 __init
setup_trampoline(void) setup_trampoline(void)
{ {
/* these two are global symbols in trampoline.S */ /* these two are global symbols in trampoline.S */
extern __u8 trampoline_end[]; extern const __u8 trampoline_end[];
extern __u8 trampoline_data[]; extern const __u8 trampoline_data[];
memcpy((__u8 *)trampoline_base, trampoline_data, memcpy((__u8 *)trampoline_base, trampoline_data,
trampoline_end - trampoline_data); trampoline_end - trampoline_data);
......
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