dcons_os.c (164033) | dcons_os.c (170017) |
---|---|
1/*- 2 * Copyright (C) 2003,2004 3 * Hidetoshi Shimokawa. 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 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * | 1/*- 2 * Copyright (C) 2003,2004 3 * Hidetoshi Shimokawa. 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 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * |
34 * $FreeBSD: head/sys/dev/dcons/dcons_os.c 164033 2006-11-06 13:42:10Z rwatson $ | 34 * $FreeBSD: head/sys/dev/dcons/dcons_os.c 170017 2007-05-27 13:58:43Z simokawa $ |
35 */ 36 37#include <sys/param.h> 38#if __FreeBSD_version >= 502122 39#include <sys/kdb.h> 40#include <gdb/gdb.h> 41#endif 42#include <sys/kernel.h> --- 23 unchanged lines hidden (view full) --- 66#include <sys/reboot.h> 67 68#include <sys/sysctl.h> 69 70#include <vm/vm.h> 71#include <vm/vm_param.h> 72#include <vm/pmap.h> 73 | 35 */ 36 37#include <sys/param.h> 38#if __FreeBSD_version >= 502122 39#include <sys/kdb.h> 40#include <gdb/gdb.h> 41#endif 42#include <sys/kernel.h> --- 23 unchanged lines hidden (view full) --- 66#include <sys/reboot.h> 67 68#include <sys/sysctl.h> 69 70#include <vm/vm.h> 71#include <vm/vm_param.h> 72#include <vm/pmap.h> 73 |
74#include "opt_ddb.h" | |
75#include "opt_comconsole.h" 76#include "opt_dcons.h" | 74#include "opt_comconsole.h" 75#include "opt_dcons.h" |
76#include "opt_kdb.h" 77#include "opt_gdb.h" 78#include "opt_ddb.h" |
|
77 | 79 |
80 |
|
78#ifndef DCONS_POLL_HZ 79#define DCONS_POLL_HZ 100 80#endif 81 82#ifndef DCONS_BUF_SIZE 83#define DCONS_BUF_SIZE (16*1024) 84#endif 85 --- 87 unchanged lines hidden (view full) --- 173static cn_probe_t dcons_cnprobe; 174static cn_init_t dcons_cninit; 175static cn_term_t dcons_cnterm; 176static cn_getc_t dcons_cngetc; 177static cn_putc_t dcons_cnputc; 178 179CONSOLE_DRIVER(dcons); 180 | 81#ifndef DCONS_POLL_HZ 82#define DCONS_POLL_HZ 100 83#endif 84 85#ifndef DCONS_BUF_SIZE 86#define DCONS_BUF_SIZE (16*1024) 87#endif 88 --- 87 unchanged lines hidden (view full) --- 176static cn_probe_t dcons_cnprobe; 177static cn_init_t dcons_cninit; 178static cn_term_t dcons_cnterm; 179static cn_getc_t dcons_cngetc; 180static cn_putc_t dcons_cnputc; 181 182CONSOLE_DRIVER(dcons); 183 |
181#if __FreeBSD_version >= 502122 | 184#if defined(GDB) && (__FreeBSD_version >= 502122) |
182static gdb_probe_f dcons_dbg_probe; 183static gdb_init_f dcons_dbg_init; 184static gdb_term_f dcons_dbg_term; 185static gdb_getc_f dcons_dbg_getc; 186static gdb_putc_f dcons_dbg_putc; 187 188GDB_DBGPORT(dcons, dcons_dbg_probe, dcons_dbg_init, dcons_dbg_term, 189 dcons_dbg_getc, dcons_dbg_putc); 190 191extern struct gdb_dbgport *gdb_cur; 192#endif 193 | 185static gdb_probe_f dcons_dbg_probe; 186static gdb_init_f dcons_dbg_init; 187static gdb_term_f dcons_dbg_term; 188static gdb_getc_f dcons_dbg_getc; 189static gdb_putc_f dcons_dbg_putc; 190 191GDB_DBGPORT(dcons, dcons_dbg_probe, dcons_dbg_init, dcons_dbg_term, 192 dcons_dbg_getc, dcons_dbg_putc); 193 194extern struct gdb_dbgport *gdb_cur; 195#endif 196 |
194#if (defined(KDB) || defined(DDB)) && defined(ALT_BREAK_TO_DEBUGGER) | 197#if (defined(GDB) || defined(DDB)) && defined(ALT_BREAK_TO_DEBUGGER) |
195static int 196dcons_check_break(struct dcons_softc *dc, int c) 197{ 198 if (c < 0) 199 return (c); 200 201#if __FreeBSD_version >= 502122 202 if (kdb_alt_break(c, &dc->brk_state)) { | 198static int 199dcons_check_break(struct dcons_softc *dc, int c) 200{ 201 if (c < 0) 202 return (c); 203 204#if __FreeBSD_version >= 502122 205 if (kdb_alt_break(c, &dc->brk_state)) { |
206#ifdef GDB |
|
203 if ((dc->flags & DC_GDB) != 0) { 204 if (gdb_cur == &dcons_gdb_dbgport) { 205 kdb_dbbe_select("gdb"); 206 breakpoint(); 207 } 208 } else | 207 if ((dc->flags & DC_GDB) != 0) { 208 if (gdb_cur == &dcons_gdb_dbgport) { 209 kdb_dbbe_select("gdb"); 210 breakpoint(); 211 } 212 } else |
213#endif |
|
209 breakpoint(); 210 } 211#else 212 switch (dc->brk_state) { 213 case STATE1: 214 if (c == KEY_TILDE) 215 dc->brk_state = STATE2; 216 else --- 29 unchanged lines hidden (view full) --- 246 c = dcons_check_break(dc, dcons_checkc(dc)); 247 248 if (dg.dma_tag != NULL) 249 bus_dmamap_sync(dg.dma_tag, dg.dma_map, BUS_DMASYNC_PREREAD); 250 251 return (c); 252} 253 | 214 breakpoint(); 215 } 216#else 217 switch (dc->brk_state) { 218 case STATE1: 219 if (c == KEY_TILDE) 220 dc->brk_state = STATE2; 221 else --- 29 unchanged lines hidden (view full) --- 251 c = dcons_check_break(dc, dcons_checkc(dc)); 252 253 if (dg.dma_tag != NULL) 254 bus_dmamap_sync(dg.dma_tag, dg.dma_map, BUS_DMASYNC_PREREAD); 255 256 return (c); 257} 258 |
259#if defined(GDB) || !defined(CONS_NODEV) |
|
254static int 255dcons_os_getc(struct dcons_softc *dc) 256{ 257 int c; 258 259 while ((c = dcons_os_checkc(dc)) == -1); 260 261 return (c & 0xff); 262} | 260static int 261dcons_os_getc(struct dcons_softc *dc) 262{ 263 int c; 264 265 while ((c = dcons_os_checkc(dc)) == -1); 266 267 return (c & 0xff); 268} |
269#endif |
|
263 264static void 265dcons_os_putc(struct dcons_softc *dc, int c) 266{ 267 if (dg.dma_tag != NULL) 268 bus_dmamap_sync(dg.dma_tag, dg.dma_map, BUS_DMASYNC_POSTWRITE); 269 270 dcons_putc(dc, c); --- 429 unchanged lines hidden (view full) --- 700 break; 701 default: 702 err = EOPNOTSUPP; 703 break; 704 } 705 return(err); 706} 707 | 270 271static void 272dcons_os_putc(struct dcons_softc *dc, int c) 273{ 274 if (dg.dma_tag != NULL) 275 bus_dmamap_sync(dg.dma_tag, dg.dma_map, BUS_DMASYNC_POSTWRITE); 276 277 dcons_putc(dc, c); --- 429 unchanged lines hidden (view full) --- 707 break; 708 default: 709 err = EOPNOTSUPP; 710 break; 711 } 712 return(err); 713} 714 |
708#if __FreeBSD_version >= 502122 | 715#if defined(GDB) && (__FreeBSD_version >= 502122) |
709/* Debugger interface */ 710 711static int 712dcons_dbg_probe(void) 713{ 714 return(DCONS_FORCE_GDB); 715} 716 --- 27 unchanged lines hidden --- | 716/* Debugger interface */ 717 718static int 719dcons_dbg_probe(void) 720{ 721 return(DCONS_FORCE_GDB); 722} 723 --- 27 unchanged lines hidden --- |