diff options
-rw-r--r-- | arch/x86/Kconfig.debug | 2 | ||||
-rw-r--r-- | arch/x86/kernel/head64.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/head_64.S | 7 | ||||
-rw-r--r-- | include/asm-x86/kdebug.h | 1 | ||||
-rw-r--r-- | include/linux/kernel.h | 3 | ||||
-rw-r--r-- | kernel/printk.c | 7 |
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 | |||
6 | source "lib/Kconfig.debug" | 6 | source "lib/Kconfig.debug" |
7 | 7 | ||
8 | config EARLY_PRINTK | 8 | config 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: | |||
267 | bad_address: | 267 | bad_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 | ||
285 | ENTRY(early_idt_handler) | 287 | ENTRY(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 */ | ||
314 | 1: hlt | 318 | 1: hlt |
315 | jmp 1b | 319 | jmp 1b |
320 | |||
321 | #ifdef CONFIG_EARLY_PRINTK | ||
316 | early_recursion_flag: | 322 | early_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" |
321 | early_idt_ripmsg: | 327 | early_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 | ||
25 | extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2))); | ||
26 | extern void printk_address(unsigned long address); | 25 | extern void printk_address(unsigned long address); |
27 | extern void die(const char *,struct pt_regs *,long); | 26 | extern void die(const char *,struct pt_regs *,long); |
28 | extern int __must_check __die(const char *, struct pt_regs *, long); | 27 | extern 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; } | |||
194 | static inline int log_buf_copy(char *dest, int idx, int len) { return 0; } | 194 | static inline int log_buf_copy(char *dest, int idx, int len) { return 0; } |
195 | #endif | 195 | #endif |
196 | 196 | ||
197 | extern void __attribute__((format(printf, 1, 2))) | ||
198 | early_printk(const char *fmt, ...); | ||
199 | |||
197 | unsigned long int_sqrt(unsigned long); | 200 | unsigned long int_sqrt(unsigned long); |
198 | 201 | ||
199 | extern int printk_ratelimit(void); | 202 | extern 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 | */ | ||
42 | void __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.. */ |