kernel的各个地址

linux-2.6.27.28/arch/mips/Makefile

 

load-$(CONFIG_SOC_ACTIONS)       += 0xffffffff80000000

 

ifdef CONFIG_32BIT

ifdef CONFIG_CPU_LITTLE_ENDIAN

JIFFIES                = jiffies_64

else

JIFFIES                = jiffies_64 + 4

endif

else

JIFFIES                = jiffies_64

endif

 

CPPFLAGS_vmlinux.lds := /

       $(KBUILD_CFLAGS) /

       -D"LOADADDR=$(load-y)" /

       -D"JIFFIES=$(JIFFIES)" /

       -D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)"

定义了LOADADDRJIFFIES

 

linux-2.6.27.28/arch/mips/kernel/vmlinux.lds.S中:

(注意:这里的地址都是虚拟地址而不是物理地址)

段的最前面是

       . = LOADADDR;

这就是内核代码的起始地址。

这些地址(尤其是红色标志的地址)需要注意:

       _text = .; /* Text and read-only data */

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

              __start___ex_table = .;

              __stop___ex_table = .;

              __start___dbe_table = .;

              __stop___dbe_table = .;

       __nosave_begin = .;

       __nosave_end = .;

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

       __init_begin = .;

              _sinittext = .;

              _einittext = .;

              __setup_start = .;

              __setup_end = .;

              __initcall_start = .;

              __initcall_end = .;

              __con_initcall_start = .;

              __con_initcall_end = .;

              __initramfs_start = .;

              __initramfs_end = .;

       __init_end = .;

       __bss_start = .;      /* BSS */

       __bss_stop = .;

编译完内核之后,可在相应的system.map文件里找到这些地址的值,例如:

80218000 A __init_begin

80f01000 A __init_end

init段的长度为:

0xCE9000 = 13537280 = 12.91015625MB

What happens during boot is that the "init" kernel thread (function init/main.c:init()) calls the arch-specific function free_initmem() which frees all the pages between addresses __init_begin and __init_end.

你可能感兴趣的:(thread,function,table)