Annotation of XNU/bsd/sys/kdebug.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 2000 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: /*     Copyright (c) 1997 Apple Computer, Inc.  All rights reserved. 
        !            24:  *
        !            25:  * kdebug.h -   kernel_debug definitions
        !            26:  *
        !            27:  */
        !            28: 
        !            29: #ifndef BSD_SYS_KDEBUG_H
        !            30: #define BSD_SYS_KDEBUG_H
        !            31: 
        !            32: #include <sys/cdefs.h>
        !            33: __BEGIN_DECLS
        !            34: 
        !            35: #include <mach/clock_types.h>
        !            36: #if    defined(KERNEL_BUILD)
        !            37: #include <kdebug.h>
        !            38: #endif /* KERNEL_BUILD */
        !            39: 
        !            40: /*
        !            41:  * types of faults that vm_fault handles
        !            42:  * and creates trace entries for
        !            43:  */
        !            44: #define DBG_ZERO_FILL_FAULT   1
        !            45: #define DBG_PAGEIN_FAULT      2
        !            46: #define DBG_COW_FAULT         3
        !            47: #define DBG_CACHE_HIT_FAULT   4
        !            48: 
        !            49: 
        !            50: /* The debug code consists of the following 
        !            51: *
        !            52: * ----------------------------------------------------------------------
        !            53: *|              |               |                               |Func   |
        !            54: *| Class (8)    | SubClass (8)  |          Code (14)            |Qual(2)|
        !            55: * ----------------------------------------------------------------------
        !            56: * The class specifies the higher level 
        !            57: */
        !            58: 
        !            59: /* The Function qualifiers  */
        !            60: #define DBG_FUNC_START         1
        !            61: #define DBG_FUNC_END           2
        !            62: #define DBG_FUNC_NONE          0
        !            63: 
        !            64: 
        !            65: /* The Kernel Debug Classes  */
        !            66: #define DBG_MACH               1
        !            67: #define DBG_NETWORK            2       
        !            68: #define DBG_FSYSTEM            3
        !            69: #define DBG_BSD                        4
        !            70: #define DBG_IOKIT              5
        !            71: #define DBG_DRIVERS            6
        !            72: #define DBG_TRACE               7
        !            73: #define DBG_MISC               20
        !            74: #define DBG_MIG                        255
        !            75: 
        !            76: /* **** The Kernel Debug Sub Classes for Mach (DBG_MACH) **** */
        !            77: #define        DBG_MACH_EXCP_DFLT      0x03    /* Data Translation Fault */
        !            78: #define        DBG_MACH_EXCP_IFLT      0x04    /* Inst Translation Fault */
        !            79: #define        DBG_MACH_EXCP_INTR      0x05    /* Interrupts */
        !            80: #define        DBG_MACH_EXCP_ALNG      0x06    /* Alignment Exception */
        !            81: #define        DBG_MACH_EXCP_TRAP      0x07    /* Traps */
        !            82: #define        DBG_MACH_EXCP_FP        0x08    /* FP Unavail */
        !            83: #define        DBG_MACH_EXCP_DECI      0x09    /* Decrementer Interrupt */
        !            84: #define        DBG_MACH_EXCP_SC        0x0C    /* System Calls */
        !            85: #define        DBG_MACH_EXCP_TRACE     0x0D    /* Trace exception */
        !            86: #define        DBG_MACH_IHDLR          0x10    /* Interrupt Handlers */
        !            87: #define        DBG_MACH_IPC            0x20    /* Inter Process Comm */
        !            88: #define        DBG_MACH_VM             0x30    /* Virtual Memory */
        !            89: #define        DBG_MACH_SCHED          0x40    /* Scheduler */
        !            90: #define        DBG_MACH_MSGID_INVALID  0x50    /* Messages - invalid */
        !            91: 
        !            92: /* Codes for Scheduler (DBG_MACH_SCHED) */     
        !            93: #define MACH_SCHED              0x0     /* Scheduler */
        !            94: #define MACH_STACK_ATTACH       0x1     /* stack_attach() */
        !            95: #define MACH_STACK_HANDOFF      0x2     /* stack_handoff() */
        !            96: #define MACH_CALL_CONT          0x3     /* call_continuation() */
        !            97: #define MACH_CALLOUT            0x4     /* callouts */
        !            98: #define MACH_STACK_DETACH       0x5
        !            99: 
        !           100: /* **** The Kernel Debug Sub Classes for Network (DBG_NETWORK) **** */
        !           101: #define DBG_NETIP      1       /* Internet Protocol */
        !           102: #define DBG_NETARP     2       /* Address Resolution Protocol */
        !           103: #define        DBG_NETUDP      3       /* User Datagram Protocol */
        !           104: #define        DBG_NETTCP      4       /* Transmission Control Protocol */
        !           105: #define        DBG_NETICMP     5       /* Internet Control Message Protocol */
        !           106: #define        DBG_NETIGMP     6       /* Internet Group Management Protocol */
        !           107: #define        DBG_NETRIP      7       /* Routing Information Protocol */
        !           108: #define        DBG_NETOSPF     8       /* Open Shortest Path First */
        !           109: #define        DBG_NETISIS     9       /* Intermediate System to Intermediate System */
        !           110: #define        DBG_NETSNMP     10      /* Simple Network Management Protocol */
        !           111: #define DBG_NETSOCK    11      /* Socket Layer */
        !           112: 
        !           113: /* For Apple talk */
        !           114: #define        DBG_NETAARP     100     /* Apple ARP */
        !           115: #define        DBG_NETDDP      101     /* Datagram Delivery Protocol */
        !           116: #define        DBG_NETNBP      102     /* Name Binding Protocol */
        !           117: #define        DBG_NETZIP      103     /* Zone Information Protocol */
        !           118: #define        DBG_NETADSP     104     /* Name Binding Protocol */
        !           119: #define        DBG_NETATP      105     /* Apple Transaction Protocol */
        !           120: #define        DBG_NETASP      106     /* Apple Session Protocol */
        !           121: #define        DBG_NETAFP      107     /* Apple Filing Protocol */
        !           122: #define        DBG_NETRTMP     108     /* Routing Table Maintenance Protocol */
        !           123: #define        DBG_NETAURP     109     /* Apple Update Routing Protocol */
        !           124: 
        !           125: /* **** The Kernel Debug Sub Classes for IOKIT (DBG_IOKIT) **** */
        !           126: #define DBG_IOSCSI     1       /* SCSI */
        !           127: #define DBG_IODISK     2       /* Disk layers */
        !           128: #define        DBG_IONETWORK   3       /* Network layers */
        !           129: #define        DBG_IOKEYBOARD  4       /* Keyboard */
        !           130: #define        DBG_IOPOINTING  5       /* Pointing Devices */
        !           131: #define        DBG_IOAUDIO     6       /* Audio */
        !           132: #define        DBG_IOFLOPPY    7       /* Floppy */
        !           133: #define        DBG_IOSERIAL    8       /* Serial */
        !           134: #define        DBG_IOTTY       9       /* TTY layers */
        !           135: #define DBG_IOWORKLOOP 10      /* Work from work loop */
        !           136: #define DBG_IOINTES    11      /* Interrupt event source */
        !           137: #define DBG_IOCLKES    12      /* Clock event source */
        !           138: #define DBG_IOCMDQ     13      /* Command queue latencies */
        !           139: #define DBG_IOMCURS    14      /* Memory Cursor */
        !           140: #define DBG_IOMDESC    15      /* Memory Descriptors */
        !           141: 
        !           142: /* **** The Kernel Debug Sub Classes for Device Drivers (DBG_DRIVERS) **** */
        !           143: #define DBG_DRVSCSI    1       /* SCSI */
        !           144: #define DBG_DRVDISK    2       /* Disk layers */
        !           145: #define        DBG_DRVNETWORK  3       /* Network layers */
        !           146: #define        DBG_DRVKEYBOARD 4       /* Keyboard */
        !           147: #define        DBG_DRVPOINTING 5       /* Pointing Devices */
        !           148: #define        DBG_DRVAUDIO    6       /* Audio */
        !           149: #define        DBG_DRVFLOPPY   7       /* Floppy */
        !           150: #define        DBG_DRVSERIAL   8       /* Serial */
        !           151: #define DBG_DRVSPLT     9
        !           152: 
        !           153: /* The Kernel Debug Sub Classes for File System */
        !           154: #define DBG_FSRW      1       /* reads and writes to the filesystem */
        !           155: 
        !           156: /* The Kernel Debug Sub Classes for BSD */
        !           157: #define        DBG_BSD_EXCP_SC 0x0C    /* System Calls */
        !           158: 
        !           159: /* The Kernel Debug Sub Classes for DBG_TRACE */
        !           160: #define DBG_TRACE_DATA      0
        !           161: #define DBG_TRACE_STRING    1
        !           162: 
        !           163: /**********************************************************************/
        !           164: 
        !           165: #define KDBG_CODE(Class, SubClass, code) (((Class & 0xff) << 24) | ((SubClass & 0xff) << 16) | ((code & 0x3fff)  << 2))
        !           166: 
        !           167: #define KDBG_MIGCODE(msgid) ((DBG_MIG << 24) | (((msgid) & 0x3fffff)  << 2))
        !           168: 
        !           169: #define MACHDBG_CODE(SubClass, code) KDBG_CODE(DBG_MACH, SubClass, code)
        !           170: #define NETDBG_CODE(SubClass, code) KDBG_CODE(DBG_NETWORK, SubClass, code)
        !           171: #define FSDBG_CODE(SubClass, code) KDBG_CODE(DBG_FSYSTEM, SubClass, code)
        !           172: #define BSDDBG_CODE(SubClass, code) KDBG_CODE(DBG_BSD, SubClass, code)
        !           173: #define IOKDBG_CODE(SubClass, code) KDBG_CODE(DBG_IOKIT, SubClass, code)
        !           174: #define DRVDBG_CODE(SubClass, code) KDBG_CODE(DBG_DRIVERS, SubClass, code)
        !           175: #define TRACEDBG_CODE(SubClass,code) KDBG_CODE(DBG_TRACE, SubClass, code)
        !           176: #define MISCDBG_CODE(SubClass,code) KDBG_CODE(DBG_MISC, SubClass, code)
        !           177: 
        !           178: 
        !           179: /*   Usage:
        !           180: * kernel_debug((KDBG_CODE(DBG_NETWORK, DNET_PROTOCOL, 51) | DBG_FUNC_START), 
        !           181: *      offset, 0, 0, 0,0) 
        !           182: * 
        !           183: * For ex, 
        !           184: * 
        !           185: * #include <sys/kdebug.h>
        !           186: * 
        !           187: * #define DBG_NETIPINIT NETDBG_CODE(DBG_NETIP,1)
        !           188: * 
        !           189: * 
        !           190: * void
        !           191: * ip_init()
        !           192: * {
        !           193: *      register struct protosw *pr;
        !           194: *      register int i;
        !           195: *      
        !           196: *      KERNEL_DEBUG(DBG_NETIPINIT | DBG_FUNC_START, 0,0,0,0,0)
        !           197: *      --------
        !           198: *      KERNEL_DEBUG(DBG_NETIPINIT, 0,0,0,0,0)
        !           199: *      --------
        !           200: *      KERNEL_DEBUG(DBG_NETIPINIT | DBG_FUNC_END, 0,0,0,0,0)
        !           201: * }
        !           202: *
        !           203: 
        !           204: */
        !           205: 
        !           206: extern unsigned int kdebug_enable;
        !           207: #define KERNEL_DEBUG_CONSTANT(x,a,b,c,d,e)    \
        !           208: do {                                   \
        !           209:     if (kdebug_enable)                 \
        !           210:         kernel_debug(x,a,b,c,d,e);     \
        !           211: } while(0)
        !           212: 
        !           213: extern void kernel_debug(unsigned int debugid, unsigned int arg1, unsigned int arg2, unsigned int arg3,  unsigned int arg4, unsigned int arg5);
        !           214: 
        !           215: extern void kernel_debug1(unsigned int debugid, unsigned int arg1, unsigned int arg2, unsigned int arg3,  unsigned int arg4, unsigned int arg5);
        !           216: 
        !           217: #if    KDEBUG
        !           218: 
        !           219: #define KERNEL_DEBUG(x,a,b,c,d,e)      \
        !           220: do {                                   \
        !           221:     if (kdebug_enable)                 \
        !           222:         kernel_debug(x,a,b,c,d,e);     \
        !           223: } while(0)
        !           224: 
        !           225: #define KERNEL_DEBUG1(x,a,b,c,d,e)     \
        !           226: do {                                   \
        !           227:     if (kdebug_enable)                 \
        !           228:         kernel_debug1(x,a,b,c,d,e);    \
        !           229: } while(0)
        !           230: 
        !           231: #else
        !           232: 
        !           233: #define KERNEL_DEBUG(x,a,b,c,d,e)
        !           234: #define KERNEL_DEBUG1(x,a,b,c,d,e)
        !           235: 
        !           236: #endif
        !           237: 
        !           238: __END_DECLS
        !           239: 
        !           240: 
        !           241: #ifdef KERNEL_PRIVATE
        !           242: /*
        !           243:  * private kernel_debug definitions
        !           244:  */
        !           245: 
        !           246: typedef struct {
        !           247: mach_timespec_t        timestamp;
        !           248: unsigned int   arg1;
        !           249: unsigned int   arg2;
        !           250: unsigned int   arg3;
        !           251: unsigned int   arg4;
        !           252: unsigned int   arg5;       /* will hold current thread */
        !           253: unsigned int   debugid;
        !           254: } kd_buf;
        !           255: 
        !           256: /* Debug Flags */
        !           257: #define        KDBG_INIT       0x1
        !           258: #define        KDBG_NOWRAP     0x2
        !           259: #define        KDBG_FREERUN    0x4
        !           260: #define        KDBG_WRAPPED    0x8
        !           261: #define        KDBG_USERFLAGS  (KDBG_FREERUN|KDBG_NOWRAP|KDBG_INIT)
        !           262: #define KDBG_PIDCHECK   0x10
        !           263: #define KDBG_MAPINIT    0x20
        !           264: #define KDBG_PIDEXCLUDE 0x40
        !           265: 
        !           266: typedef struct {
        !           267:        unsigned int    type;
        !           268:        unsigned int    value1;
        !           269:        unsigned int    value2;
        !           270:        unsigned int    value3;
        !           271:        unsigned int    value4;
        !           272:        
        !           273: } kd_regtype;
        !           274: 
        !           275: typedef struct
        !           276: {
        !           277:     int nkdbufs;
        !           278:     int nolog;
        !           279:     int flags;
        !           280:     int nkdthreads;
        !           281: } kbufinfo_t;
        !           282: 
        !           283: typedef struct
        !           284: {
        !           285:   unsigned int thread;
        !           286:   int          valid;
        !           287:   char         command[20];
        !           288: } kd_threadmap;
        !           289: 
        !           290: #define        KDBG_CLASSTYPE          0x10000
        !           291: #define        KDBG_SUBCLSTYPE         0x20000
        !           292: #define        KDBG_RANGETYPE          0x40000
        !           293: #define        KDBG_TYPENONE           0x80000
        !           294: #define KDBG_CKTYPES           0xF0000
        !           295: 
        !           296: #define        KDBG_RANGECHECK 0x100000
        !           297: #define        KDBG_VALCHECK   0x200000        /* Check up to 4 individual values */
        !           298: 
        !           299: #define        KDBG_BUFINIT    0x80000000
        !           300: 
        !           301: /* Control operations */
        !           302: #define        KDBG_EFLAGS     1
        !           303: #define        KDBG_DFLAGS     2
        !           304: #define KDBG_ENABLE    3
        !           305: #define KDBG_SETNUMBUF 4
        !           306: #define KDBG_GETNUMBUF 5
        !           307: #define KDBG_SETUP     6
        !           308: #define KDBG_REMOVE    7
        !           309: #define        KDBG_SETREGCODE 8
        !           310: #define        KDBG_GETREGCODE 9
        !           311: #define        KDBG_READTRACE  10
        !           312: #define KDBG_PIDTR      11
        !           313: #define KDBG_THRMAP     12
        !           314: #define KDBG_PIDEX      14
        !           315: #define KDBG_SETRTCDEC  15
        !           316: 
        !           317: /* Minimum value allowed when setting decrementer ticks */
        !           318: #define KDBG_MINRTCDEC  2500
        !           319: 
        !           320: 
        !           321: /* PCSAMPLES control operations */
        !           322: #define PCSAMPLE_ENABLE           1
        !           323: #define PCSAMPLE_SETNUMBUF 2
        !           324: #define PCSAMPLE_GETNUMBUF 3
        !           325: #define PCSAMPLE_SETUP    4
        !           326: #define PCSAMPLE_REMOVE           5
        !           327: #define        PCSAMPLE_READBUF   6
        !           328: #define        PCSAMPLE_SETREG    7
        !           329: 
        !           330: extern unsigned int pcsample_enable;
        !           331: 
        !           332: typedef struct
        !           333: {
        !           334:     int npcbufs;
        !           335:     int bufsize;
        !           336:     int nolog;
        !           337:     int enable;
        !           338:     unsigned long pcsample_beg;
        !           339:     unsigned long pcsample_end;
        !           340: } pcinfo_t;
        !           341: 
        !           342: #endif /* KERNEL_PRIVATE */
        !           343: 
        !           344: #endif /* !BSD_SYS_KDEBUG_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.