memory.txt

Kernel Memory Layout on ARM Linux

Russell King <rmk@arm.linux.org.uk>
November 17, 2005 (2.6.15)
This document describes the virtual memory layout which the Linux kernel uses for ARM processors.
It indicates which regions are free for platforms to use, and which are used by generic code.
このドキュメントでは、LinuxカーネルがARMプロセッサ用に使用する仮想メモリのレイアウトを記述します。
これは、プラットフォームが使用するためのフリーな領域がどこにあるか、そして、汎用コードによって使用されるのはどこか、を示します。
The ARM CPU is capable of addressing a maximum of 4GB virtual memory space,
and this must be shared between user space processes, the kernel, and hardware devices.
ARM CPUは、最大4GBの仮想メモリ空間アドレッシングを許容します。
この空間は、ユーザ空間プロセス、カーネル、ハードウェアデバイスの間で共有する必要があります。
As the ARM architecture matures, it becomes necessary to reserve certain regions of VM space for use for new facilities;
therefore this document may reserve more VM space over time.
ARMアーキテクチャは静寂するにつれて、新しい設備(機能)を使うために、仮想空間の特定の領域を予約する必要が出てきます。
したがって、このドキュメントは、時間の経過と共に、より多くの仮想空間を仮想空間を予約するでしょう。
Start End Use
ffff8000ffffffffcopy_user_page / clear_user_page で使う。
SA11xx と Xscale では、minicache mappingの設定に使う。
ffff4000ffffffffARMv6アーキ以降の cache aliasing
ffff1000ffff7fffReserved. Platformsはこの領域を使ってはいけない
ffff0000ffff0fffCPU vector page. CPUがヴェクタリロケーションをサポートしていれば、ここにマップされる(Control RegisterのV bitで設定)
fffe0000fffeffffXScale cache flush area. This is used in proc-xscale.S to flush the whole data cache. (XScale does not have TCM.)
fffe8000fffeffffDTCM mapping area. for platforms with DTCM mounted inside the CPU.
fffe0000fffe7fffITCM mapping area for platforms with ITCM mounted inside the CPU.
fff00000fffdffffFixmap mapping region. fix_to_virt()で与えられるアドレスは、ここに配置される。
ffc00000ffefffffDMA memory mapping region. the dma_alloc_xxx()で返ってくるメモリが、ここに動的にマップされる。
ff000000ffbfffffReserved for future expansion of DMA mapping region.
fee00000feffffffMapping of PCI I/O space. これは、vmalloc空間の静的マッピングです。
VMALLOC_STARTVMALLOC_END-1vmalloc() / ioremap() 空間。 vmalloc(),ioremap()によって返されるメモリは、この領域に動的に配置される。 マシン固有の静的マッピングも、iotable_init()によって、ここに配置される。
VMALLOC_STARTは、high_memory変数の値に基づいて得られる。VMALLOC_ENDは0xff000000である(ヘッダで定義)。
PAGE_OFFSEThigh_memory-1Kernel direct-mapped RAM region. これは、プラットフォームのRAM、通常は、1:1の関係にあるすべてのプラットフォームのRAMを配置します。
CONFIG_PAGE_OFFSETで設定する。一般的な32bit kernelでは 0xC0000000(kernel:user=1GB:3GB設定)となっている。
PKMAP_BASEPAGE_OFFSET-1永続的なkernelマッピング。 カーネル空間にHIGHMEMページを配置する方法の一つ。
MODULES_VADDRMODULES_END-1Kernel module space.
insmodにより挿入されるKernel modulesは、ここに動的に配置されます。
00001000TASK_SIZE-1User space mappings.
スレッド毎のマッピングは、mmap()システムコールにより、ここに配置される。
0000000000000fffCPU vector page / null pointer trap.
ヴェクタremapをサポートしていないCPUは、ヴェクタページをここに配置します。 kernel空間・user空間の双方から、NULLポインタデリファレンスもまた、この配置から捕まえられます。

Please note that mappings which collide with the above areas may result in a non-bootable kernel,
or may cause the kernel to (eventually) panic at run time.
上記領域と衝突するマッピングは、非ブートカーネルになったり、実行時に(最終的に)kernel panic要因となるかもしれないことに、ご注意ください。
Since future CPUs may impact the kernel mapping layout,
user programs must not access any memory which is not mapped inside their 0x0001000 to TASK_SIZE address range.
If they wish to access these areas,
they must set up their own mappings using open() and mmap().
将来のCPUでは、kernelマッピングレイアウトに影響があるかもしれないので、ユーザプログラムは、0x0001000からTASK_SIZEまでのアドレス範囲から外れたメモリをアクセスしてはならない。
もしそれらの領域をアクセスしたければ、open()やmmap()を使って、固有のマッピングをセットアップしなければならない。


関連ファイル

FILE: arch/arm/include/asm/fixmap.h

めも

更新されていないのか、vendorの仕様か、ちょっと配置が違う気がする。
変数を書き換えれば、上の方(vmalloc前後)は任意に動くから、いじってるかもなぁ。