gdb_packet.c (158948) | gdb_packet.c (170473) |
---|---|
1/*- 2 * Copyright (c) 2004 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/gdb/gdb_packet.c 158948 2006-05-26 11:52:20Z phk $"); | 28__FBSDID("$FreeBSD: head/sys/gdb/gdb_packet.c 170473 2007-06-09 21:55:17Z marcel $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/ctype.h> 33#include <sys/kdb.h> 34 35#include <machine/gdb_machdep.h> | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/ctype.h> 33#include <sys/kdb.h> 34 35#include <machine/gdb_machdep.h> |
36#include <machine/kdb.h> |
|
36 37#include <gdb/gdb.h> 38#include <gdb/gdb_int.h> 39 40static char gdb_rxbuf[GDB_BUFSZ]; 41char *gdb_rxp = NULL; 42size_t gdb_rxsz = 0; 43static char gdb_txbuf[GDB_BUFSZ]; --- 80 unchanged lines hidden (view full) --- 124 gdb_rxp += len; 125 gdb_rxsz -= len; 126 return (1); 127} 128 129int 130gdb_rx_mem(unsigned char *addr, size_t size) 131{ | 37 38#include <gdb/gdb.h> 39#include <gdb/gdb_int.h> 40 41static char gdb_rxbuf[GDB_BUFSZ]; 42char *gdb_rxp = NULL; 43size_t gdb_rxsz = 0; 44static char gdb_txbuf[GDB_BUFSZ]; --- 80 unchanged lines hidden (view full) --- 125 gdb_rxp += len; 126 gdb_rxsz -= len; 127 return (1); 128} 129 130int 131gdb_rx_mem(unsigned char *addr, size_t size) 132{ |
133 unsigned char *p; |
|
132 void *prev; 133 jmp_buf jb; | 134 void *prev; 135 jmp_buf jb; |
136 size_t cnt; |
|
134 int ret; 135 unsigned char c; 136 137 if (size * 2 != gdb_rxsz) 138 return (-1); 139 140 prev = kdb_jmpbuf(jb); 141 ret = setjmp(jb); 142 if (ret == 0) { | 137 int ret; 138 unsigned char c; 139 140 if (size * 2 != gdb_rxsz) 141 return (-1); 142 143 prev = kdb_jmpbuf(jb); 144 ret = setjmp(jb); 145 if (ret == 0) { |
143 while (size-- > 0) { | 146 p = addr; 147 cnt = size; 148 while (cnt-- > 0) { |
144 c = (C2N(gdb_rxp[0]) << 4) & 0xf0; 145 c |= C2N(gdb_rxp[1]) & 0x0f; | 149 c = (C2N(gdb_rxp[0]) << 4) & 0xf0; 150 c |= C2N(gdb_rxp[1]) & 0x0f; |
146 *addr++ = c; | 151 *p++ = c; |
147 gdb_rxsz -= 2; 148 gdb_rxp += 2; 149 } | 152 gdb_rxsz -= 2; 153 gdb_rxp += 2; 154 } |
155 kdb_cpu_sync_icache(addr, size); |
|
150 } 151 (void)kdb_jmpbuf(prev); 152 return ((ret == 0) ? 1 : 0); 153} 154 155int 156gdb_rx_varhex(uintmax_t *vp) 157{ --- 147 unchanged lines hidden --- | 156 } 157 (void)kdb_jmpbuf(prev); 158 return ((ret == 0) ? 1 : 0); 159} 160 161int 162gdb_rx_varhex(uintmax_t *vp) 163{ --- 147 unchanged lines hidden --- |