Function report | 
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 activity | Download SCCT | Chinese | 
Name:mtrr_ioctl
Proto:static long mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
Type:long
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct file * | file | |
| unsigned int | cmd | |
| unsigned long | __arg | 
| 160 | err = 0 | 
| 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 | 
| 204 | Break | 
| 206 | Case cmd == MTRRIOC32_GET_ENTRY | 
| 207 | Case cmd == MTRRIOC32_GET_PAGE_ENTRY | 
| 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 ) | 
| 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 | 
| 231 | err = mtrr_file_add(Base address , Size of region , Type of region , true, file, 0) | 
| 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 | 
| 249 | err = mtrr_file_del(Base address , Size of region , file, 0) | 
| 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) | 
| 268 | If base + size - 1 >= 1UL << 8 * size of Size of region - PAGE_SHIFT determines the page size || size >= 1UL << 8 * size of Size of region - PAGE_SHIFT determines the page size Then Base address = Size of region = Type of region = 0 | 
| 271 | Else | 
| 274 | Type of region = type | 
| 277 | Break | 
| 278 | Case cmd == MTRRIOC_ADD_PAGE_ENTRY | 
| 280 | Case cmd == MTRRIOC32_ADD_PAGE_ENTRY | 
| 282 | If Not Check operation authority Then Return -EPERM | 
| 284 | err = mtrr_file_add(Base address , Size of region , Type of region , true, file, 1) | 
| 287 | Break | 
| 288 | Case cmd == MTRRIOC_SET_PAGE_ENTRY | 
| 290 | Case cmd == MTRRIOC32_SET_PAGE_ENTRY | 
| 292 | If Not Check operation authority Then Return -EPERM | 
| 296 | Break | 
| 297 | Case cmd == MTRRIOC_DEL_PAGE_ENTRY | 
| 299 | Case cmd == MTRRIOC32_DEL_PAGE_ENTRY | 
| 301 | If Not Check operation authority Then Return -EPERM | 
| 303 | err = mtrr_file_del(Base address , Size of region , file, 1) | 
| 304 | Break | 
| 305 | Case cmd == MTRRIOC_KILL_PAGE_ENTRY | 
| 307 | Case cmd == MTRRIOC32_KILL_PAGE_ENTRY | 
| 309 | If Not Check operation authority Then Return -EPERM | 
| 312 | Break | 
| 313 | Case cmd == MTRRIOC_GET_PAGE_ENTRY | 
| 315 | Case cmd == MTRRIOC32_GET_PAGE_ENTRY | 
| 317 | If Register number >= num_var_ranges Then Return -EINVAL | 
| 319 | get( Register number , & base, & size, & type) | 
| 321 | If size != size Then Base address = Size of region = Type of region = 0 | 
| 323 | Else | 
| 328 | Break | 
| 335 | Case cmd == MTRRIOC_GET_ENTRY | 
| 336 | Case cmd == MTRRIOC_GET_PAGE_ENTRY | 
| 341 | Case cmd == MTRRIOC32_GET_ENTRY | 
| 342 | Case cmd == MTRRIOC32_GET_PAGE_ENTRY | 
| 346 | err = Write a simple value into user space( Base address , & Base address ) | 
| 347 | err |= Write a simple value into user space( Size of region , & Size of region ) | 
| 349 | err |= Write a simple value into user space( Type of region , & Type of region ) | 
| 350 | Break | 
| 354 | Return err | 
| Source code conversion tool public plug-in interface  | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion  |