Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\cpu\mtrr\if.c Create Date:2022-07-28 08:05:42
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:mtrr_ioctl

Proto:static long mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)

Type:long

Parameter:

TypeParameterName
struct file *file
unsigned intcmd
unsigned long__arg
160  err = 0
166  __user * arg = __arg
168  memset( & gentry, 0, size of gentry )
171  Case cmd == These are the various ioctls
172  Case cmd == MTRRIOC_SET_ENTRY
173  Case cmd == MTRRIOC_DEL_ENTRY
174  Case cmd == MTRRIOC_KILL_ENTRY
175  Case cmd == MTRRIOC_ADD_PAGE_ENTRY
176  Case cmd == MTRRIOC_SET_PAGE_ENTRY
177  Case cmd == MTRRIOC_DEL_PAGE_ENTRY
178  Case cmd == MTRRIOC_KILL_PAGE_ENTRY
179  If copy_from_user( & sentry, arg, size of sentry ) Then Return -EFAULT
181  Break
182  Case cmd == MTRRIOC_GET_ENTRY
183  Case cmd == MTRRIOC_GET_PAGE_ENTRY
184  If copy_from_user( & gentry, arg, size of gentry ) Then Return -EFAULT
186  Break
188  Case cmd == MTRRIOC32_ADD_ENTRY
189  Case cmd == MTRRIOC32_SET_ENTRY
190  Case cmd == MTRRIOC32_DEL_ENTRY
191  Case cmd == MTRRIOC32_KILL_ENTRY
192  Case cmd == MTRRIOC32_ADD_PAGE_ENTRY
193  Case cmd == MTRRIOC32_SET_PAGE_ENTRY
194  Case cmd == MTRRIOC32_DEL_PAGE_ENTRY
195  Case cmd == MTRRIOC32_KILL_PAGE_ENTRY
196  __user * s32
198  s32 = __arg
199  err = Get a simple variable from user space(Base address , & Base address )
200  err |= Get a simple variable from user space(Size of region , & Size of region )
201  err |= Get a simple variable from user space(Type of region , & Type of region )
202  If err Then Return err
204  Break
206  Case cmd == MTRRIOC32_GET_ENTRY
207  Case cmd == MTRRIOC32_GET_PAGE_ENTRY
208  __user * g32
210  g32 = __arg
211  err = Get a simple variable from user space( Register number , & Register number )
212  err |= Get a simple variable from user space( Base address , & Base address )
213  err |= Get a simple variable from user space( Size of region , & Size of region )
214  err |= Get a simple variable from user space( Type of region , & Type of region )
215  If err Then Return err
217  Break
223  Default
224  Return -ENOTTY
225  Case cmd == These are the various ioctls
227  Case cmd == MTRRIOC32_ADD_ENTRY
229  If Not Check operation authority Then Return -EPERM
234  Break
235  Case cmd == MTRRIOC_SET_ENTRY
237  Case cmd == MTRRIOC32_SET_ENTRY
239  If Not Check operation authority Then Return -EPERM
242  Break
243  Case cmd == MTRRIOC_DEL_ENTRY
245  Case cmd == MTRRIOC32_DEL_ENTRY
247  If Not Check operation authority Then Return -EPERM
250  Break
251  Case cmd == MTRRIOC_KILL_ENTRY
253  Case cmd == MTRRIOC32_KILL_ENTRY
255  If Not Check operation authority Then Return -EPERM
258  Break
259  Case cmd == MTRRIOC_GET_ENTRY
261  Case cmd == MTRRIOC32_GET_ENTRY
263  If Register number >= num_var_ranges Then Return -EINVAL
265  get( Register number , & base, & size, & type)
271  Else
277  Break
278  Case cmd == MTRRIOC_ADD_PAGE_ENTRY
282  If Not Check operation authority Then Return -EPERM
287  Break
288  Case cmd == MTRRIOC_SET_PAGE_ENTRY
292  If Not Check operation authority Then Return -EPERM
296  Break
297  Case cmd == MTRRIOC_DEL_PAGE_ENTRY
301  If Not Check operation authority Then Return -EPERM
304  Break
305  Case cmd == MTRRIOC_KILL_PAGE_ENTRY
309  If Not Check operation authority Then Return -EPERM
312  Break
313  Case cmd == MTRRIOC_GET_PAGE_ENTRY
317  If Register number >= num_var_ranges Then Return -EINVAL
319  get( Register number , & base, & size, & type)
323  Else
328  Break
331  If err Then Return err
335  Case cmd == MTRRIOC_GET_ENTRY
336  Case cmd == MTRRIOC_GET_PAGE_ENTRY
337  If copy_to_user(arg, & gentry, size of gentry ) Then err = -EFAULT
339  Break
341  Case cmd == MTRRIOC32_GET_ENTRY
343  __user * g32
345  g32 = __arg
350  Break
354  Return err