aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-01-30 07:33:06 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:06 -0500
commit076f9776f5d8d131b36955db8641aba3893c2c1b (patch)
treeb85e705ecfe34400c6e1188fb470572956a232ab
parent8866cd9dc9d0bbadcf361a14e0cdfecb66473087 (diff)
x86: make early printk selectable on 64-bit as well
Enable CONFIG_EMBEDDED to select CONFIG_EARLY_PRINTK on 64-bit as well. saves ~2K: text data bss dec hex filename 7290283 3672091 1907848 12870222 c4624e vmlinux.before 7288373 3671795 1907848 12868016 c459b0 vmlinux.after Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/Kconfig.debug2
-rw-r--r--arch/x86/kernel/head64.c7
-rw-r--r--arch/x86/kernel/head_64.S7
-rw-r--r--include/asm-x86/kdebug.h1
-rw-r--r--include/linux/kernel.h3
-rw-r--r--kernel/printk.c7
6 files changed, 24 insertions, 3 deletions
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 15854b53badc..88420af98140 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -6,7 +6,7 @@ config TRACE_IRQFLAGS_SUPPORT
6source "lib/Kconfig.debug" 6source "lib/Kconfig.debug"
7 7
8config EARLY_PRINTK 8config EARLY_PRINTK
9 bool "Early printk" if EMBEDDED && DEBUG_KERNEL && X86_32 9 bool "Early printk" if EMBEDDED
10 default y 10 default y
11 help 11 help
12 Write kernel log output directly into the VGA buffer or to a serial 12 Write kernel log output directly into the VGA buffer or to a serial
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 85c1e6bf8022..87e031d4abf1 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -58,8 +58,13 @@ void __init x86_64_start_kernel(char * real_mode_data)
58 /* Make NULL pointers segfault */ 58 /* Make NULL pointers segfault */
59 zap_identity_mappings(); 59 zap_identity_mappings();
60 60
61 for (i = 0; i < IDT_ENTRIES; i++) 61 for (i = 0; i < IDT_ENTRIES; i++) {
62#ifdef CONFIG_EARLY_PRINTK
62 set_intr_gate(i, &early_idt_handlers[i]); 63 set_intr_gate(i, &early_idt_handlers[i]);
64#else
65 set_intr_gate(i, early_idt_handler);
66#endif
67 }
63 load_idt((const struct desc_ptr *)&idt_descr); 68 load_idt((const struct desc_ptr *)&idt_descr);
64 69
65 early_printk("Kernel alive\n"); 70 early_printk("Kernel alive\n");
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 8b4c35cb519a..1d5a7a361200 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -267,6 +267,7 @@ init_rsp:
267bad_address: 267bad_address:
268 jmp bad_address 268 jmp bad_address
269 269
270#ifdef CONFIG_EARLY_PRINTK
270.macro early_idt_tramp first, last 271.macro early_idt_tramp first, last
271 .ifgt \last-\first 272 .ifgt \last-\first
272 early_idt_tramp \first, \last-1 273 early_idt_tramp \first, \last-1
@@ -281,8 +282,10 @@ early_idt_handlers:
281 early_idt_tramp 64, 127 282 early_idt_tramp 64, 127
282 early_idt_tramp 128, 191 283 early_idt_tramp 128, 191
283 early_idt_tramp 192, 255 284 early_idt_tramp 192, 255
285#endif
284 286
285ENTRY(early_idt_handler) 287ENTRY(early_idt_handler)
288#ifdef CONFIG_EARLY_PRINTK
286 cmpl $2,early_recursion_flag(%rip) 289 cmpl $2,early_recursion_flag(%rip)
287 jz 1f 290 jz 1f
288 incl early_recursion_flag(%rip) 291 incl early_recursion_flag(%rip)
@@ -311,8 +314,11 @@ ENTRY(early_idt_handler)
311 movq 8(%rsp),%rsi # get rip again 314 movq 8(%rsp),%rsi # get rip again
312 call __print_symbol 315 call __print_symbol
313#endif 316#endif
317#endif /* EARLY_PRINTK */
3141: hlt 3181: hlt
315 jmp 1b 319 jmp 1b
320
321#ifdef CONFIG_EARLY_PRINTK
316early_recursion_flag: 322early_recursion_flag:
317 .long 0 323 .long 0
318 324
@@ -320,6 +326,7 @@ early_idt_msg:
320 .asciz "PANIC: early exception %02lx rip %lx:%lx error %lx cr2 %lx\n" 326 .asciz "PANIC: early exception %02lx rip %lx:%lx error %lx cr2 %lx\n"
321early_idt_ripmsg: 327early_idt_ripmsg:
322 .asciz "RIP %s\n" 328 .asciz "RIP %s\n"
329#endif /* CONFIG_EARLY_PRINTK */
323 330
324.balign PAGE_SIZE 331.balign PAGE_SIZE
325 332
diff --git a/include/asm-x86/kdebug.h b/include/asm-x86/kdebug.h
index a5e5e3b7eb23..e9f42d1ac38f 100644
--- a/include/asm-x86/kdebug.h
+++ b/include/asm-x86/kdebug.h
@@ -22,7 +22,6 @@ enum die_val {
22 DIE_PAGE_FAULT, 22 DIE_PAGE_FAULT,
23}; 23};
24 24
25extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2)));
26extern void printk_address(unsigned long address); 25extern void printk_address(unsigned long address);
27extern void die(const char *,struct pt_regs *,long); 26extern void die(const char *,struct pt_regs *,long);
28extern int __must_check __die(const char *, struct pt_regs *, long); 27extern int __must_check __die(const char *, struct pt_regs *, long);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index a7283c9beadf..ff356b2ee478 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -194,6 +194,9 @@ static inline int log_buf_read(int idx) { return 0; }
194static inline int log_buf_copy(char *dest, int idx, int len) { return 0; } 194static inline int log_buf_copy(char *dest, int idx, int len) { return 0; }
195#endif 195#endif
196 196
197extern void __attribute__((format(printf, 1, 2)))
198 early_printk(const char *fmt, ...);
199
197unsigned long int_sqrt(unsigned long); 200unsigned long int_sqrt(unsigned long);
198 201
199extern int printk_ratelimit(void); 202extern int printk_ratelimit(void);
diff --git a/kernel/printk.c b/kernel/printk.c
index 3b7c968d0ef9..58bbec684119 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -36,6 +36,13 @@
36 36
37#include <asm/uaccess.h> 37#include <asm/uaccess.h>
38 38
39/*
40 * Architectures can override it:
41 */
42void __attribute__((weak)) early_printk(const char *fmt, ...)
43{
44}
45
39#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) 46#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
40 47
41/* printk's without a loglevel use this.. */ 48/* printk's without a loglevel use this.. */