linux模塊加載

EXPORT_SYMBOL(schedule);


#if defined(MODVERSIONS) || !defined(CONFIG_MODVERSIONS)

#define EXPORT_SYMBOL(var)  __EXPORT_SYMBOL(var, __MODULE_STRING(var))


#define __MODULE_STRING_1(x) #x

#define __MODULE_STRING(x) __MODULE_STRING_1(x)

變成:

__EXPORT_SYMBOL(schedule, “schedule”);

#define __EXPORT_SYMBOL(sym, str) \
const char __kstrtab_##sym[] \
__attribute__((section(".kstrtab"))) = str; \
const struct module_symbol __ksymtab_##sym \
__attribute__((section("__ksymtab"))) = \

{ (unsigned long)&sym, __kstrtab_##sym }


const char __kstrtab_schedule[]  __attribute__((section(".kstrtab"))) = “schedule”;

const struct module_symbol __ksymtab_schedule   __attribute__((section("__ksymtab"))) 

={ (unsigned long)&schedule, __kstrtab_schedule }


{
  . = 0xC0000000 + 0x100000;
  _text = .; /* Text and read-only data */
  .text : {
*(.text)
*(.fixup)
*(.gnu.warning)
} = 0x9090
  .text.lock : { *(.text.lock) } /* out-of-line lock text */


  _etext = .; /* End of text section */


  .rodata : { *(.rodata) *(.rodata.*) }
  .kstrtab : { *(.kstrtab) }


  . = ALIGN(16); /* Exception table */
  __start___ex_table = .;
  __ex_table : { *(__ex_table) }
  __stop___ex_table = .;


  __start___ksymtab = .; /* Kernel symbol table */
  __ksymtab : { *(__ksymtab) }
  __stop___ksymtab = .;


  .data : { /* Data */
*(.data)
CONSTRUCTORS
}


  _edata = .; /* End of data section */


  . = ALIGN(8192); /* init_task */
  .data.init_task : { *(.data.init_task) }


  . = ALIGN(4096); /* Init code and data */
  __init_begin = .;
  .text.init : { *(.text.init) }
  .data.init : { *(.data.init) }
  . = ALIGN(16);
  __setup_start = .;
  .setup.init : { *(.setup.init) }
  __setup_end = .;
  __initcall_start = .;
  .initcall.init : { *(.initcall.init) }
  __initcall_end = .;
  . = ALIGN(4096);
  __init_end = .;


  . = ALIGN(4096);
  .data.page_aligned : { *(.data.idt) }


  . = ALIGN(32);
  .data.cacheline_aligned : { *(.data.cacheline_aligned) }


  __bss_start = .; /* BSS */
  .bss : {
*(.bss)
}
  _end = . ;

}



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章