mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
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>
This commit is contained in:
parent
8866cd9dc9
commit
076f9776f5
6 changed files with 24 additions and 3 deletions
|
@ -6,7 +6,7 @@ config TRACE_IRQFLAGS_SUPPORT
|
||||||
source "lib/Kconfig.debug"
|
source "lib/Kconfig.debug"
|
||||||
|
|
||||||
config EARLY_PRINTK
|
config EARLY_PRINTK
|
||||||
bool "Early printk" if EMBEDDED && DEBUG_KERNEL && X86_32
|
bool "Early printk" if EMBEDDED
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Write kernel log output directly into the VGA buffer or to a serial
|
Write kernel log output directly into the VGA buffer or to a serial
|
||||||
|
|
|
@ -58,8 +58,13 @@ void __init x86_64_start_kernel(char * real_mode_data)
|
||||||
/* Make NULL pointers segfault */
|
/* Make NULL pointers segfault */
|
||||||
zap_identity_mappings();
|
zap_identity_mappings();
|
||||||
|
|
||||||
for (i = 0; i < IDT_ENTRIES; i++)
|
for (i = 0; i < IDT_ENTRIES; i++) {
|
||||||
|
#ifdef CONFIG_EARLY_PRINTK
|
||||||
set_intr_gate(i, &early_idt_handlers[i]);
|
set_intr_gate(i, &early_idt_handlers[i]);
|
||||||
|
#else
|
||||||
|
set_intr_gate(i, early_idt_handler);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
load_idt((const struct desc_ptr *)&idt_descr);
|
load_idt((const struct desc_ptr *)&idt_descr);
|
||||||
|
|
||||||
early_printk("Kernel alive\n");
|
early_printk("Kernel alive\n");
|
||||||
|
|
|
@ -267,6 +267,7 @@ init_rsp:
|
||||||
bad_address:
|
bad_address:
|
||||||
jmp bad_address
|
jmp bad_address
|
||||||
|
|
||||||
|
#ifdef CONFIG_EARLY_PRINTK
|
||||||
.macro early_idt_tramp first, last
|
.macro early_idt_tramp first, last
|
||||||
.ifgt \last-\first
|
.ifgt \last-\first
|
||||||
early_idt_tramp \first, \last-1
|
early_idt_tramp \first, \last-1
|
||||||
|
@ -281,8 +282,10 @@ early_idt_handlers:
|
||||||
early_idt_tramp 64, 127
|
early_idt_tramp 64, 127
|
||||||
early_idt_tramp 128, 191
|
early_idt_tramp 128, 191
|
||||||
early_idt_tramp 192, 255
|
early_idt_tramp 192, 255
|
||||||
|
#endif
|
||||||
|
|
||||||
ENTRY(early_idt_handler)
|
ENTRY(early_idt_handler)
|
||||||
|
#ifdef CONFIG_EARLY_PRINTK
|
||||||
cmpl $2,early_recursion_flag(%rip)
|
cmpl $2,early_recursion_flag(%rip)
|
||||||
jz 1f
|
jz 1f
|
||||||
incl early_recursion_flag(%rip)
|
incl early_recursion_flag(%rip)
|
||||||
|
@ -311,8 +314,11 @@ ENTRY(early_idt_handler)
|
||||||
movq 8(%rsp),%rsi # get rip again
|
movq 8(%rsp),%rsi # get rip again
|
||||||
call __print_symbol
|
call __print_symbol
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* EARLY_PRINTK */
|
||||||
1: hlt
|
1: hlt
|
||||||
jmp 1b
|
jmp 1b
|
||||||
|
|
||||||
|
#ifdef CONFIG_EARLY_PRINTK
|
||||||
early_recursion_flag:
|
early_recursion_flag:
|
||||||
.long 0
|
.long 0
|
||||||
|
|
||||||
|
@ -320,6 +326,7 @@ early_idt_msg:
|
||||||
.asciz "PANIC: early exception %02lx rip %lx:%lx error %lx cr2 %lx\n"
|
.asciz "PANIC: early exception %02lx rip %lx:%lx error %lx cr2 %lx\n"
|
||||||
early_idt_ripmsg:
|
early_idt_ripmsg:
|
||||||
.asciz "RIP %s\n"
|
.asciz "RIP %s\n"
|
||||||
|
#endif /* CONFIG_EARLY_PRINTK */
|
||||||
|
|
||||||
.balign PAGE_SIZE
|
.balign PAGE_SIZE
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ enum die_val {
|
||||||
DIE_PAGE_FAULT,
|
DIE_PAGE_FAULT,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2)));
|
|
||||||
extern void printk_address(unsigned long address);
|
extern void printk_address(unsigned long address);
|
||||||
extern void die(const char *,struct pt_regs *,long);
|
extern void die(const char *,struct pt_regs *,long);
|
||||||
extern int __must_check __die(const char *, struct pt_regs *, long);
|
extern int __must_check __die(const char *, struct pt_regs *, long);
|
||||||
|
|
|
@ -194,6 +194,9 @@ static inline int log_buf_read(int idx) { return 0; }
|
||||||
static inline int log_buf_copy(char *dest, int idx, int len) { return 0; }
|
static inline int log_buf_copy(char *dest, int idx, int len) { return 0; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern void __attribute__((format(printf, 1, 2)))
|
||||||
|
early_printk(const char *fmt, ...);
|
||||||
|
|
||||||
unsigned long int_sqrt(unsigned long);
|
unsigned long int_sqrt(unsigned long);
|
||||||
|
|
||||||
extern int printk_ratelimit(void);
|
extern int printk_ratelimit(void);
|
||||||
|
|
|
@ -36,6 +36,13 @@
|
||||||
|
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Architectures can override it:
|
||||||
|
*/
|
||||||
|
void __attribute__((weak)) early_printk(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
|
#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
|
||||||
|
|
||||||
/* printk's without a loglevel use this.. */
|
/* printk's without a loglevel use this.. */
|
||||||
|
|
Loading…
Reference in a new issue