Last active
August 29, 2015 13:57
-
-
Save jannson/9633579 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcc -Wp,-MD,arch/x86/mm/.mmap.o.d -nostdinc -isystem /usr/lib/gcc/i686-redhat-linux/4.4.6/include -I/home/gan/project/xenomai_prj/linux-2.6.38.8/arch/x86/include -Iinclude -I/home/gan/project/xenomai_prj/linux-2.6.38.8/include -include include/generated/autoconf.h -I/home/gan/project/xenomai_prj/linux-2.6.38.8/arch/x86/mm -Iarch/x86/mm -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -m32 -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2 -march=i686 -mtune=generic -Wa,-mtune=generic32 -ffreestanding -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Wframe-larger-than=2048 -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -pg -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(mmap)" -D"KBUILD_MODNAME=KBUILD_STR(mmap)" -E /home/gan/project/xenomai_prj/linux-2.6.38.8/arch/x86/mm/mmap.c>mmap.zzz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page_pde_offset = (__PAGE_OFFSET >> 20);//__PAGE_OFFSET=0xC0000000 | |
/*__brk_base is the begin of page table(页表) | |
map from 0~MAPPING_BEYOND_END | |
and 0xC0000000 ~ 0xC0000000+MAPPING_BEYOND_END */ | |
movl $pa(__brk_base), %edi | |
movl $pa(initial_page_table), %edx //initial_page_table is page directory(页目录) | |
movl $PTE_IDENT_ATTR, %eax | |
10: | |
leal PDE_IDENT_ATTR(%edi),%ecx /* Create PDE entry leal指令是获取%edi的地址加PDE_xxx */ | |
movl %ecx,(%edx) /* Store identity PDE entry */ | |
movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */ | |
addl $4,%edx | |
movl $1024, %ecx //每个页表有1024项页 | |
11: | |
/*eax --> es:edi es为前面设置的数据段, edi会自动增加 | |
它是设置页表项,映射从0开始,每次增长0x1000(1024)*/ | |
stosl | |
addl $0x1000,%eax | |
loop 11b | |
/* | |
* End condition: we must map up to the end + MAPPING_BEYOND_END. | |
从下面语句看出MAPPING_BEYOND_END+(_end)是初始化时可以访问的最大地址了 | |
$表示获取数值信息 | |
*/ | |
movl $pa(_end) + MAPPING_BEYOND_END + PTE_IDENT_ATTR, %ebp | |
cmpl %ebp,%eax | |
jb 10b | |
addl $__PAGE_OFFSET, %edi | |
movl %edi, pa(_brk_end) | |
shrl $12, %eax | |
movl %eax, pa(max_pfn_mapped) //max_pfn_mapped记录页表的最大值 | |
/* Do early initialization of the fixmap area */ | |
movl $pa(initial_pg_fixmap)+PDE_IDENT_ATTR,%eax | |
movl %eax,pa(initial_page_table+0xffc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment