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/powerpc/powerpc/db_memrw.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 /*      $FreeBSD$ */
    2 /*      $NetBSD: db_memrw.c,v 1.5 2001/12/27 10:25:41 dbj Exp $ */
    3 /*      $OpenBSD: db_memrw.c,v 1.2 1996/12/28 06:21:52 rahnds Exp $     */
    4 
    5 /*-
    6  * Mach Operating System
    7  * Copyright (c) 1992 Carnegie Mellon University
    8  * All Rights Reserved.
    9  * 
   10  * Permission to use, copy, modify and distribute this software and its
   11  * documentation is hereby granted, provided that both the copyright
   12  * notice and this permission notice appear in all copies of the
   13  * software, derivative works or modified versions, and any portions
   14  * thereof, and that both notices appear in supporting documentation.
   15  * 
   16  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   17  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   18  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   19  * 
   20  * Carnegie Mellon requests users of this software to return to
   21  * 
   22  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   23  *  School of Computer Science
   24  *  Carnegie Mellon University
   25  *  Pittsburgh PA 15213-3890
   26  * 
   27  * any improvements or extensions that they make and grant Carnegie Mellon 
   28  * the rights to redistribute these changes.
   29  */
   30 
   31 /*
   32  * Interface to the debugger for virtual memory read/write.
   33  * This is a simple version for kernels with writable text.
   34  * For an example of read-only kernel text, see the file:
   35  * sys/arch/sun3/sun3/db_memrw.c
   36  *
   37  * ALERT!  If you want to access device registers with a
   38  * specific size, then the read/write functions have to
   39  * make sure to do the correct sized pointer access.
   40  */
   41 
   42 #include <sys/param.h>
   43 #include <sys/proc.h>
   44 
   45 #include <vm/vm.h>
   46 #include <vm/vm_extern.h>
   47 
   48 #include <machine/cpu.h>
   49 #include <machine/db_machdep.h>
   50 
   51 #include <ddb/ddb.h>
   52 
   53 /*
   54  * Read bytes from kernel address space for debugger.
   55  */
   56 void
   57 db_read_bytes(addr, size, data)
   58         vm_offset_t     addr;
   59         register size_t size;
   60         register char   *data;
   61 {
   62         register char   *src = (char*)addr;
   63 
   64         if (size == 4) {
   65                 *((int*)data) = *((int*)src);
   66                 return;
   67         }
   68 
   69         if (size == 2) {
   70                 *((short*)data) = *((short*)src);
   71                 return;
   72         }
   73 
   74         while (size > 0) {
   75                 --size;
   76                 *data++ = *src++;
   77         }
   78 }
   79 
   80 /*
   81  * Write bytes to kernel address space for debugger.
   82  */
   83 void
   84 db_write_bytes(addr, size, data)
   85         vm_offset_t     addr;
   86         register size_t size;
   87         register char   *data;
   88 {
   89         register char   *dst = (char *)addr;
   90 
   91         if (size == 4) {
   92 
   93                 *((int*)dst) = *((int*)data);
   94 
   95         } else  if (size == 2) {
   96 
   97                 *((short*)dst) = *((short*)data);
   98 
   99         } else {
  100 
  101                 while (size > 0) {
  102                         --size;
  103                         *dst++ = *data++;
  104                 }
  105 
  106         }
  107 
  108         __syncicache((void *)addr, size);
  109 }
  110 

Cache object: c3826293421d71a112c38892224320ac


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