Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Our handling of the processor debug registers is non-trivial.* We do not clear them on entry and exit from the kernel. Therefore* it is possible to get a watchpoint trap here from inside the kernel.* However, the code in

Proto:__attribute__((__externally_visible__)) void do_debug(struct pt_regs *regs, long error_code)

Type:void

Parameter:

TypeParameterName
struct pt_regs *regs
longerror_code
715  tsk = current process
716  user_icebp = 0
720  In IST context, we explicitly disable preemption. This serves two* purposes: it makes it much less likely that we would accidentally* schedule in IST context and it will force a warning if we somehow* manage to schedule by accident.
722  These special macros can be used to get or set a debugging register(dr6, 6)
734  set_debugreg(0, 6)
737  dr6 &= ~Define reserved bits in DR6 which are always set to 1
744  clear_tsk_thread_flag(tsk, set when we want DEBUGCTLMSR_BTF )
746  If Value for the false possibility is greater at compile time(!ser_mode(regs) determines whether a register set came from user* mode && (dr6 & single-step ) && is_sysenter_singlestep(regs)) Then
748  dr6 &= ~single-step
749  If Not dr6 Then Go to exit
763  If Not dr6 && ser_mode(regs) determines whether a register set came from user* mode Then user_icebp = 1
767  Debug status used for traps, single steps, etc... = dr6
770  If kprobe_debug_handler(regs) Then Go to exit
774  If notify_die(DIE_DEBUG, "debug", regs, (long) & dr6, error_code, SIGTRAP) == Clean way to return from the notifier and stop further calls. Then Go to exit
782  debug_stack_usage_inc()
785  cond_local_irq_enable(regs)
787  If v8086_mode(regs) Then
788  handle_vm86_trap((structkernel_vm86_regs * )regs, error_code, X86_TRAP_DB)
790  cond_local_irq_disable(regs)
791  debug_stack_usage_dec()
792  Go to exit
795  If WARN_ON_ONCE((dr6 & single-step ) && !ser_mode(regs) determines whether a register set came from user* mode) Then
802  Debug status used for traps, single steps, etc... &= ~single-step
803  Set thread flags in other task's structures.* See asm/thread_info.h for TIF_xxxx flags available:
804  flags &= ~X86_EFLAGS_TF
806  si_code = get_si_code( Debug status used for traps, single steps, etc... )
807  If Debug status used for traps, single steps, etc... & (single-step | DR_TRAP_BITS) || user_icebp Then send_sigtrap(regs, error_code, si_code)
809  cond_local_irq_disable(regs)
810  debug_stack_usage_dec()
812  exit :
813  ist_exit(regs)