Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\memory.c Create Date:2022-07-28 14:41:27
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:map_pfn_range - remap kernel memory to userspace*@vma: user vma to map to*@addr: target user address to start at*@pfn: physical address of kernel memory*@size: size of map area*@prot: page protection flags for this mapping

Proto:int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn, unsigned long size, pgprot_t prot)

Type:int

Parameter:

TypeParameterName
struct vm_area_struct *vma
unsigned longaddr
unsigned longpfn
unsigned longsize
pgprot_tprot
1919  end = addr + align the pointer to the (next) page boundary (size)
1920  mm = The address space we belong to.
1921  remap_pfn = pfn
1942  If is_cow_mapping(Flags, see mm.h. ) Then
1943  If addr != Our start address within vm_mm. || end != The first byte after our end addresswithin vm_mm. Then Return -EINVAL
1945  Offset (within vm_file) in PAGE_SIZEunits = pfn
1948  err = track_pfn_remap(vma, & prot, remap_pfn, addr, align the pointer to the (next) page boundary (size))
1949  If err Then Return -EINVAL
1952  Flags, see mm.h. |= Memory mapped I/O or similar | Page-ranges managed without "struct page", just pure PFN | Cannot expand with mremap() | Do not include in the core dump
1954  BUG_ON(addr >= end)
1955  pfn -= addr >> PAGE_SHIFT determines the page size
1956  pgd = a shortcut to get a pgd_t in a given mm(mm, addr)
1957  flush_cache_range(vma, addr, end)
1958  Do
1959  next = When walking page tables, get the address of the next boundary,* or the end address of the range if that comes earlier. Although no* vma end wraps to 0, rounded up __boundary may wrap to 0 throughout.(addr, end)
1960  err = remap_p4d_range(mm, pgd, addr, next, pfn + (addr >> PAGE_SHIFT determines the page size ), prot)
1962  If err Then Break
1964  When pgd++, addr = next , addr != end cycle
1966  If err Then untrack_pfn(vma, remap_pfn, align the pointer to the (next) page boundary (size))
1969  Return err
Caller
NameDescribe
dma_direct_mmap
__dma_mmap_from_coherent