📄 trace_intr.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 June 1, 2000. "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 $(ppc)\$Revision: 1.2 $\$Date: 2001/08/25 08:53:35 $"#define TRACE_VECTOR 99 /* arbitrary - must match compare value in head.S */#ifdef __KERNEL__ /* ------------------------------------------------------- */voidtrace_interrupt_init( void );#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. * * Ref. glibc-2.1.3/sysdeps/unix/sysv/linux/powerpc/sysdep.h * and receiving code in arch/ppc/kernel/head.S???? * * Ref. also include/asm-ppc/unistd.h */static voidtrace_function( struct timeval *time , int tid /*, int lvl , char *msg*/ , ... ){ va_list ap; int ii; struct { int lvl; char *msg; int params[traceControl_sp->numberOfParameter_integers]; } kk; va_start( ap, tid ); kk.lvl = va_arg( ap, int ); kk.msg = va_arg( ap, char * ); for (ii=0; ii<traceControl_sp->numberOfParameter_integers; ii++) { kk.params[ii] = va_arg( ap, int ); } va_end( ap ); {# if 0 register long __sc_0 __asm__("r0"); register long __sc_4 __asm__("r4"); register long __sc_5 __asm__("r5"); register long __sc_6 __asm__("r6"); __sc_0 = (long)time; __sc_4 = TRACE_VECTOR; __sc_5 = (long)tid; __sc_6 = (long)&kk;# else /* The above can be optimized away! I looked at the asm code generated and placed it below (after searching the source for examples of asm using lwz and finding that I need to use the "m" operand constraint). */ __asm__ __volatile__("lwz 0,%0" : : "m" (time) : "r0" ); __asm__ __volatile__("li 4,%0" : : "i" (TRACE_VECTOR) : "r4" ); __asm__ __volatile__("lwz 5,%0" : : "m" (tid) : "r5" ); __asm__ __volatile__("mr 6,%0" : : "g" ((long)&kk) : "r6" );# endif# define __syscall_clobbers \ "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" __asm__ __volatile__ ("trap \n\t" : : : __syscall_clobbers ); } return;} /* trace_function */#endif /* of else of ifdef __KERNEL__ ------------------------------------- */#endif /* __ASM_TRACE_USER_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -