aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2007-10-17 12:04:37 -0400
committerThomas Gleixner <tglx@inhelltoy.tec.linutronix.de>2007-10-17 14:16:08 -0400
commit121d7bf5a246d282ba91234d03a4edf9ccc9c940 (patch)
treeea7c5e9da9b3a09e8cc482eab5039986056b841f /arch/x86
parentdf5ddf620e101f6c7f968c71b327ded16a90ca03 (diff)
x86: misc. constifications
Miscellaneous x86 stuff that can live in .rodata. [ tglx: arch/x86 adaptation ] Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/alternative.c30
-rw-r--r--arch/x86/kernel/setup_64.c4
-rw-r--r--arch/x86/kernel/smpboot_32.c4
-rw-r--r--arch/x86/kernel/smpboot_64.c4
-rw-r--r--arch/x86/kernel/trampoline_32.S4
-rw-r--r--arch/x86/kernel/trampoline_64.S7
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c4
7 files changed, 31 insertions, 26 deletions
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index dff1c9e1c2ee..8cb5dbbd9c2e 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -63,11 +63,11 @@ __setup("noreplace-paravirt", setup_noreplace_paravirt);
63/* Use inline assembly to define this because the nops are defined 63/* Use inline assembly to define this because the nops are defined
64 as inline assembly strings in the include files and we cannot 64 as inline assembly strings in the include files and we cannot
65 get them easily into strings. */ 65 get them easily into strings. */
66asm("\t.data\nintelnops: " 66asm("\t.section .rodata, \"a\"\nintelnops: "
67 GENERIC_NOP1 GENERIC_NOP2 GENERIC_NOP3 GENERIC_NOP4 GENERIC_NOP5 GENERIC_NOP6 67 GENERIC_NOP1 GENERIC_NOP2 GENERIC_NOP3 GENERIC_NOP4 GENERIC_NOP5 GENERIC_NOP6
68 GENERIC_NOP7 GENERIC_NOP8); 68 GENERIC_NOP7 GENERIC_NOP8);
69extern unsigned char intelnops[]; 69extern const unsigned char intelnops[];
70static unsigned char *intel_nops[ASM_NOP_MAX+1] = { 70static const unsigned char *const intel_nops[ASM_NOP_MAX+1] = {
71 NULL, 71 NULL,
72 intelnops, 72 intelnops,
73 intelnops + 1, 73 intelnops + 1,
@@ -81,11 +81,11 @@ static unsigned char *intel_nops[ASM_NOP_MAX+1] = {
81#endif 81#endif
82 82
83#ifdef K8_NOP1 83#ifdef K8_NOP1
84asm("\t.data\nk8nops: " 84asm("\t.section .rodata, \"a\"\nk8nops: "
85 K8_NOP1 K8_NOP2 K8_NOP3 K8_NOP4 K8_NOP5 K8_NOP6 85 K8_NOP1 K8_NOP2 K8_NOP3 K8_NOP4 K8_NOP5 K8_NOP6
86 K8_NOP7 K8_NOP8); 86 K8_NOP7 K8_NOP8);
87extern unsigned char k8nops[]; 87extern const unsigned char k8nops[];
88static unsigned char *k8_nops[ASM_NOP_MAX+1] = { 88static const unsigned char *const k8_nops[ASM_NOP_MAX+1] = {
89 NULL, 89 NULL,
90 k8nops, 90 k8nops,
91 k8nops + 1, 91 k8nops + 1,
@@ -99,11 +99,11 @@ static unsigned char *k8_nops[ASM_NOP_MAX+1] = {
99#endif 99#endif
100 100
101#ifdef K7_NOP1 101#ifdef K7_NOP1
102asm("\t.data\nk7nops: " 102asm("\t.section .rodata, \"a\"\nk7nops: "
103 K7_NOP1 K7_NOP2 K7_NOP3 K7_NOP4 K7_NOP5 K7_NOP6 103 K7_NOP1 K7_NOP2 K7_NOP3 K7_NOP4 K7_NOP5 K7_NOP6
104 K7_NOP7 K7_NOP8); 104 K7_NOP7 K7_NOP8);
105extern unsigned char k7nops[]; 105extern const unsigned char k7nops[];
106static unsigned char *k7_nops[ASM_NOP_MAX+1] = { 106static const unsigned char *const k7_nops[ASM_NOP_MAX+1] = {
107 NULL, 107 NULL,
108 k7nops, 108 k7nops,
109 k7nops + 1, 109 k7nops + 1,
@@ -119,25 +119,25 @@ static unsigned char *k7_nops[ASM_NOP_MAX+1] = {
119#ifdef CONFIG_X86_64 119#ifdef CONFIG_X86_64
120 120
121extern char __vsyscall_0; 121extern char __vsyscall_0;
122static inline unsigned char** find_nop_table(void) 122static inline const unsigned char*const * find_nop_table(void)
123{ 123{
124 return k8_nops; 124 return k8_nops;
125} 125}
126 126
127#else /* CONFIG_X86_64 */ 127#else /* CONFIG_X86_64 */
128 128
129static struct nop { 129static const struct nop {
130 int cpuid; 130 int cpuid;
131 unsigned char **noptable; 131 const unsigned char *const *noptable;
132} noptypes[] = { 132} noptypes[] = {
133 { X86_FEATURE_K8, k8_nops }, 133 { X86_FEATURE_K8, k8_nops },
134 { X86_FEATURE_K7, k7_nops }, 134 { X86_FEATURE_K7, k7_nops },
135 { -1, NULL } 135 { -1, NULL }
136}; 136};
137 137
138static unsigned char** find_nop_table(void) 138static const unsigned char*const * find_nop_table(void)
139{ 139{
140 unsigned char **noptable = intel_nops; 140 const unsigned char *const *noptable = intel_nops;
141 int i; 141 int i;
142 142
143 for (i = 0; noptypes[i].cpuid >= 0; i++) { 143 for (i = 0; noptypes[i].cpuid >= 0; i++) {
@@ -154,7 +154,7 @@ static unsigned char** find_nop_table(void)
154/* Use this to add nops to a buffer, then text_poke the whole buffer. */ 154/* Use this to add nops to a buffer, then text_poke the whole buffer. */
155static void add_nops(void *insns, unsigned int len) 155static void add_nops(void *insns, unsigned int len)
156{ 156{
157 unsigned char **noptable = find_nop_table(); 157 const unsigned char *const *noptable = find_nop_table();
158 158
159 while (len > 0) { 159 while (len > 0) {
160 unsigned int noplen = len; 160 unsigned int noplen = len;
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 8159bf0be17a..5b5e0781d5b6 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -968,7 +968,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
968 * applications want to get the raw CPUID data, they should access 968 * applications want to get the raw CPUID data, they should access
969 * /dev/cpu/<cpu_nr>/cpuid instead. 969 * /dev/cpu/<cpu_nr>/cpuid instead.
970 */ 970 */
971 static char *x86_cap_flags[] = { 971 static const char *const x86_cap_flags[] = {
972 /* Intel-defined */ 972 /* Intel-defined */
973 "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", 973 "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
974 "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", 974 "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
@@ -1022,7 +1022,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1022 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1022 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1023 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1023 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1024 }; 1024 };
1025 static char *x86_power_flags[] = { 1025 static const char *const x86_power_flags[] = {
1026 "ts", /* temperature sensor */ 1026 "ts", /* temperature sensor */
1027 "fid", /* frequency id control */ 1027 "fid", /* frequency id control */
1028 "vid", /* voltage id control */ 1028 "vid", /* voltage id control */
diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c
index 83e4f40f8dc9..be3faac04719 100644
--- a/arch/x86/kernel/smpboot_32.c
+++ b/arch/x86/kernel/smpboot_32.c
@@ -102,8 +102,8 @@ u8 apicid_2_node[MAX_APICID];
102 * Trampoline 80x86 program as an array. 102 * Trampoline 80x86 program as an array.
103 */ 103 */
104 104
105extern unsigned char trampoline_data []; 105extern const unsigned char trampoline_data [];
106extern unsigned char trampoline_end []; 106extern const unsigned char trampoline_end [];
107static unsigned char *trampoline_base; 107static unsigned char *trampoline_base;
108static int trampoline_exec; 108static int trampoline_exec;
109 109
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index 0faa0a0af272..e5f08de9db88 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -102,8 +102,8 @@ EXPORT_PER_CPU_SYMBOL(cpu_core_map);
102 * Trampoline 80x86 program as an array. 102 * Trampoline 80x86 program as an array.
103 */ 103 */
104 104
105extern unsigned char trampoline_data[]; 105extern const unsigned char trampoline_data[];
106extern unsigned char trampoline_end[]; 106extern const unsigned char trampoline_end[];
107 107
108/* State of each CPU */ 108/* State of each CPU */
109DEFINE_PER_CPU(int, cpu_state) = { 0 }; 109DEFINE_PER_CPU(int, cpu_state) = { 0 };
diff --git a/arch/x86/kernel/trampoline_32.S b/arch/x86/kernel/trampoline_32.S
index f62815f8d06a..9bcc1c6aca3d 100644
--- a/arch/x86/kernel/trampoline_32.S
+++ b/arch/x86/kernel/trampoline_32.S
@@ -36,11 +36,11 @@
36#include <asm/segment.h> 36#include <asm/segment.h>
37#include <asm/page.h> 37#include <asm/page.h>
38 38
39.data
40
41/* We can free up trampoline after bootup if cpu hotplug is not supported. */ 39/* We can free up trampoline after bootup if cpu hotplug is not supported. */
42#ifndef CONFIG_HOTPLUG_CPU 40#ifndef CONFIG_HOTPLUG_CPU
43.section ".init.data","aw",@progbits 41.section ".init.data","aw",@progbits
42#else
43.section .rodata,"a",@progbits
44#endif 44#endif
45 45
46.code16 46.code16
diff --git a/arch/x86/kernel/trampoline_64.S b/arch/x86/kernel/trampoline_64.S
index 607983b0d27b..e30b67c6a9f5 100644
--- a/arch/x86/kernel/trampoline_64.S
+++ b/arch/x86/kernel/trampoline_64.S
@@ -33,7 +33,12 @@
33#include <asm/msr.h> 33#include <asm/msr.h>
34#include <asm/segment.h> 34#include <asm/segment.h>
35 35
36.data 36/* We can free up trampoline after bootup if cpu hotplug is not supported. */
37#ifndef CONFIG_HOTPLUG_CPU
38.section .init.data, "aw", @progbits
39#else
40.section .rodata, "a", @progbits
41#endif
37 42
38.code16 43.code16
39 44
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index b87f8548e75a..1f86b529dbbb 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -442,8 +442,8 @@ static __u32 __init
442setup_trampoline(void) 442setup_trampoline(void)
443{ 443{
444 /* these two are global symbols in trampoline.S */ 444 /* these two are global symbols in trampoline.S */
445 extern __u8 trampoline_end[]; 445 extern const __u8 trampoline_end[];
446 extern __u8 trampoline_data[]; 446 extern const __u8 trampoline_data[];
447 447
448 memcpy((__u8 *)trampoline_base, trampoline_data, 448 memcpy((__u8 *)trampoline_base, trampoline_data,
449 trampoline_end - trampoline_data); 449 trampoline_end - trampoline_data);