The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/norma/xmm_debug.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1991 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie the
   24  * rights to redistribute these changes.
   25  */
   26 /*
   27  * HISTORY
   28  * $Log:        xmm_debug.c,v $
   29  * Revision 2.4  92/03/10  16:29:02  jsb
   30  *      Merged in norma branch changes as of NORMA_MK7.
   31  *      [92/03/09  12:51:08  jsb]
   32  * 
   33  * Revision 2.3.3.3  92/02/21  11:25:46  jsb
   34  *      No longer an xmm layer. Will eventually be used by xmm_invoke.c.
   35  *      [92/02/20  15:45:23  jsb]
   36  * 
   37  * Revision 2.3.3.1  92/01/21  21:53:54  jsb
   38  *      De-linted. Supports new (dlb) memory object routines.
   39  *      Supports arbitrary reply ports to lock_request, etc.
   40  *      Converted mach_port_t (and port_t) to ipc_port_t.
   41  *      Use db_printf instead of printf.
   42  *      [92/01/20  17:20:11  jsb]
   43  * 
   44  *      Fixes from OSF.
   45  *      [92/01/17  14:14:30  jsb]
   46  * 
   47  * Revision 2.3.1.1  92/01/15  12:14:56  jeffreyh
   48  *      Return a value from the debug layer terminate routine.
   49  *      It was losing it before. (sjs)
   50  * 
   51  * Revision 2.3  91/07/01  08:26:00  jsb
   52  *      Collect garbage. Return valid return values.
   53  *      [91/06/29  15:25:16  jsb]
   54  * 
   55  * Revision 2.2  91/06/17  15:48:13  jsb
   56  *      First checkin.
   57  *      [91/06/17  11:05:55  jsb]
   58  * 
   59  */
   60 /*
   61  *      File:   norma/xmm_debug.c
   62  *      Author: Joseph S. Barrera III
   63  *      Date:   1991
   64  *
   65  *      Xmm layer providing debugging output.
   66  */
   67 
   68 #ifdef  KERNEL
   69 #include <norma/xmm_obj.h>
   70 #include <sys/varargs.h>
   71 #else   KERNEL
   72 #include <xmm_obj.h>
   73 #include <varargs.h>
   74 #endif  KERNEL
   75 
   76 int xmm_debug = 0;
   77 
   78 /* VARARGS */
   79 m_printf(fmt, va_alist)
   80         char *fmt;
   81         va_dcl
   82 {
   83         va_list adx;
   84         char c, buf[1024], fmt0[3], *bp;
   85         int i;
   86         xmm_obj_t mobj;
   87         xmm_obj_t kobj;
   88         xmm_reply_t reply;
   89 
   90         if (! xmm_debug) {
   91                 return;
   92         }
   93         va_start(adx);
   94         fmt0[0] = '%';
   95         fmt0[2] = '\0';
   96         for (;;) {
   97                 bp = buf;
   98                 while ((c = *fmt++) && c != '%') {
   99                         *bp++ = c;
  100                 }
  101                 *bp++ = '\0';
  102                 db_printf("%s", buf);
  103                 if (c == '\0') {
  104                         break;
  105                 }
  106                 switch (c = *fmt++) {
  107                 case 'M':
  108                         mobj = va_arg(adx, xmm_obj_t);
  109                         kobj = va_arg(adx, xmm_obj_t);
  110                         db_printf("k_%s.%x -> m_%s.%x",
  111                                   kobj->k_kobj->class->c_name, kobj,
  112                                   mobj->m_mobj->class->c_name, mobj);
  113                         break;
  114                         
  115                 case 'K':
  116                         kobj = va_arg(adx, xmm_obj_t);
  117                         mobj = kobj;    /* XXX no */
  118                         db_printf("m_%s.%x -> k_%s.%x",
  119                                   mobj->m_mobj->class->c_name, mobj,
  120                                   kobj->k_kobj->class->c_name, kobj);
  121                         break;
  122 
  123                 case 'Z':
  124                         i = va_arg(adx, int);
  125                         db_printf("%d", i / PAGE_SIZE);
  126                         if (i % PAGE_SIZE) {
  127                                 db_printf(".%d", i % PAGE_SIZE);
  128                         }
  129                         break;
  130 
  131                 case 'P':
  132                         i = va_arg(adx, int);
  133                         db_printf("%c%c%c",
  134                                   ((i & VM_PROT_READ) ? 'r' : '-'),
  135                                   ((i & VM_PROT_WRITE) ? 'w' : '-'),
  136                                   ((i & VM_PROT_EXECUTE)? 'x' : '-'));
  137                         break;
  138 
  139                 case 'N':
  140                         if (! va_arg(adx, int)) {
  141                                 db_printf("!");
  142                         }
  143                         break;
  144 
  145                 case 'C':
  146                         i = va_arg(adx, int);
  147                         if (i == MEMORY_OBJECT_COPY_NONE) {
  148                                 bp = "copy_none";
  149                         } else if (i == MEMORY_OBJECT_COPY_CALL) {
  150                                 bp = "copy_call";
  151                         } else if (i == MEMORY_OBJECT_COPY_DELAY) {
  152                                 bp = "copy_delay";
  153                         } else {
  154                                 bp = "copy_???";
  155                         }
  156                         db_printf("%s", bp);
  157                         break;
  158 
  159                 case 'R':
  160                         reply = va_arg(adx, xmm_reply_t);
  161                         /* XXX mobj = reply->mobj; ??? */
  162                         db_printf("k_%s.%x -> r_%s.%x",
  163                                   mobj->k_mobj->class->c_name, mobj,
  164                                   mobj->m_mobj->class->c_name, reply);
  165                         break;
  166 
  167                 default:
  168                         fmt0[1] = c;
  169                         db_printf(fmt0, va_arg(adx, long));
  170                         break;
  171                 }
  172         }
  173         va_end(adx);
  174 }
  175 
  176 #if 0
  177 sample_calls()
  178 {
  179         m_printf("m_init            (%M, 0x%x, %d)\n",
  180                  mobj, kobj, memory_object_name, pagesize);
  181         m_printf("m_terminate       (%M, 0x%x)\n",
  182                  mobj, kobj, memory_object_name);
  183         m_printf("m_copy            (%M, %Z, %Z, 0x%x)\n",
  184                  mobj, kobj, offset, length, new_mobj);
  185         m_printf("m_data_request    (%M, %Z, %Z, %P)\n",
  186                  mobj, kobj, offset, length, desired_access);
  187         m_printf("m_data_unlock     (%M, %Z, %Z, %P)\n",
  188                  mobj, kobj, offset, length, desired_access);
  189         m_printf("m_data_write      (%M, %Z, 0x%x, %Z)\n",
  190                  mobj, kobj, offset, data, length);
  191         m_printf("m_lock_completed  (%R, %Z, %Z)\n",
  192                  reply, offset, length);
  193         m_printf("m_supply_completed(%R, %Z, %Z, 0x%x, %Z)\n",
  194                  reply, offset, length, result, error_offset);
  195         m_printf("m_data_return     (%M, %Z, 0x%x, %Z)\n",
  196                  mobj, kobj, offset, data, length);
  197         m_printf("m_change_completed(%R, %Nmay_cache, %C)\n",
  198                  reply, may_cache, copy_strategy);
  199         m_printf("k_data_unavailable(%K, %Z, %Z)\n",
  200                  kobj, offset, length);
  201         m_printf("k_get_attributes  (%K)\n",
  202                  kobj);
  203         m_printf("k_lock_request    (%K, %Z, %Z, %Nclean, %Nflush, %P, 0x%x)\n",
  204                  kobj, offset, length, should_clean, should_flush, lock_value,
  205                  reply);
  206         m_printf("k_data_error      (%K, %Z, %Z, 0x%x)\n",
  207                  kobj, offset, length, error_value);
  208         m_printf("k_set_ready       (%K, %Nready, %Nmay_cache, %C, %Nuse_old_pageout, 0x%x)\n",
  209                  kobj, object_ready, may_cache, copy_strategy,
  210                  use_old_pageout, reply);
  211         m_printf("k_destroy         (%K, 0x%x)\n",
  212                  kobj, reason);
  213         m_printf("k_data_supply     (%K, %Z, 0x%x, %Z, %P, %Npr, rply=0x%x)\n",
  214                  kobj, offset, data, length, lock_value, precious, reply);
  215 }
  216 #endif

Cache object: 9e480d478f5956f04de84c39e481ca92


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.