1 /* $NetBSD: db_memrw.c,v 1.4 2002/02/12 15:26:49 uch Exp $ */ 2 3 /* 4 * Mach Operating System 5 * Copyright (c) 1991,1990 Carnegie Mellon University 6 * All Rights Reserved. 7 * 8 * Permission to use, copy, modify and distribute this software and its 9 * documentation is hereby granted, provided that both the copyright 10 * notice and this permission notice appear in all copies of the 11 * software, derivative works or modified versions, and any portions 12 * thereof, and that both notices appear in supporting documentation. 13 * 14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 15 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 16 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 17 * 18 * Carnegie Mellon requests users of this software to return to 19 * 20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 21 * School of Computer Science 22 * Carnegie Mellon University 23 * Pittsburgh PA 15213-3890 24 * 25 * any improvements or extensions that they make and grant Carnegie the 26 * rights to redistribute these changes. 27 * 28 * db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU) 29 */ 30 31 /* 32 * Routines to read and write memory on behalf of the debugger, used 33 * by DDB and KGDB. 34 */ 35 36 #include <sys/param.h> 37 #include <sys/proc.h> 38 #include <sys/systm.h> 39 40 #include <uvm/uvm_extern.h> 41 42 #include <machine/db_machdep.h> 43 44 #include <ddb/db_access.h> 45 46 /* 47 * Read bytes from kernel address space for debugger. 48 */ 49 void 50 db_read_bytes(vaddr_t addr, size_t size, char *data) 51 { 52 char *src; 53 54 src = (char *)addr; 55 while (size-- > 0) 56 *data++ = *src++; 57 } 58 59 /* 60 * Write bytes to kernel address space for debugger. 61 */ 62 void 63 db_write_bytes(vaddr_t addr, size_t size, char *data) 64 { 65 char *dst; 66 67 dst = (char *)addr; 68 69 while (size-- > 0) 70 *dst++ = *data++; 71 } 72