mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 08:31:13 +00:00
x86/debug: Add KERN_<LEVEL> to bare printks, convert printks to pr_<level>
Use a more current logging style: - Bare printks should have a KERN_<LEVEL> for consistency's sake - Add pr_fmt where appropriate - Neaten some macro definitions - Convert some Ok output to OK - Use "%s: ", __func__ in pr_fmt for summit - Convert some printks to pr_<level> Message output is not identical in all cases. Signed-off-by: Joe Perches <joe@perches.com> Cc: levinsasha928@gmail.com Link: http://lkml.kernel.org/r/1337655007.24226.10.camel@joe2Laptop [ merged two similar patches, tidied up the changelog ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
f9ba7179ce
commit
c767a54ba0
29 changed files with 301 additions and 279 deletions
|
@ -15,6 +15,9 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/moduleloader.h>
|
||||
#include <linux/elf.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
@ -30,9 +33,14 @@
|
|||
#include <asm/pgtable.h>
|
||||
|
||||
#if 0
|
||||
#define DEBUGP printk
|
||||
#define DEBUGP(fmt, ...) \
|
||||
printk(KERN_DEBUG fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUGP(fmt...)
|
||||
#define DEBUGP(fmt, ...) \
|
||||
do { \
|
||||
if (0) \
|
||||
printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
void *module_alloc(unsigned long size)
|
||||
|
@ -56,8 +64,8 @@ int apply_relocate(Elf32_Shdr *sechdrs,
|
|||
Elf32_Sym *sym;
|
||||
uint32_t *location;
|
||||
|
||||
DEBUGP("Applying relocate section %u to %u\n", relsec,
|
||||
sechdrs[relsec].sh_info);
|
||||
DEBUGP("Applying relocate section %u to %u\n",
|
||||
relsec, sechdrs[relsec].sh_info);
|
||||
for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
|
||||
/* This is where to make the change */
|
||||
location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
|
||||
|
@ -77,7 +85,7 @@ int apply_relocate(Elf32_Shdr *sechdrs,
|
|||
*location += sym->st_value - (uint32_t)location;
|
||||
break;
|
||||
default:
|
||||
printk(KERN_ERR "module %s: Unknown relocation: %u\n",
|
||||
pr_err("%s: Unknown relocation: %u\n",
|
||||
me->name, ELF32_R_TYPE(rel[i].r_info));
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
@ -97,8 +105,8 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
|
|||
void *loc;
|
||||
u64 val;
|
||||
|
||||
DEBUGP("Applying relocate section %u to %u\n", relsec,
|
||||
sechdrs[relsec].sh_info);
|
||||
DEBUGP("Applying relocate section %u to %u\n",
|
||||
relsec, sechdrs[relsec].sh_info);
|
||||
for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
|
||||
/* This is where to make the change */
|
||||
loc = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
|
||||
|
@ -110,8 +118,8 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
|
|||
+ ELF64_R_SYM(rel[i].r_info);
|
||||
|
||||
DEBUGP("type %d st_value %Lx r_addend %Lx loc %Lx\n",
|
||||
(int)ELF64_R_TYPE(rel[i].r_info),
|
||||
sym->st_value, rel[i].r_addend, (u64)loc);
|
||||
(int)ELF64_R_TYPE(rel[i].r_info),
|
||||
sym->st_value, rel[i].r_addend, (u64)loc);
|
||||
|
||||
val = sym->st_value + rel[i].r_addend;
|
||||
|
||||
|
@ -140,7 +148,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
|
|||
#endif
|
||||
break;
|
||||
default:
|
||||
printk(KERN_ERR "module %s: Unknown rela relocation: %llu\n",
|
||||
pr_err("%s: Unknown rela relocation: %llu\n",
|
||||
me->name, ELF64_R_TYPE(rel[i].r_info));
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
@ -148,9 +156,9 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
|
|||
return 0;
|
||||
|
||||
overflow:
|
||||
printk(KERN_ERR "overflow in relocation type %d val %Lx\n",
|
||||
pr_err("overflow in relocation type %d val %Lx\n",
|
||||
(int)ELF64_R_TYPE(rel[i].r_info), val);
|
||||
printk(KERN_ERR "`%s' likely not compiled with -mcmodel=kernel\n",
|
||||
pr_err("`%s' likely not compiled with -mcmodel=kernel\n",
|
||||
me->name);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue