aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2004-12-29 13:43:52 +0000
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2004-12-29 13:43:52 +0000
commit6913eb35433fce5edb62bf8736dc77f3adc47ffa (patch)
tree0d4eabecd607689fdb0fbdbca388a17b0d2d2677
parentb556516ff2340895d9d6c2acf2530e077cf3d245 (diff)
downloadxen-6913eb35433fce5edb62bf8736dc77f3adc47ffa.tar.gz
xen-6913eb35433fce5edb62bf8736dc77f3adc47ffa.tar.bz2
xen-6913eb35433fce5edb62bf8736dc77f3adc47ffa.zip
bitkeeper revision 1.1159.170.68 (41d2b498y1kgB6L3q_YXZmDzui_mSQ)
Pull command-line option declarations to files in which they are used, rather than having a single list of them in common/kernel.c.
-rw-r--r--xen/arch/x86/domain.c6
-rw-r--r--xen/arch/x86/io_apic.c7
-rw-r--r--xen/arch/x86/pdb-stub.c6
-rw-r--r--xen/arch/x86/setup.c23
-rw-r--r--xen/arch/x86/traps.c13
-rw-r--r--xen/common/kernel.c140
-rw-r--r--xen/common/page_alloc.c7
-rw-r--r--xen/common/physdev.c7
-rw-r--r--xen/common/schedule.c6
-rw-r--r--xen/common/trace.c9
-rw-r--r--xen/drivers/char/console.c12
-rw-r--r--xen/drivers/char/serial.c8
-rw-r--r--xen/include/xen/init.h123
13 files changed, 155 insertions, 212 deletions
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 95dc9779a6..d0cf493522 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -12,6 +12,7 @@
*/
#include <xen/config.h>
+#include <xen/init.h>
#include <xen/lib.h>
#include <xen/errno.h>
#include <xen/sched.h>
@@ -34,6 +35,10 @@
#include <xen/elf.h>
#include <xen/multicall.h>
+/* opt_noreboot: If true, machine will need manual reset on error. */
+static int opt_noreboot = 0;
+boolean_param("noreboot", opt_noreboot);
+
#if !defined(CONFIG_X86_64BITMODE)
/* No ring-3 access in initial page tables. */
#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
@@ -110,7 +115,6 @@ static inline void kb_wait(void)
void machine_restart(char * __unused)
{
- extern int opt_noreboot;
#ifdef CONFIG_SMP
int cpuid;
#endif
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 5ab74351b8..5e3fa047f5 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1830,7 +1830,12 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
#endif /*CONFIG_ACPI_BOOT*/
-extern char opt_leveltrigger[], opt_edgetrigger[];
+/* opt_leveltrigger, opt_edgetrigger: Force an IO-APIC-routed IRQ to be */
+/* level- or edge-triggered. */
+/* Example: 'leveltrigger=4,5,6,20 edgetrigger=21'. */
+static char opt_leveltrigger[30] = "", opt_edgetrigger[30] = "";
+string_param("leveltrigger", opt_leveltrigger);
+string_param("edgetrigger", opt_edgetrigger);
static int __init ioapic_trigger_setup(void)
{
diff --git a/xen/arch/x86/pdb-stub.c b/xen/arch/x86/pdb-stub.c
index 88aa373122..bb145aa104 100644
--- a/xen/arch/x86/pdb-stub.c
+++ b/xen/arch/x86/pdb-stub.c
@@ -22,6 +22,10 @@
#include <xen/serial.h>
#include <xen/softirq.h>
+/* opt_pdb: Name of serial port for Xen pervasive debugger (and enable pdb) */
+static unsigned char opt_pdb[10] = "none";
+string_param("pdb", opt_pdb);
+
#define PDB_DEBUG_TRACE
#ifdef PDB_DEBUG_TRACE
#define TRC(_x) _x
@@ -1241,8 +1245,6 @@ void pdb_handle_debug_trap(struct xen_regs *regs, long error_code)
void initialize_pdb()
{
- extern char opt_pdb[];
-
/* Certain state must be initialised even when PDB will not be used. */
memset((void *) &breakpoints, 0, sizeof(breakpoints));
INIT_LIST_HEAD(&breakpoints.list);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index d2109f4fb8..d69ff860ff 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -16,14 +16,33 @@
#include <asm/domain_page.h>
#include <asm/pdb.h>
+/* opt_noht: If true, Hyperthreading is ignored. */
+int opt_noht = 0;
+boolean_param("noht", opt_noht);
+
+/* opt_noacpi: If true, ACPI tables are not parsed. */
+static int opt_noacpi = 0;
+boolean_param("noacpi", opt_noacpi);
+
+/* opt_nosmp: If true, secondary processors are ignored. */
+static int opt_nosmp = 0;
+boolean_param("nosmp", opt_nosmp);
+
+/* opt_ignorebiostables: If true, ACPI and MP tables are ignored. */
+/* NB. This flag implies 'nosmp' and 'noacpi'. */
+static int opt_ignorebiostables = 0;
+boolean_param("ignorebiostables", opt_ignorebiostables);
+
+/* opt_watchdog: If true, run a watchdog NMI on each processor. */
+static int opt_watchdog = 0;
+boolean_param("watchdog", opt_watchdog);
+
extern void arch_init_memory(void);
extern void init_IRQ(void);
extern void trap_init(void);
extern void time_init(void);
extern void ac_timer_init(void);
extern void initialize_keytable();
-extern int opt_nosmp, opt_watchdog, opt_noacpi;
-extern int opt_ignorebiostables;
extern int do_timer_lists_from_pit;
char ignore_irq13; /* set if exception 16 works */
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 6837a143d3..ed996e30a0 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -52,6 +52,19 @@
#include <asm/i387.h>
#include <asm/debugger.h>
+/*
+ * opt_nmi: one of 'ignore', 'dom0', or 'fatal'.
+ * fatal: Xen prints diagnostic message and then hangs.
+ * dom0: The NMI is virtualised to DOM0.
+ * ignore: The NMI error is cleared and ignored.
+ */
+#ifdef NDEBUG
+char opt_nmi[10] = "dom0";
+#else
+char opt_nmi[10] = "fatal";
+#endif
+string_param("nmi", opt_nmi);
+
#if defined(__i386__)
#define GUEST_FAULT(_r) (likely(VM86_MODE(_r) || !RING_0(_r)))
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index c7e6b27a4e..e7305dbce8 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -9,6 +9,7 @@
#include <stdarg.h>
#include <xen/config.h>
+#include <xen/init.h>
#include <xen/lib.h>
#include <xen/errno.h>
#include <xen/spinlock.h>
@@ -26,6 +27,17 @@
#include <asm/domain_page.h>
#include <public/dom0_ops.h>
+/* opt_dom0_mem: Kilobytes of memory allocated to domain 0. */
+static unsigned int opt_dom0_mem = 16000;
+integer_param("dom0_mem", opt_dom0_mem);
+
+/*
+ * opt_xenheap_megabytes: Size of Xen heap in megabytes, excluding the
+ * pfn_info table and allocation bitmap.
+ */
+static unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB;
+integer_param("xenheap_megabytes", opt_xenheap_megabytes);
+
unsigned long xenheap_phys_end;
xmem_cache_t *domain_struct_cachep;
@@ -33,111 +45,14 @@ struct domain *dom0;
vm_assist_info_t vm_assist_info[MAX_VMASST_TYPE + 1];
-struct e820entry {
- unsigned long addr_lo, addr_hi; /* start of memory segment */
- unsigned long size_lo, size_hi; /* size of memory segment */
- unsigned long type; /* type of memory segment */
-};
-
void start_of_day(void);
-/* opt_console: comma-separated list of console outputs. */
-unsigned char opt_console[30] = "com1,vga";
-/* opt_conswitch: a character pair controlling console switching. */
-/* Char 1: CTRL+<char1> is used to switch console input between Xen and DOM0 */
-/* Char 2: If this character is 'x', then do not auto-switch to DOM0 when it */
-/* boots. Any other value, or omitting the char, enables auto-switch */
-unsigned char opt_conswitch[5] = "a"; /* NB. '`' would disable switching. */
-/* opt_com[12]: Config serial port with a string <baud>,DPS,<io-base>,<irq>. */
-unsigned char opt_com1[30] = "", opt_com2[30] = "";
-/* opt_dom0_mem: Kilobytes of memory allocated to domain 0. */
-unsigned int opt_dom0_mem = 16000;
-/* opt_noht: If true, Hyperthreading is ignored. */
-int opt_noht=0;
-/* opt_noacpi: If true, ACPI tables are not parsed. */
-int opt_noacpi=0;
-/* opt_nosmp: If true, secondary processors are ignored. */
-int opt_nosmp=0;
-/* opt_noreboot: If true, machine will need manual reset on error. */
-int opt_noreboot=0;
-/* opt_ignorebiostables: If true, ACPI and MP tables are ignored. */
-/* NB. This flag implies 'nosmp' and 'noacpi'. */
-int opt_ignorebiostables=0;
-/* opt_watchdog: If true, run a watchdog NMI on each processor. */
-int opt_watchdog=0;
-/* opt_pdb: Name of serial port for Xen pervasive debugger (and enable pdb) */
-unsigned char opt_pdb[10] = "none";
-/* opt_tbuf_size: trace buffer size (in pages) */
-unsigned int opt_tbuf_size = 10;
-/* opt_sched: scheduler - default to Borrowed Virtual Time */
-char opt_sched[10] = "bvt";
-/* opt_physdev_dom0_hide: list of PCI slots to hide from domain 0. */
-/* Format is '(%02x:%02x.%1x)(%02x:%02x.%1x)' and so on. */
-char opt_physdev_dom0_hide[200] = "";
-/* opt_leveltrigger, opt_edgetrigger: Force an IO-APIC-routed IRQ to be */
-/* level- or edge-triggered. */
-/* Example: 'leveltrigger=4,5,6,20 edgetrigger=21'. */
-char opt_leveltrigger[30] = "", opt_edgetrigger[30] = "";
-/*
- * opt_xenheap_megabytes: Size of Xen heap in megabytes, excluding the
- * pfn_info table and allocation bitmap.
- */
-unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB;
-/*
- * opt_nmi: one of 'ignore', 'dom0', or 'fatal'.
- * fatal: Xen prints diagnostic message and then hangs.
- * dom0: The NMI is virtualised to DOM0.
- * ignore: The NMI error is cleared and ignored.
- */
-#ifdef NDEBUG
-char opt_nmi[10] = "dom0";
-#else
-char opt_nmi[10] = "fatal";
-#endif
-/*
- * Comma-separated list of hexadecimal page numbers containing bad bytes.
- * e.g. 'badpage=0x3f45,0x8a321'.
- */
-char opt_badpage[100] = "";
-
-static struct {
- unsigned char *name;
- enum { OPT_STR, OPT_UINT, OPT_BOOL } type;
- void *var;
- unsigned int len;
-} opts[] = {
-#define V(_x) &_x, sizeof(_x)
- { "console", OPT_STR, V(opt_console) },
- { "conswitch", OPT_STR, V(opt_conswitch) },
- { "com1", OPT_STR, V(opt_com1) },
- { "com2", OPT_STR, V(opt_com2) },
- { "dom0_mem", OPT_UINT, V(opt_dom0_mem) },
- { "noht", OPT_BOOL, V(opt_noht) },
- { "noacpi", OPT_BOOL, V(opt_noacpi) },
- { "nosmp", OPT_BOOL, V(opt_nosmp) },
- { "noreboot", OPT_BOOL, V(opt_noreboot) },
- { "ignorebiostables", OPT_BOOL, V(opt_ignorebiostables) },
- { "watchdog", OPT_BOOL, V(opt_watchdog) },
- { "pdb", OPT_STR, V(opt_pdb) },
- { "tbuf_size", OPT_UINT, V(opt_tbuf_size) },
- { "sched", OPT_STR, V(opt_sched) },
- { "physdev_dom0_hide", OPT_STR, V(opt_physdev_dom0_hide) },
- { "leveltrigger", OPT_STR, V(opt_leveltrigger) },
- { "edgetrigger", OPT_STR, V(opt_edgetrigger) },
- { "xenheap_megabytes", OPT_UINT, V(opt_xenheap_megabytes) },
- { "nmi", OPT_STR, V(opt_nmi) },
- { "badpage", OPT_STR, V(opt_badpage) },
- { NULL, 0, NULL, 0 }
-};
-
-
void cmain(multiboot_info_t *mbi)
{
unsigned long max_page;
unsigned char *cmdline;
module_t *mod = (module_t *)__va(mbi->mods_addr);
void *heap_start;
- int i;
unsigned long max_mem;
unsigned long dom0_memory_start, dom0_memory_end;
unsigned long initial_images_start, initial_images_end;
@@ -147,35 +62,42 @@ void cmain(multiboot_info_t *mbi)
if ( cmdline != NULL )
{
unsigned char *opt_end, *opt;
- while ( *cmdline == ' ' ) cmdline++;
+ struct kernel_param *param;
+ while ( *cmdline == ' ' )
+ cmdline++;
cmdline = strchr(cmdline, ' '); /* skip the image name */
while ( cmdline != NULL )
{
- while ( *cmdline == ' ' ) cmdline++;
- if ( *cmdline == '\0' ) break;
+ while ( *cmdline == ' ' )
+ cmdline++;
+ if ( *cmdline == '\0' )
+ break;
opt_end = strchr(cmdline, ' ');
- if ( opt_end != NULL ) *opt_end++ = '\0';
+ if ( opt_end != NULL )
+ *opt_end++ = '\0';
opt = strchr(cmdline, '=');
- if ( opt != NULL ) *opt++ = '\0';
- for ( i = 0; opts[i].name != NULL; i++ )
+ if ( opt != NULL )
+ *opt++ = '\0';
+ for ( param = &__setup_start; param != &__setup_end; param++ )
{
- if ( strcmp(opts[i].name, cmdline ) != 0 ) continue;
- switch ( opts[i].type )
+ if ( strcmp(param->name, cmdline ) != 0 )
+ continue;
+ switch ( param->type )
{
case OPT_STR:
if ( opt != NULL )
{
- strncpy(opts[i].var, opt, opts[i].len);
- ((char *)opts[i].var)[opts[i].len-1] = '\0';
+ strncpy(param->var, opt, param->len);
+ ((char *)param->var)[param->len-1] = '\0';
}
break;
case OPT_UINT:
if ( opt != NULL )
- *(unsigned int *)opts[i].var =
+ *(unsigned int *)param->var =
simple_strtol(opt, (char **)&opt, 0);
break;
case OPT_BOOL:
- *(int *)opts[i].var = 1;
+ *(int *)param->var = 1;
break;
}
}
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index c8c96dbee3..7e7824219a 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -30,7 +30,12 @@
#include <xen/irq.h>
#include <asm/domain_page.h>
-extern char opt_badpage[];
+/*
+ * Comma-separated list of hexadecimal page numbers containing bad bytes.
+ * e.g. 'badpage=0x3f45,0x8a321'.
+ */
+static char opt_badpage[100] = "";
+string_param("badpage", opt_badpage);
/*********************
* ALLOCATION BITMAP
diff --git a/xen/common/physdev.c b/xen/common/physdev.c
index a2559e5223..c01b7f0805 100644
--- a/xen/common/physdev.c
+++ b/xen/common/physdev.c
@@ -19,6 +19,7 @@
*/
#include <xen/config.h>
+#include <xen/init.h>
#include <xen/lib.h>
#include <xen/types.h>
#include <xen/sched.h>
@@ -697,11 +698,15 @@ long do_physdev_op(physdev_op_t *uop)
return ret;
}
+/* opt_physdev_dom0_hide: list of PCI slots to hide from domain 0. */
+/* Format is '(%02x:%02x.%1x)(%02x:%02x.%1x)' and so on. */
+static char opt_physdev_dom0_hide[200] = "";
+string_param("physdev_dom0_hide", opt_physdev_dom0_hide);
+
/* Test if boot params specify this device should NOT be visible to DOM0
* (e.g. so that another domain can control it instead) */
int pcidev_dom0_hidden(struct pci_dev *dev)
{
- extern char opt_physdev_dom0_hide[];
char cmp[10] = "(.......)";
strncpy(&cmp[1], dev->slot_name, 7);
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 4aceef7d2a..8639e51465 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -28,6 +28,10 @@
#include <xen/trace.h>
#include <public/sched_ctl.h>
+/* opt_sched: scheduler - default to Borrowed Virtual Time */
+static char opt_sched[10] = "bvt";
+string_param("sched", opt_sched);
+
/*#define WAKE_HISTO*/
/*#define BLOCKTIME_HISTO*/
@@ -481,8 +485,6 @@ void __init scheduler_init(void)
schedule_data[0].idle = &idle0_task;
- extern char opt_sched[];
-
for ( i = 0; schedulers[i] != NULL; i++ )
{
ops = *schedulers[i];
diff --git a/xen/common/trace.c b/xen/common/trace.c
index d4954256ce..06547c67d1 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -28,6 +28,10 @@
#include <asm/atomic.h>
#include <public/dom0_ops.h>
+/* opt_tbuf_size: trace buffer size (in pages) */
+static unsigned int opt_tbuf_size = 10;
+integer_param("tbuf_size", opt_tbuf_size);
+
/* Pointers to the meta-data objects for all system trace buffers */
struct t_buf *t_bufs[NR_CPUS];
@@ -43,7 +47,6 @@ int tb_init_done = 0;
*/
void init_trace_bufs(void)
{
- extern int opt_tbuf_size;
int i, order;
unsigned long nr_pages;
char *rawbuf;
@@ -102,10 +105,8 @@ void init_trace_bufs(void)
*/
int get_tb_info(dom0_gettbufs_t *st)
{
- if(tb_init_done)
+ if ( tb_init_done )
{
- extern unsigned int opt_tbuf_size;
-
st->mach_addr = __pa(t_bufs[0]);
st->size = opt_tbuf_size * PAGE_SIZE;
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index cb57740996..bcc2ffc2d7 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -8,6 +8,7 @@
#include <stdarg.h>
#include <xen/config.h>
+#include <xen/init.h>
#include <xen/lib.h>
#include <xen/errno.h>
#include <xen/event.h>
@@ -17,7 +18,16 @@
#include <xen/keyhandler.h>
#include <asm/uaccess.h>
-extern unsigned char opt_console[], opt_conswitch[];
+/* opt_console: comma-separated list of console outputs. */
+static unsigned char opt_console[30] = "com1,vga";
+string_param("console", opt_console);
+
+/* opt_conswitch: a character pair controlling console switching. */
+/* Char 1: CTRL+<char1> is used to switch console input between Xen and DOM0 */
+/* Char 2: If this character is 'x', then do not auto-switch to DOM0 when it */
+/* boots. Any other value, or omitting the char, enables auto-switch */
+static unsigned char opt_conswitch[5] = "a";
+string_param("conswitch", opt_conswitch);
static int xpos, ypos;
static unsigned char *video = __va(0xB8000);
diff --git a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c
index bdd1995f52..43bae0b1a3 100644
--- a/xen/drivers/char/serial.c
+++ b/xen/drivers/char/serial.c
@@ -9,6 +9,7 @@
*/
#include <xen/config.h>
+#include <xen/init.h>
#include <xen/irq.h>
#include <xen/keyhandler.h>
#include <asm/pdb.h>
@@ -17,6 +18,11 @@
#include <xen/serial.h>
#include <asm/io.h>
+/* opt_com[12]: Config serial port with a string <baud>,DPS,<io-base>,<irq>. */
+static unsigned char opt_com1[30] = "", opt_com2[30] = "";
+string_param("com1", opt_com1);
+string_param("com2", opt_com2);
+
/* Register offsets */
#define RBR 0x00 /* receive buffer */
#define THR 0x00 /* transmit holding */
@@ -280,8 +286,6 @@ static void uart_config_stage2(uart_t *uart)
void serial_init_stage1(void)
{
- extern unsigned char opt_com1[], opt_com2[];
-
parse_port_config(opt_com1, &com[0]);
parse_port_config(opt_com2, &com[1]);
diff --git a/xen/include/xen/init.h b/xen/include/xen/init.h
index 7e66567a5b..ebf4f63e30 100644
--- a/xen/include/xen/init.h
+++ b/xen/include/xen/init.h
@@ -38,8 +38,6 @@
* Also note, that this data cannot be "const".
*/
-#ifndef MODULE
-
#ifndef __ASSEMBLY__
/*
@@ -50,99 +48,64 @@ typedef void (*exitcall_t)(void);
extern initcall_t __initcall_start, __initcall_end;
-#define __initcall(fn) \
- static initcall_t __initcall_##fn __init_call = fn
-#define __exitcall(fn) \
- static exitcall_t __exitcall_##fn __exit_call = fn
+#define __initcall(fn) \
+ static initcall_t __initcall_##fn __init_call = fn
+#define __exitcall(fn) \
+ static exitcall_t __exitcall_##fn __exit_call = fn
/*
* Used for kernel command line parameter setup
*/
struct kernel_param {
- const char *str;
- int (*setup_func)(char *);
+ const char *name;
+ enum { OPT_STR, OPT_UINT, OPT_BOOL } type;
+ void *var;
+ unsigned int len;
};
extern struct kernel_param __setup_start, __setup_end;
-#define __setup(str, fn) \
- static char __setup_str_##fn[] __initdata = str; \
- static struct kernel_param __setup_##fn __attribute_used__ __initsetup = { __setup_str_##fn, fn }
-
+#define boolean_param(_name, _var) \
+ static char __setup_str_##_var[] __initdata = _name; \
+ static struct kernel_param __setup_##_var __attribute_used__ \
+ __initsetup = { __setup_str_##_var, OPT_BOOL, &_var, sizeof(_var) }
+#define integer_param(_name, _var) \
+ static char __setup_str_##_var[] __initdata = _name; \
+ static struct kernel_param __setup_##_var __attribute_used__ \
+ __initsetup = { __setup_str_##_var, OPT_UINT, &_var, sizeof(_var) }
+#define string_param(_name, _var) \
+ static char __setup_str_##_var[] __initdata = _name; \
+ static struct kernel_param __setup_##_var __attribute_used__ \
+ __initsetup = { __setup_str_##_var, OPT_STR, &_var, sizeof(_var) }
+
+#define __setup(_name, _fn)
+
#endif /* __ASSEMBLY__ */
/*
* Mark functions and data as being only used at initialization
* or exit time.
*/
-#define __init __attribute__ ((__section__ (".text.init")))
-#define __exit __attribute_used__ __attribute__ ((__section__(".text.exit")))
-#define __initdata __attribute__ ((__section__ (".data.init")))
-#define __exitdata __attribute_used__ __attribute__ ((__section__ (".data.exit")))
-#define __initsetup __attribute_used__ __attribute__ ((__section__ (".setup.init")))
-#define __init_call __attribute_used__ __attribute__ ((__section__ (".initcall.init")))
-#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
+#define __init \
+ __attribute__ ((__section__ (".text.init")))
+#define __exit \
+ __attribute_used__ __attribute__ ((__section__(".text.exit")))
+#define __initdata \
+ __attribute__ ((__section__ (".data.init")))
+#define __exitdata \
+ __attribute_used__ __attribute__ ((__section__ (".data.exit")))
+#define __initsetup \
+ __attribute_used__ __attribute__ ((__section__ (".setup.init")))
+#define __init_call \
+ __attribute_used__ __attribute__ ((__section__ (".initcall.init")))
+#define __exit_call \
+ __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
/* For assembly routines */
#define __INIT .section ".text.init","ax"
#define __FINIT .previous
#define __INITDATA .section ".data.init","aw"
-/**
- * module_init() - driver initialization entry point
- * @x: function to be run at kernel boot time or module insertion
- *
- * module_init() will add the driver initialization routine in
- * the "__initcall.int" code segment if the driver is checked as
- * "y" or static, or else it will wrap the driver initialization
- * routine with init_module() which is used by insmod and
- * modprobe when the driver is used as a module.
- */
-#define module_init(x) __initcall(x);
-
-/**
- * module_exit() - driver exit entry point
- * @x: function to be run when driver is removed
- *
- * module_exit() will wrap the driver clean-up code
- * with cleanup_module() when used with rmmod when
- * the driver is a module. If the driver is statically
- * compiled into the kernel, module_exit() has no effect.
- */
-#define module_exit(x) __exitcall(x);
-
-#else
-
-#define __init
-#define __exit
-#define __initdata
-#define __exitdata
-#define __initcall(fn)
-/* For assembly routines */
-#define __INIT
-#define __FINIT
-#define __INITDATA
-
-/* These macros create a dummy inline: gcc 2.9x does not count alias
- as usage, hence the `unused function' warning when __init functions
- are declared static. We use the dummy __*_module_inline functions
- both to kill the warning and check the type of the init/cleanup
- function. */
-typedef int (*__init_module_func_t)(void);
-typedef void (*__cleanup_module_func_t)(void);
-#define module_init(x) \
- int init_module(void) __attribute__((alias(#x))); \
- static inline __init_module_func_t __init_module_inline(void) \
- { return x; }
-#define module_exit(x) \
- void cleanup_module(void) __attribute__((alias(#x))); \
- static inline __cleanup_module_func_t __cleanup_module_inline(void) \
- { return x; }
-
-#define __setup(str,func) /* nothing */
-
-#endif
-
#ifdef CONFIG_HOTPLUG
#define __devinit
#define __devinitdata
@@ -155,16 +118,4 @@ typedef void (*__cleanup_module_func_t)(void);
#define __devexitdata __exitdata
#endif
-/* Functions marked as __devexit may be discarded at kernel link time, depending
- on config options. Newer versions of binutils detect references from
- retained sections to discarded sections and flag an error. Pointers to
- __devexit functions must use __devexit_p(function_name), the wrapper will
- insert either the function_name or NULL, depending on the config options.
- */
-#if defined(MODULE) || defined(CONFIG_HOTPLUG)
-#define __devexit_p(x) x
-#else
-#define __devexit_p(x) NULL
-#endif
-
#endif /* _LINUX_INIT_H */