--- zzzz-none-000/linux-4.4.60/lib/vsprintf.c 2017-04-08 07:53:53.000000000 +0000 +++ jet-2400-727/linux-4.4.60/lib/vsprintf.c 2021-03-17 14:36:41.000000000 +0000 @@ -37,6 +37,14 @@ #include /* cpu_to_le16 */ #include + +#if defined(CONFIG_AVM_ENHANCED) +#include +#include +#endif/*--- #if defined(CONFIG_AVM_ENHANCED) ---*/ + +#include + #include "kstrtox.h" /** @@ -618,8 +626,10 @@ struct printf_spec spec, const char *fmt) { unsigned long value; -#ifdef CONFIG_KALLSYMS char sym[KSYM_SYMBOL_LEN]; +#ifndef CONFIG_KALLSYMS + struct module *mod; + int len; #endif if (fmt[1] == 'R') @@ -630,18 +640,29 @@ if (*fmt == 'B') sprint_backtrace(sym, value); else if (*fmt != 'f' && *fmt != 's') +#if defined(CONFIG_AVM_ENHANCED) + print_memory_classifier(sym, sizeof(sym), value, 1); +#else sprint_symbol(sym, value); +#endif/*--- #if defined(CONFIG_AVM_ENHANCED) ---*/ else sprint_symbol_no_offset(sym, value); - - return string(buf, end, sym, spec); #else - spec.field_width = 2 * sizeof(void *); - spec.flags |= SPECIAL | SMALL | ZEROPAD; - spec.base = 16; - - return number(buf, end, value, spec); +#if defined(CONFIG_AVM_BOOTMEM) + if(!IS_ERR(module_alloc_find_module_name)) { + char sym[KSYM_SYMBOL_LEN]; + module_alloc_find_module_name(sym, sym + sizeof(sym), value); + return string(buf, end, sym, spec); + } +#endif/*--- #if defined(CONFIG_AVM_BOOTMEM) ---*/ + len = snprintf(sym, sizeof(sym), "0x%lx", value); + + mod = __module_address(value); + if (mod) + snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]", + mod->name, mod->module_core, mod->core_size); #endif + return string(buf, end, sym, spec); } static noinline_for_stack