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/ddb/db_ext_symtab.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,1990,1989 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 "AS IS"
   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 Mellon
   24  * the rights to redistribute these changes.
   25  */
   26 
   27 /*
   28  * HISTORY
   29  * $Log:        db_ext_symtab.c,v $
   30  * Revision 2.5  92/08/03  17:31:11  jfriedl
   31  *      removed silly prototypes
   32  *      [92/08/02            jfriedl]
   33  * 
   34  * Revision 2.4  92/05/21  17:07:00  jfriedl
   35  *      tried prototypes.
   36  *      [92/05/20            jfriedl]
   37  * 
   38  * Revision 2.3  92/01/03  20:02:41  dbg
   39  *      Don't deallocate symbol-table twice if error in loading symbol
   40  *      table.
   41  *      [91/11/29            dbg]
   42  * 
   43  * Revision 2.2  91/07/31  17:30:05  dbg
   44  *      Created.
   45  *      [91/07/30  16:43:20  dbg]
   46  * 
   47  */
   48 #include <mach_debug.h>
   49 
   50 #if     MACH_DEBUG
   51 
   52 #include <mach/mach_types.h>    /* vm_address_t */
   53 #include <mach/std_types.h>     /* pointer_t */
   54 #include <mach/vm_param.h>
   55 #include <vm/vm_map.h>
   56 #include <vm/vm_kern.h>
   57 #include <kern/host.h>
   58 #include <kern/task.h>
   59 #include <ddb/db_sym.h>
   60 
   61 
   62 
   63 /*
   64  *      Loads a symbol table for an external file into the kernel debugger.
   65  *      The symbol table data is an array of characters.  It is assumed that
   66  *      the caller and the kernel debugger agree on its format.
   67  */
   68 kern_return_t
   69 host_load_symbol_table(host, task, name, symtab, symtab_count)
   70         host_t          host;
   71         task_t          task;
   72         char *          name;
   73         pointer_t       symtab;
   74         unsigned int    symtab_count;
   75 {
   76         kern_return_t   result;
   77         vm_offset_t     symtab_start;
   78         vm_offset_t     symtab_end;
   79         vm_map_t        map;
   80         vm_map_copy_t   symtab_copy_object;
   81 
   82         if (host == HOST_NULL)
   83             return (KERN_INVALID_ARGUMENT);
   84 
   85         /*
   86          * Copy the symbol table array into the kernel.
   87          * We make a copy of the copy object, and clear
   88          * the old one, so that returning error will not
   89          * deallocate the data twice.
   90          */
   91         symtab_copy_object = (vm_map_copy_t) symtab;
   92         result = vm_map_copyout(
   93                         kernel_map,
   94                         &symtab_start,
   95                         vm_map_copy_copy(symtab_copy_object));
   96         if (result != KERN_SUCCESS)
   97             return (result);
   98 
   99         symtab_end = symtab_start + symtab_count;
  100 
  101         /*
  102          * Add the symbol table.
  103          * Do not keep a reference for the task map.    XXX
  104          */
  105         if (task == TASK_NULL)
  106             map = VM_MAP_NULL;
  107         else
  108             map = task->map;
  109         if (!X_db_sym_init((char *)symtab_start,
  110                         (char *)symtab_end,
  111                         name,
  112                         (char *)map))
  113         {
  114             /*
  115              * Not enough room for symbol table - failure.
  116              */
  117             (void) vm_deallocate(kernel_map,
  118                         symtab_start,
  119                         symtab_count);
  120             return (KERN_FAILURE);
  121         }
  122 
  123         /*
  124          * Wire down the symbol table
  125          */
  126         (void) vm_map_pageable(kernel_map,
  127                 symtab_start,
  128                 round_page(symtab_end),
  129                 VM_PROT_READ|VM_PROT_WRITE);
  130 
  131         /*
  132          * Discard the original copy object
  133          */
  134         vm_map_copy_discard(symtab_copy_object);
  135 
  136         return (KERN_SUCCESS);
  137 }
  138 
  139 #endif  /* MACH_DEBUG */

Cache object: 47a14d30f7dd69490ed1fb9dbfd607f4


[ 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.