/* SPDX-License-Identifier: GPL-2.0-only */ /* * arch/arm/include/asm/memory.h * * Copyright (C) 2000-2002 Russell King * modification for nommu, Hyok S. Choi, 2004 * * Note: this file should not be included explicitly, include <asm/page.h> * to get access to these definitions.
*/ #ifndef __ASM_ARM_MEMORY_H #define __ASM_ARM_MEMORY_H
#ifndef _ASMARM_PAGE_H #error"Do not include <asm/memory.h> directly" #endif
/* * PAGE_OFFSET: the virtual address of the start of lowmem, memory above * the virtual address range for userspace. * KERNEL_OFFSET: the virtual address of the start of the kernel image. * we may further offset this with TEXT_OFFSET in practice.
*/ #define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET) #define KERNEL_OFFSET (PAGE_OFFSET)
#ifdef CONFIG_MMU
/* * TASK_SIZE - the maximum size of a user space task. * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area
*/ #ifndef CONFIG_KASAN #define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(SZ_16M)) #else #define TASK_SIZE (KASAN_SHADOW_START) #endif #define TASK_UNMAPPED_BASE ALIGN(TASK_SIZE / 3, SZ_16M)
/* * The maximum size of a 26-bit user space task.
*/ #define TASK_SIZE_26 (UL(1) << 26)
/* * The module space lives between the addresses given by TASK_SIZE * and PAGE_OFFSET - it must be within 32MB of the kernel text.
*/ #ifndef CONFIG_THUMB2_KERNEL #define MODULES_VADDR (PAGE_OFFSET - SZ_16M) #else /* smaller range for Thumb-2 symbols relocation (2^24)*/ #define MODULES_VADDR (PAGE_OFFSET - SZ_8M) #endif
#if TASK_SIZE > MODULES_VADDR #error Top of user space clashes with start of module space #endif
/* * The highmem pkmap virtual space shares the end of the module area.
*/ #ifdef CONFIG_HIGHMEM #define MODULES_END (PAGE_OFFSET - PMD_SIZE) #else #define MODULES_END (PAGE_OFFSET) #endif
/* * The XIP kernel gets mapped at the bottom of the module vm area. * Since we use sections to map it, this macro replaces the physical address * with its virtual address while keeping offset from the base section.
*/ #define XIP_VIRT_ADDR(physaddr) (MODULES_VADDR + ((physaddr) & 0x000fffff))
/* * The limitation of user task size can grow up to the end of free ram region. * It is difficult to define and perhaps will never meet the original meaning * of this define that was meant to. * Fortunately, there is no reference for this in noMMU mode, for now.
*/ #define TASK_SIZE UL(0xffffffff)
/* * We fix the TCM memories max 32 KiB ITCM resp DTCM at these * locations
*/ #ifdef CONFIG_HAVE_TCM #define ITCM_OFFSET UL(0xfffe0000) #define DTCM_OFFSET UL(0xfffe8000) #endif
/* * PLAT_PHYS_OFFSET is the offset (from zero) of the start of physical * memory. This is used for XIP and NoMMU kernels, and on platforms that don't * have CONFIG_ARM_PATCH_PHYS_VIRT. Assembly code must always use * PLAT_PHYS_OFFSET and not PHYS_OFFSET.
*/ #define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET)
#ifndef __ASSEMBLY__
/* * Physical start and end address of the kernel sections. These addresses are * 2MB-aligned to match the section mappings placed over the kernel. We use * u64 so that LPAE mappings beyond the 32bit limit will work out as well.
*/ extern u64 kernel_sec_start; extern u64 kernel_sec_end;
/* * Physical vs virtual RAM address space conversion. These are * private definitions which should NOT be used outside memory.h * files. Use virt_to_phys/phys_to_virt/__pa/__va instead. * * PFNs are used to describe any physical page; this means * PFN 0 == physical address 0.
*/
#ifdefined(CONFIG_ARM_PATCH_PHYS_VIRT)
/* * Constants used to force the right instruction encodings and shifts * so that all we need to do is modify the 8-bit constant field.
*/ #define __PV_BITS_31_24 0x81000000 #define __PV_BITS_23_16 0x810000 #define __PV_BITS_7_0 0x81
/* * 'unsigned long' cast discard upper word when * phys_addr_t is 64 bit, and makes sure that inline * assembler expression receives 32 bit argument * in place where 'r' 32 bit operand is expected.
*/
__pv_stub((unsignedlong) x, t, "sub"); return t;
}
/* * These are *only* valid on the kernel direct mapped RAM memory. * Note: Drivers should NOT use these. They are the wrong * translation for translating DMA addresses. Use the driver * DMA support - see dma-mapping.h.
*/ #define virt_to_phys virt_to_phys staticinline phys_addr_t virt_to_phys(constvolatilevoid *x)
{ return __virt_to_phys((unsignedlong)(x));
}
/* * Drivers should NOT use these either.
*/ #define __pa(x) __virt_to_phys((unsignedlong)(x)) #define __pa_symbol(x) __phys_addr_symbol(RELOC_HIDE((unsignedlong)(x), 0)) #define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x))) #define pfn_to_kaddr(pfn) __va((phys_addr_t)(pfn) << PAGE_SHIFT)
externlonglong arch_phys_to_idmap_offset;
/* * These are for systems that have a hardware interconnect supported alias * of physical memory for idmap purposes. Most cases should leave these * untouched. Note: this can only return addresses less than 4GiB.
*/ staticinlinebool arm_has_idmap_alias(void)
{ return IS_ENABLED(CONFIG_MMU) && arch_phys_to_idmap_offset != 0;
}
/* * Conversion between a struct page and a physical address. * * page_to_pfn(page) convert a struct page * to a PFN number * pfn_to_page(pfn) convert a _valid_ PFN number to struct page * * * virt_to_page(k) convert a _valid_ virtual address to struct page * * virt_addr_valid(k) indicates whether a virtual address is valid
*/ #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.