查看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。