⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trace_intr.h

📁 TRACE的源代码,在LINUX调试程序要使用的.
💻 H
字号:
#ifndef __ASM_TRACE_USER_H#define __ASM_TRACE_USER_H/*  This file (trace_user.h) was created by Ron Rechenmacher <ron@fnal.gov> on    Dec 13, 1999. "TERMS AND CONDITIONS" governing this file are in the README    or COPYING file. If you do not have such a file, one can be obtained by    contacting Ron or Fermi Lab in Batavia IL, 60510, phone: 630-840-3000.*/#define __TRACE_INTR_H_REV	"\$RCSfile: trace_intr.h,v $(i386)\$Revision: 1.9 $\$Date: 2004/02/07 02:41:58 $"/*  NOTE: watch out when changing vector when io_apic interrupt mapping is    used.  Ref. arch/i386/kernel/io_apic.c. Note algorithym in    assign_irq_vector() which is called by setup_IO_APIC_irqs() which is    called by setup_IO_APIC called by    arch/i386/kernel/smp.c:smp_boot_cpus() called by init/main.c:smp_init()    called by init/main.c:start_kernel()*/#define TRACE_VECTOR		0x82#ifdef __KERNEL__ /* ------------------------------------------------------- */#include <linux/linkage.h>	/* SYMBOL_NAME_STR */voidtrace_interrupt_init( void );extern struct desc_struct idt_table[256]; /* defd in arch/i386/kernel/traps.c*/#ifndef STR# define __STR(x) #x# define STR( x ) __STR(x)#endif#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)# define SYMBOL_NAME_STR(X)	#X#endif#define BUILD_TRACE_INTERRUPT( handler ) \asmlinkage void trace_interrupt( void );\__asm__( "\n"__ALIGN_STR"\n"\	SYMBOL_NAME_STR(trace_interrupt) ":\n\t"\	"pushl $-1\n\t"\	"cld\n\t" \	"pushl %es\n\t" \	"pushl %ds\n\t" \	"pushl %eax\n\t" \	"pushl %ebp\n\t" \	"pushl %edi\n\t" \	"pushl %esi\n\t" \	"pushl %edx\n\t" \	"pushl %ecx\n\t" \	"pushl %ebx\n\t" \	"movl $" STR(__KERNEL_DS) ",%edx\n\t" \	"movl %edx,%ds\n\t" \	"movl %edx,%es\n\t"\	"pushl %ecx\n\t"\	"pushl %ebx\n\t"\	"pushl %eax\n\t"\	"call "SYMBOL_NAME_STR(handler)"\n\t"\	"addl $12,%esp\n\t"\	"popl %ebx\n\t"\	"popl %ecx\n\t"\	"popl %edx\n\t"\	"popl %esi\n\t"\	"popl %edi\n\t"\	"popl %ebp\n\t"\	"popl %eax\n\t"\	"popl %ds\n\t"\	"popl %es\n\t"\	"addl $4,%esp\n\t"\	"iret\n" )#else /* of ifdef __KERNEL__ ----------------------------------------------- *//****************************************************************************** *  trace_function * *  It is OK that this is a function call as the "if" statement in the *  TRACE macro is the critical item. *  And since we can make it a function (where everything will be organized *  on the stack, all we have to do is pass a pointer to the start location *  on the stack. * */static voidtrace_function(  struct timeval	*time	       ,  int		tid	       /*, int		lvl	       , char		*msg*/	       , ... ){	va_list ap;    va_start( ap, tid );    __asm__( "int %0"	    :	    :"i"(TRACE_VECTOR)	    ,"a"(time)	    ,"b"(tid)	    ,"c"(ap) );    va_end( ap );    return;}   /* trace_function */#endif	/* of else of ifdef __KERNEL__ ------------------------------------- */#endif /* __ASM_TRACE_USER_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -