函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\gup.c Create Date:2022-07-27 16:00:34
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:get_gate_page

函数原型:static int get_gate_page(struct mm_struct *mm, unsigned long address, unsigned int gup_flags, struct vm_area_struct **vma, struct page **page)

返回类型:int

参数:

类型参数名称
struct mm_struct *mm
unsigned longaddress
unsigned intgup_flags
struct vm_area_struct **vma
struct page **page
569  ret等于负EFAULT
572  如果gup_flags按位与check pte is writable 则返回:负EFAULT
574  如果address大于TASK_SIZEpgd等于a shortcut which implies the use of the kernel's pgd, instead* of a process's(address)
576  否则pgd等于pgd_offset_gate(mm, address)
578  如果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)则返回:负EFAULT
580  p4d等于p4d_offset(pgd, address)
581  如果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)则返回:负EFAULT
583  pud等于pud_offset(p4d, address)
584  如果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)则返回:负EFAULT
586  pmd等于pmd_offset(pud, address)
587  如果非pmd_present( * pmd)则返回:负EFAULT
589  VM_BUG_ON(pmd_trans_huge( * pmd))
590  pte等于pte_offset_map(pmd, address)
591  如果pte_none( * pte)则转到:unmap
593  vma等于get_gate_vma(mm)
594  如果非page则转到:out
596  page等于vm_normal_page( * vma, address, * pte)
597  如果非page
598  如果gup_flags按位与give error on hole if it would be zero 或非is_zero_pfn(pte_pfn( * pte))则转到:unmap
600  page等于pte_page( * pte)
602  如果此条件成立可能性小(为编译器优化)(!try_get_page( * page))则
603  ret等于负ENOMEM
604  转到:unmap
606  out :
607  ret等于0
608  unmap :
609  pte_unmap(pte)
610  返回:ret
调用者
名称描述
__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