darwin-xnu/osfmk/kern/xpr.h
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
   3 *
   4 * @APPLE_LICENSE_HEADER_START@
   5 * 
   6 * The contents of this file constitute Original Code as defined in and
   7 * are subject to the Apple Public Source License Version 1.1 (the
   8 * "License").  You may not use this file except in compliance with the
   9 * License.  Please obtain a copy of the License at
  10 * http://www.apple.com/publicsource and read it before using this file.
  11 * 
  12 * This Original Code and all software distributed under the License are
  13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
  17 * License for the specific language governing rights and limitations
  18 * under the License.
  19 * 
  20 * @APPLE_LICENSE_HEADER_END@
  21 */
  22/*
  23 * @OSF_COPYRIGHT@
  24 */
  25/* 
  26 * Mach Operating System
  27 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
  28 * All Rights Reserved.
  29 * 
  30 * Permission to use, copy, modify and distribute this software and its
  31 * documentation is hereby granted, provided that both the copyright
  32 * notice and this permission notice appear in all copies of the
  33 * software, derivative works or modified versions, and any portions
  34 * thereof, and that both notices appear in supporting documentation.
  35 * 
  36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  37 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  39 * 
  40 * Carnegie Mellon requests users of this software to return to
  41 * 
  42 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  43 *  School of Computer Science
  44 *  Carnegie Mellon University
  45 *  Pittsburgh PA 15213-3890
  46 * 
  47 * any improvements or extensions that they make and grant Carnegie Mellon
  48 * the rights to redistribute these changes.
  49 */
  50/*
  51 */
  52/*
  53 * Include file for xpr circular buffer silent tracing.  
  54 *
  55 */
  56/*
  57 * If the kernel flag XPRDEBUG is set, the XPR macro is enabled.  The 
  58 * macro should be invoked something like the following:
  59 *      XPR(XPR_SYSCALLS, "syscall: %d, 0x%x\n", syscallno, arg1, 0,0,0);
  60 * which will expand into the following code:
  61 *      if (xprflags & XPR_SYSCALLS)
  62 *              xpr("syscall: %d, 0x%x\n", syscallno, arg1, 0,0,0);
  63 * Xpr will log the pointer to the printf string and up to 5 arguements,
  64 * along with a timestamp and cpuinfo (for multi-processor systems), into
  65 * a circular buffer.  The actual printf processing is delayed until after
  66 * the buffer has been collected.  It is assumed that the text/data segments
  67 * of the kernel can easily be reconstructed in a post-processor which
  68 * performs the printf processing.
  69 *
  70 * If the XPRDEBUG compilation switch is not set, the XPR macro expands 
  71 * to nothing.
  72 */
  73
  74#ifndef _KERN_XPR_H_
  75#define _KERN_XPR_H_
  76
  77#ifdef  MACH_KERNEL
  78#include <xpr_debug.h>
  79#else   /* MACH_KERNEL */
  80#include <sys/features.h>
  81#endif  /* MACH_KERNEL */
  82
  83#include <machine/xpr.h>
  84
  85#if     XPR_DEBUG
  86
  87#define XPR(flags, msg, arg1, arg2, arg3, arg4, arg5)           \
  88MACRO_BEGIN                                                     \
  89        if (xprflags & (flags)) {                               \
  90                xpr((msg), (long)(arg1), (long)(arg2),          \
  91                    (long)(arg3), (long)(arg4), (long)(arg5));  \
  92        }                                                       \
  93MACRO_END
  94
  95extern int xprflags;
  96
  97/*
  98 * flags for message types.
  99 */
 100#define XPR_TRAPS               (1 << 1)
 101#define XPR_SCHED               (1 << 2)
 102#define XPR_LOCK                (1 << 3)
 103#define XPR_SLOCK               (1 << 4)
 104#define XPR_PMAP                (1 << 6)
 105#define XPR_VM_MAP              (1 << 7)
 106#define XPR_VM_OBJECT           (1 << 8)
 107#define XPR_VM_OBJECT_CACHE     (1 << 9)
 108#define XPR_VM_PAGE             (1 << 10)
 109#define XPR_VM_PAGEOUT          (1 << 11)
 110#define XPR_MEMORY_OBJECT       (1 << 12)
 111#define XPR_VM_FAULT            (1 << 13)
 112#define XPR_VM_OBJECT_REP       (1 << 14)
 113#define XPR_DEFAULT_PAGER       (1 << 15)
 114#define XPR_INODE_PAGER         (1 << 16)
 115#define XPR_INODE_PAGER_DATA    (1 << 17)
 116#define XPR_XMM                 (1 << 18)
 117
 118#else   /* XPR_DEBUG */
 119#define XPR(flags, msg, arg1, arg2, arg3, arg4, arg5)
 120#endif  /* XPR_DEBUG */
 121
 122struct xprbuf {
 123        const char      *msg;
 124        long            arg1,arg2,arg3,arg4,arg5;
 125        int             timestamp;
 126        int             cpuinfo;
 127};
 128
 129/* Bootstrap XPR facility */
 130extern void xprbootstrap(void);
 131
 132/* Enable XPR facility */
 133extern void xprinit(void);
 134
 135/* Log an XPR message */
 136extern void xpr(
 137        const char      *msg,
 138        long            arg1,
 139        long            arg2,
 140        long            arg3,
 141        long            arg4,
 142        long            arg5);
 143
 144#endif /* _KERN_XPR_H_ */
 145
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.