设为首页 加入收藏

TOP

关于6410开发板Linux内存地址0Xc0008000的由来
2014-11-24 07:51:30 来源: 作者: 【 】 浏览:0
Tags:关于 6410 开发 Linux 内存 地址 0Xc0008000 由来

查看6410数据手册可以看到,内存开始地址应该是0x50000000,而实际在real6410开发板使用过程中U-boot加载Linux内核都是加载到0xC0008000处开始运行,我猜测(还没有看代码来验证猜测)这个是因为Linux启动内核的地址为0xC0008000,而U-boot为了和Linux保持一致,故对内存也做了映射,方便用户使用。下面先以内核2.6.28为例来先来看一下Linux中这个内存地址的由来。


首先看启动代码代码arch/arm/kernel/head.S


29 #define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET)//定义虚拟内存首地址
30 #define KERNEL_RAM_PADDR (PHYS_OFFSET + TEXT_OFFSET)//定义实际物理内存地址


PAGE_OFFSET的出处


代码arch/arm/include/asm/memory.c


27 #ifdef CONFIG_MMU
28
29 /*
30 * PAGE_OFFSET - the virtual address of the start of the kernel image
31 * TASK_SIZE - the maximum size of a user space task.
32 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area
33 */
34 #define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET)


代码include/linux/autoconf.h


#define CONFIG_PAGE_OFFSET 0xc0000000


PHYS_OFFSET 的出处


代码 arch/arm/mach-s3c6400/include/mach/memory.h //与6400平台相关的内存设置


#define PHYS_OFFSET UL(0x50000000)


TEXT_OFFSET的定义在arch/arm/Makefile中,这个值是内核所在位置的实际偏移量,具体对这个值的说明看文件arch/arm/kernel/head.S。



38 /*
39 * swapper_pg_dir is the virtual address of the initial page table.
40 * We place the page tables 16K below KERNEL_RAM_ADDR. Therefore, we must
41 * make sure that KERNEL_RAM_ADDR is correctly set. Currently, we expect
42 * the least significant 16 bits to be 0x8000, but we could probably
43 * relax this restriction to KERNEL_RAM_ADDR >= PAGE_OFFSET + 0x4000.
44 */


也就是说,从地址KERNEL_RAM_VADDR 开始的至少0x4000用来存放内核页表,而存放内核页表的空间值建议是0x8000。


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇对Linux内核宏container_of的理解 下一篇Linux和Unix中 awk 的print浅谈

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·在 Redis 中如何查看 (2025-12-26 03:19:03)
·Redis在实际应用中, (2025-12-26 03:19:01)
·Redis配置中`require (2025-12-26 03:18:58)
·Asus Armoury Crate (2025-12-26 02:52:33)
·WindowsFX (LinuxFX) (2025-12-26 02:52:30)