Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:get_gate_page

Proto:static int get_gate_page(struct mm_struct *mm, unsigned long address, unsigned int gup_flags, struct vm_area_struct **vma, struct page **page)

Type:int

Parameter:

TypeParameterName
struct mm_struct *mm
unsigned longaddress
unsigned intgup_flags
struct vm_area_struct **vma
struct page **page
569  ret = -EFAULT
572  If gup_flags & check pte is writable Then Return -EFAULT
574  If address > TASK_SIZE Then pgd = a shortcut which implies the use of the kernel's pgd, instead* of a process's(address)
576  Else pgd = pgd_offset_gate(mm, address)
578  If The "pgd_xxx()" functions here are trivial for a folded two-level* setup: the p4d is never bad, and a p4d always exists (as it's folded* into the pgd entry) Then Return -EFAULT
580  p4d = p4d_offset(pgd, address)
581  If The "p4d_xxx()" functions here are trivial for a folded two-level* setup: the pud is never bad, and a pud always exists (as it's folded* into the p4d entry) Then Return -EFAULT
583  pud = pud_offset(p4d, address)
584  If The "pud_xxx()" functions here are trivial for a folded two-level* setup: the pmd is never bad, and a pmd always exists (as it's folded* into the pud entry) Then Return -EFAULT
586  pmd = pmd_offset(pud, address)
587  If Not pmd_present( * pmd) Then Return -EFAULT
589  VM_BUG_ON(pmd_trans_huge( * pmd))
590  pte = pte_offset_map(pmd, address)
591  If pte_none( * pte) Then Go to unmap
593  vma = get_gate_vma(mm)
594  If Not page Then Go to out
596  page = vm_normal_page( * vma, address, * pte)
597  If Not page Then
598  If gup_flags & give error on hole if it would be zero || Not is_zero_pfn(pte_pfn( * pte)) Then Go to unmap
600  page = pte_page( * pte)
602  If Value for the false possibility is greater at compile time(!try_get_page( * page)) Then
603  ret = -ENOMEM
604  Go to unmap
606  out :
607  ret = 0
608  unmap :
609  pte_unmap(pte)
610  Return ret
Caller
NameDescribe
__get_user_pages__get_user_pages() - pin user pages in memory*@tsk: task_struct of target task*@mm: mm_struct of target mm*@start: starting user address*@nr_pages: number of pages from start to pin*@gup_flags: flags modifying pin behaviour