Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
module.c File Reference
#include <linux/moduleloader.h>
#include <linux/elf.h>
#include <linux/vmalloc.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/bug.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <asm/pgtable.h>
#include <asm/unwind.h>

Go to the source code of this file.

Data Structures

struct  got_entry
 
struct  stub_entry
 

Macros

#define DEBUGP(fmt...)
 
#define RELOC_REACHABLE(val, bits)
 
#define CHECK_RELOC(val, bits)
 
#define MAX_GOTS   4095
 
#define rnd(x)   (((x)+0x1000)&~0x1fff)
 
#define fsel(v, a)   ((v)+(a))
 
#define lsel(v, a)   (((v)+(a))>>11)
 
#define rsel(v, a)   (((v)+(a))&0x7ff)
 
#define lrsel(v, a)   (((v)+rnd(a))>>11)
 
#define rrsel(v, a)   ((((v)+rnd(a))&0x7ff)+((a)-rnd(a)))
 
#define mask(x, sz)   ((x) & ~((1<<(sz))-1))
 
#define CONST
 

Enumerations

enum  elf_stub_type { ELF_STUB_GOT, ELF_STUB_MILLI, ELF_STUB_DIRECT }
 

Functions

voidmodule_alloc (unsigned long size)
 
void module_free (struct module *mod, void *module_region)
 
unsigned int arch_mod_section_prepend (struct module *mod, unsigned int section)
 
int module_frob_arch_sections (CONST Elf_Ehdr *hdr, CONST Elf_Shdr *sechdrs, CONST char *secstrings, struct module *me)
 
int apply_relocate_add (Elf_Shdr *sechdrs, const char *strtab, unsigned int symindex, unsigned int relsec, struct module *me)
 
int module_finalize (const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, struct module *me)
 
void module_arch_cleanup (struct module *mod)
 

Macro Definition Documentation

#define CHECK_RELOC (   val,
  bits 
)
Value:
printk(KERN_ERR "module %s relocation of symbol %s is out of range (0x%lx in %d bits)\n", \
me->name, strtab + sym->st_name, (unsigned long)val, bits); \
return -ENOEXEC; \
}

Definition at line 81 of file module.c.

#define CONST

Definition at line 323 of file module.c.

#define DEBUGP (   fmt...)

Definition at line 73 of file module.c.

#define fsel (   v,
  a 
)    ((v)+(a))

Definition at line 139 of file module.c.

#define lrsel (   v,
  a 
)    (((v)+rnd(a))>>11)

Definition at line 145 of file module.c.

#define lsel (   v,
  a 
)    (((v)+(a))>>11)

Definition at line 141 of file module.c.

#define mask (   x,
  sz 
)    ((x) & ~((1<<(sz))-1))

Definition at line 149 of file module.c.

#define MAX_GOTS   4095

Definition at line 97 of file module.c.

#define RELOC_REACHABLE (   val,
  bits 
)
Value:
(( ( !((val) & (1<<((bits)-1))) && ((val)>>(bits)) != 0 ) || \
( ((val) & (1<<((bits)-1))) && ((val)>>(bits)) != (((__typeof__(val))(~0))>>((bits)+2)))) ? \
0 : 1)

Definition at line 76 of file module.c.

#define rnd (   x)    (((x)+0x1000)&~0x1fff)

Definition at line 137 of file module.c.

#define rrsel (   v,
  a 
)    ((((v)+rnd(a))&0x7ff)+((a)-rnd(a)))

Definition at line 147 of file module.c.

#define rsel (   v,
  a 
)    (((v)+(a))&0x7ff)

Definition at line 143 of file module.c.

Enumeration Type Documentation

Enumerator:
ELF_STUB_GOT 
ELF_STUB_MILLI 
ELF_STUB_DIRECT 

Definition at line 441 of file module.c.

Function Documentation

int apply_relocate_add ( Elf_Shdr sechdrs,
const char strtab,
unsigned int  symindex,
unsigned int  relsec,
struct module me 
)

Definition at line 544 of file module.c.

unsigned int arch_mod_section_prepend ( struct module mod,
unsigned int  section 
)

Definition at line 314 of file module.c.

void* module_alloc ( unsigned long  size)

Definition at line 215 of file module.c.

void module_arch_cleanup ( struct module mod)

Definition at line 943 of file module.c.

int module_finalize ( const Elf_Ehdr hdr,
const Elf_Shdr sechdrs,
struct module me 
)

Definition at line 862 of file module.c.

void module_free ( struct module mod,
void module_region 
)

Definition at line 305 of file module.c.

int module_frob_arch_sections ( CONST Elf_Ehdr hdr,
CONST Elf_Shdr sechdrs,
CONST char secstrings,
struct module me 
)

Definition at line 324 of file module.c.