18c2ecf20Sopenharmony_ci=================================
28c2ecf20Sopenharmony_ciKernel Memory Layout on ARM Linux
38c2ecf20Sopenharmony_ci=================================
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci		Russell King <rmk@arm.linux.org.uk>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci		     November 17, 2005 (2.6.15)
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciThis document describes the virtual memory layout which the Linux
108c2ecf20Sopenharmony_cikernel uses for ARM processors.  It indicates which regions are
118c2ecf20Sopenharmony_cifree for platforms to use, and which are used by generic code.
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciThe ARM CPU is capable of addressing a maximum of 4GB virtual memory
148c2ecf20Sopenharmony_cispace, and this must be shared between user space processes, the
158c2ecf20Sopenharmony_cikernel, and hardware devices.
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciAs the ARM architecture matures, it becomes necessary to reserve
188c2ecf20Sopenharmony_cicertain regions of VM space for use for new facilities; therefore
198c2ecf20Sopenharmony_cithis document may reserve more VM space over time.
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci=============== =============== ===============================================
228c2ecf20Sopenharmony_ciStart		End		Use
238c2ecf20Sopenharmony_ci=============== =============== ===============================================
248c2ecf20Sopenharmony_ciffff8000	ffffffff	copy_user_page / clear_user_page use.
258c2ecf20Sopenharmony_ci				For SA11xx and Xscale, this is used to
268c2ecf20Sopenharmony_ci				setup a minicache mapping.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciffff4000	ffffffff	cache aliasing on ARMv6 and later CPUs.
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciffff1000	ffff7fff	Reserved.
318c2ecf20Sopenharmony_ci				Platforms must not use this address range.
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciffff0000	ffff0fff	CPU vector page.
348c2ecf20Sopenharmony_ci				The CPU vectors are mapped here if the
358c2ecf20Sopenharmony_ci				CPU supports vector relocation (control
368c2ecf20Sopenharmony_ci				register V bit.)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cifffe0000	fffeffff	XScale cache flush area.  This is used
398c2ecf20Sopenharmony_ci				in proc-xscale.S to flush the whole data
408c2ecf20Sopenharmony_ci				cache. (XScale does not have TCM.)
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cifffe8000	fffeffff	DTCM mapping area for platforms with
438c2ecf20Sopenharmony_ci				DTCM mounted inside the CPU.
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cifffe0000	fffe7fff	ITCM mapping area for platforms with
468c2ecf20Sopenharmony_ci				ITCM mounted inside the CPU.
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ciffc80000	ffefffff	Fixmap mapping region.  Addresses provided
498c2ecf20Sopenharmony_ci				by fix_to_virt() will be located here.
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciffc00000	ffc7ffff	Guard region
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciff800000	ffbfffff	Permanent, fixed read-only mapping of the
548c2ecf20Sopenharmony_ci				firmware provided DT blob
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cifee00000	feffffff	Mapping of PCI I/O space. This is a static
578c2ecf20Sopenharmony_ci				mapping within the vmalloc space.
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciVMALLOC_START	VMALLOC_END-1	vmalloc() / ioremap() space.
608c2ecf20Sopenharmony_ci				Memory returned by vmalloc/ioremap will
618c2ecf20Sopenharmony_ci				be dynamically placed in this region.
628c2ecf20Sopenharmony_ci				Machine specific static mappings are also
638c2ecf20Sopenharmony_ci				located here through iotable_init().
648c2ecf20Sopenharmony_ci				VMALLOC_START is based upon the value
658c2ecf20Sopenharmony_ci				of the high_memory variable, and VMALLOC_END
668c2ecf20Sopenharmony_ci				is equal to 0xff800000.
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ciPAGE_OFFSET	high_memory-1	Kernel direct-mapped RAM region.
698c2ecf20Sopenharmony_ci				This maps the platforms RAM, and typically
708c2ecf20Sopenharmony_ci				maps all platform RAM in a 1:1 relationship.
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ciPKMAP_BASE	PAGE_OFFSET-1	Permanent kernel mappings
738c2ecf20Sopenharmony_ci				One way of mapping HIGHMEM pages into kernel
748c2ecf20Sopenharmony_ci				space.
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ciMODULES_VADDR	MODULES_END-1	Kernel module space
778c2ecf20Sopenharmony_ci				Kernel modules inserted via insmod are
788c2ecf20Sopenharmony_ci				placed here using dynamic mappings.
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ciTASK_SIZE	MODULES_VADDR-1	KASAn shadow memory when KASan is in use.
818c2ecf20Sopenharmony_ci				The range from MODULES_VADDR to the top
828c2ecf20Sopenharmony_ci				of the memory is shadowed here with 1 bit
838c2ecf20Sopenharmony_ci				per byte of memory.
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci00001000	TASK_SIZE-1	User space mappings
868c2ecf20Sopenharmony_ci				Per-thread mappings are placed here via
878c2ecf20Sopenharmony_ci				the mmap() system call.
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci00000000	00000fff	CPU vector page / null pointer trap
908c2ecf20Sopenharmony_ci				CPUs which do not support vector remapping
918c2ecf20Sopenharmony_ci				place their vector page here.  NULL pointer
928c2ecf20Sopenharmony_ci				dereferences by both the kernel and user
938c2ecf20Sopenharmony_ci				space are also caught via this mapping.
948c2ecf20Sopenharmony_ci=============== =============== ===============================================
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ciPlease note that mappings which collide with the above areas may result
978c2ecf20Sopenharmony_ciin a non-bootable kernel, or may cause the kernel to (eventually) panic
988c2ecf20Sopenharmony_ciat run time.
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ciSince future CPUs may impact the kernel mapping layout, user programs
1018c2ecf20Sopenharmony_cimust not access any memory which is not mapped inside their 0x0001000
1028c2ecf20Sopenharmony_cito TASK_SIZE address range.  If they wish to access these areas, they
1038c2ecf20Sopenharmony_cimust set up their own mappings using open() and mmap().
104