mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
x86/boot: Add hex output for debugging
This is useful for reporting various addresses or other values while debugging early boot, for example, the recent kernel image size vs kernel run size. For example, when CONFIG_X86_VERBOSE_BOOTUP is set, this is now visible at boot time: early console in setup code early console in decompress_kernel input_data: 0x0000000001e1526e input_len: 0x0000000000732236 output: 0x0000000001000000 output_len: 0x0000000001535640 run_size: 0x00000000021fb000 KASLR using RDTSC... Signed-off-by: Kees Cook <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Jan Beulich <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: Joe Perches <[email protected]> Cc: Josh Triplett <[email protected]> Cc: Junjie Mao <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vivek Goyal <[email protected]> Cc: Yinghai Lu <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
c7e9ad7da2
commit
79063a7c02
2 changed files with 35 additions and 0 deletions
|
|
@ -220,6 +220,23 @@ void __putstr(const char *s)
|
|||
outb(0xff & (pos >> 1), vidport+1);
|
||||
}
|
||||
|
||||
void __puthex(unsigned long value)
|
||||
{
|
||||
char alpha[2] = "0";
|
||||
int bits;
|
||||
|
||||
for (bits = sizeof(value) * 8 - 4; bits >= 0; bits -= 4) {
|
||||
unsigned long digit = (value >> bits) & 0xf;
|
||||
|
||||
if (digit < 0xA)
|
||||
alpha[0] = '0' + digit;
|
||||
else
|
||||
alpha[0] = 'a' + (digit - 0xA);
|
||||
|
||||
__putstr(alpha);
|
||||
}
|
||||
}
|
||||
|
||||
static void error(char *x)
|
||||
{
|
||||
error_putstr("\n\n");
|
||||
|
|
@ -399,6 +416,13 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap,
|
|||
free_mem_ptr = heap; /* Heap */
|
||||
free_mem_end_ptr = heap + BOOT_HEAP_SIZE;
|
||||
|
||||
/* Report initial kernel position details. */
|
||||
debug_putaddr(input_data);
|
||||
debug_putaddr(input_len);
|
||||
debug_putaddr(output);
|
||||
debug_putaddr(output_len);
|
||||
debug_putaddr(run_size);
|
||||
|
||||
/*
|
||||
* The memory hole needed for the kernel is the larger of either
|
||||
* the entire decompressed kernel plus relocation table, or the
|
||||
|
|
|
|||
|
|
@ -34,16 +34,27 @@ extern memptr free_mem_ptr;
|
|||
extern memptr free_mem_end_ptr;
|
||||
extern struct boot_params *real_mode; /* Pointer to real-mode data */
|
||||
void __putstr(const char *s);
|
||||
void __puthex(unsigned long value);
|
||||
#define error_putstr(__x) __putstr(__x)
|
||||
#define error_puthex(__x) __puthex(__x)
|
||||
|
||||
#ifdef CONFIG_X86_VERBOSE_BOOTUP
|
||||
|
||||
#define debug_putstr(__x) __putstr(__x)
|
||||
#define debug_puthex(__x) __puthex(__x)
|
||||
#define debug_putaddr(__x) { \
|
||||
debug_putstr(#__x ": 0x"); \
|
||||
debug_puthex((unsigned long)(__x)); \
|
||||
debug_putstr("\n"); \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline void debug_putstr(const char *s)
|
||||
{ }
|
||||
static inline void debug_puthex(const char *s)
|
||||
{ }
|
||||
#define debug_putaddr(x) /* */
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue