函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\fpu\signal.c Create Date:2022-07-27 08:50:15
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__fpu__restore_sig

函数原型:static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)

返回类型:int

参数:

类型参数名称
void __user *buf
void __user *buf_fx
intsize
274  struct user_i387_ia32_struct * envp = NULL
275  state_size等于Size of the FPU context state. All tasks in the system use the* same context size, regardless of what portion they use.* This is inherent to the XSAVE architecture which puts all state* components into a single, continuous memory block:
276  ia32_fxstate等于buf不等于buf_fx
277  tsk等于当前进程
278  fpu等于 Floating point and extended processor state
280  xfeatures等于0
281  fx_only等于0
282  ret等于0
284  ia32_fxstate与等于IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_X86_32)或IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_IA32_EMULATION)
287  如果非buf
288  Clear the FPU state back to init state.* Called by sys_execve(), by the signal handler code and by various* error paths.
289  返回:0
292  如果非access_ok - Checks if a user space pointer is valid*@addr: User space pointer to start of block to check*@size: Size of block to check* Context: User context only. This function may sleep if pagefaults are* enabled.(buf, size)则返回:负EACCES
295  如果非static_cpu_has(Onboard FPU )则返回:fpregs_soft_set(当前进程, NULL, 0, sizeof(structuser_i387_ia32_struct), NULL, buf)不等于0
300  如果use_xsave()则
308  state_size等于sizeof(structfxregs_state)
309  fx_only等于1
311  否则
324  set_thread_flag(load FPU on return to userspace )
325  __fpu_invalidate_fpregs_state(fpu)
327  如果buf_fx取模64则fx_only等于1
333  如果ia32_fxstate
334  ret等于__copy_from_user( & env, buf, env的长度)
335  如果ret则转到:err_out
337  envp等于env
338  否则
346  Use fpregs_lock() while editing CPU's FPU registers or fpu->state.* A context switch will (and softirq might) save CPU's FPU registers to* fpu->state and set TIF_NEED_FPU_LOAD leaving CPU's FPU registers in* a random state.
347  These routines enable/disable the pagefault handler. If disabled, it will* not take any locks and go straight to the fixup table.* User access methods will not sleep when called from a pagefault_disabled()* environment.
348  ret等于Restore the extended state if present. Otherwise, restore the FP/SSE state.
349  pagefault_enable()
350  如果非ret
352  fpregs_unlock()
353  返回:0
355  These generally need preemption protection to work,* do try to avoid using these on their own:
356  fpregs_unlock()
360  如果use_xsave()且非fx_only
361  init_bv等于xfeatures_mask按位与xfeatures的反
363  如果using_compacted_format()则
365  否则
371  如果ret则转到:err_out
374  sanitize_restored_xstate( & @state:* In-memory copy of all FPU registers that we save/restore* over context switches. If the task is using the FPU then* the registers in the FPU are more recent than this state* copy. If the task context-switches away then they get, envp, xfeatures, fx_only)
376  Use fpregs_lock() while editing CPU's FPU registers or fpu->state.* A context switch will (and softirq might) save CPU's FPU registers to* fpu->state and set TIF_NEED_FPU_LOAD leaving CPU's FPU registers in* a random state.
377  如果此条件成立可能性小(为编译器优化)(init_bv)则Restore processor xstate from xsave area.
379  ret等于Restore xstate from kernel space xsave area, return an error code instead of* an exception.
381  否则如果use_fxsr()则
382  ret等于__copy_from_user( & fxsave, buf_fx, state_size)
383  如果ret
384  ret等于负EFAULT
385  转到:err_out
388  sanitize_restored_xstate( & @state:* In-memory copy of all FPU registers that we save/restore* over context switches. If the task is using the FPU then* the registers in the FPU are more recent than this state* copy. If the task context-switches away then they get, envp, xfeatures, fx_only)
390  Use fpregs_lock() while editing CPU's FPU registers or fpu->state.* A context switch will (and softirq might) save CPU's FPU registers to* fpu->state and set TIF_NEED_FPU_LOAD leaving CPU's FPU registers in* a random state.
391  如果use_xsave()则
392  init_bv等于xfeatures_mask按位与XFEATURE_MASK_FPSSE的反
396  ret等于copy_kernel_to_fxregs_err( & fxsave)
397  否则
398  ret等于__copy_from_user( & fsave, buf_fx, state_size)
399  如果ret则转到:err_out
402  Use fpregs_lock() while editing CPU's FPU registers or fpu->state.* A context switch will (and softirq might) save CPU's FPU registers to* fpu->state and set TIF_NEED_FPU_LOAD leaving CPU's FPU registers in* a random state.
403  ret等于copy_kernel_to_fregs_err( & fsave)
405  如果非retfpregs_mark_activate()
407  否则These generally need preemption protection to work,* do try to avoid using these on their own:
409  fpregs_unlock()
411  err_out :
412  如果retClear the FPU state back to init state.* Called by sys_execve(), by the signal handler code and by various* error paths.
414  返回:ret
调用者
名称描述
fpu__restore_sigRestore FPU state from a sigframe: