File: module.h

package info (click to toggle)
kernel-source-2.4.27 2.4.27-10sarge5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 191,224 kB
  • ctags: 610,077
  • sloc: ansic: 3,299,602; asm: 164,708; makefile: 10,962; sh: 3,725; perl: 2,273; yacc: 1,651; cpp: 820; lex: 752; tcl: 577; awk: 251; lisp: 218; sed: 79
file content (67 lines) | stat: -rw-r--r-- 1,876 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef _ASM_MIPS64_MODULE_H
#define _ASM_MIPS64_MODULE_H
/*
 * This file contains the mips64 architecture specific module code.
 */

#include <linux/module.h>
#include <asm/uaccess.h>

#define module_map(x)		vmalloc(x)
#define module_unmap(x)		vfree(x)
#define module_arch_init(x)	mips64_module_init(x)
#define arch_init_modules(x)	mips64_init_modules(x)

/*
 * This must match in size and layout the data created by
 * modutils/obj/obj-mips64.c
 */
struct archdata {
	const struct exception_table_entry *dbe_table_start;
	const struct exception_table_entry *dbe_table_end;
};

static inline int
mips64_module_init(struct module *mod)
{
	struct archdata *archdata;

	if (!mod_member_present(mod, archdata_end))
		return 0;

	archdata = (struct archdata *)(mod->archdata_start);
	if (!mod_archdata_member_present(mod, struct archdata, dbe_table_end))
		return 0;

	if (archdata->dbe_table_start > archdata->dbe_table_end ||
	    (archdata->dbe_table_start &&
	     !((unsigned long)archdata->dbe_table_start >=
	       ((unsigned long)mod + mod->size_of_struct) &&
	       ((unsigned long)archdata->dbe_table_end <
	        (unsigned long)mod + mod->size))) ||
            (((unsigned long)archdata->dbe_table_start -
	      (unsigned long)archdata->dbe_table_end) %
	     sizeof(struct exception_table_entry))) {
		printk(KERN_ERR
			"module_arch_init: archdata->dbe_table_* invalid.\n");
		return 1;
	}

	return 0;
}

static inline void
mips64_init_modules(struct module *mod)
{
	extern const struct exception_table_entry __start___dbe_table[];
	extern const struct exception_table_entry __stop___dbe_table[];
	static struct archdata archdata = {
		.dbe_table_start	= __start___dbe_table,
		.dbe_table_end		= __stop___dbe_table,
	};

	mod->archdata_start = (char *)&archdata;
	mod->archdata_end = mod->archdata_start + sizeof(archdata);
}

#endif /* _ASM_MIPS64_MODULE_H */