Chinaunix首页 | 论坛 | 博客
  • 博客访问: 258875
  • 博文数量: 29
  • 博客积分: 1680
  • 博客等级: 上尉
  • 技术积分: 533
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-17 14:38
文章分类

全部博文(29)

文章存档

2014年(2)

2012年(3)

2011年(9)

2008年(15)

我的朋友

分类: LINUX

2011-12-04 12:50:45

swapper_pg_dir在arch/arm/kernel/head.S文件中定义。具体代码如下:
 
 
arch/arm/kernel/head.S文件中定义。
     
    arch/arm/kernel/head.S
      25 #if (PHYS_OFFSET & 0x001fffff)
  1.  26 #error "PHYS_OFFSET must be at an even 2MiB boundary!"
  2.  27 #endif
  3.  28
  4.  29 #define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET)//PAGE_OFFSET 虚拟地址的起始地址(通常为0xC0000000)。
  5.  30 #define KERNEL_RAM_PADDR (PHYS_OFFSET + TEXT_OFFSET)//PHYS_OFFSET 物理地址(DDR)的起始地址
  6.  31
  7.  32
  8.  33 /*
  9.  34 * swapper_pg_dir is the virtual address of the initial page table.
  10.  35 * We place the page tables 16K below KERNEL_RAM_VADDR. Therefore, we must
  11.  36 * make sure that KERNEL_RAM_VADDR is correctly set. Currently, we expect
  12.  37 * the least significant 16 bits to be 0x8000, but we could probably
  13.  38 * relax this restriction to KERNEL_RAM_VADDR >= PAGE_OFFSET + 0x4000.
  14.  39 */
  15.  40 #if (KERNEL_RAM_VADDR & 0xffff) != 0x8000
  16.  41 #error KERNEL_RAM_VADDR must start at 0xXXXX8000
  17.  42 #endif
  18.  43
  19.  44 .globl swapper_pg_dir
  20.  45 .equ swapper_pg_dir, KERNEL_RAM_VADDR - 0x4000
  21.  46
  22.  47 .macro pgtbl, rd
  23.  48 ldr \rd, =(KERNEL_RAM_PADDR - 0x4000)
  24.  49 .endm

TEXT_OFFSET在arch/arm/Makefile文件中定义:

 111 textofs-y       := 0x00008000
 112 textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000
 113 # We don't want the htc bootloader to corrupt kernel during resume
 114 textofs-$(CONFIG_PM_H1940)      := 0x00108000
 115 # SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory
 116 ifeq ($(CONFIG_ARCH_SA1100),y)
 117 textofs-$(CONFIG_SA1111) := 0x00208000
 118 endif

  1. 212 # The byte offset of the kernel image in RAM from the start of RAM.
  2. 213 TEXT_OFFSET := $(textofs-y)

 

 

 

阅读(5792) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~