diff --git a/sys/arch/sun3/sun3/db_machdep.c b/sys/arch/sun3/sun3/db_machdep.c index b8fc34692e45..bcccb93b70c8 100644 --- a/sys/arch/sun3/sun3/db_machdep.c +++ b/sys/arch/sun3/sun3/db_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.6 1995/10/23 18:40:35 gwr Exp $ */ +/* $NetBSD: db_machdep.c,v 1.7 1996/02/16 20:08:44 gwr Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross @@ -44,149 +44,6 @@ #include -#undef DEBUG - -#ifdef DEBUG -int db_machdep_debug; -#endif - -/* - * Interface to the debugger for virtual memory read/write. - * - * To write in the text segment, we have to first make - * the page writable, do the write, then restore the PTE. - * For writes outside the text segment, and all reads, - * just do the access -- if it causes a fault, the debugger - * will recover with a longjmp to an appropriate place. - * - * ALERT! If you want to access device registers with a - * specific size, then the read/write functions have to - * make sure to do the correct sized pointer access. - */ - -/* - * Read bytes from kernel address space for debugger. - * This used to check for valid PTEs, but now that - * traps in DDB work correctly, "Just Do It!" - */ -void -db_read_bytes(addr, size, data) - vm_offset_t addr; - register int size; - register char *data; -{ - register char *src; - register char incr; - -#ifdef DEBUG - if (db_machdep_debug) - printf("db_read_bytes: addr=0x%x, size=%d\n", addr, size); -#endif - - if (size == 4) { - *((int*)data) = *((int*)addr); - return; - } - - if (size == 2) { - *((short*)data) = *((short*)addr); - return; - } - - src = (char *)addr; - while (size > 0) { - --size; - *data++ = *src++; - } -} - -/* - * Write one byte somewhere in kernel text. - * It does not matter if this is slow. - */ -static void -db_write_text(dst, ch) - char *dst; - int ch; -{ - int oldpte, tmppte; - vm_offset_t pgva = sun3_trunc_page((long)dst); - extern int cache_size; - - /* Flush read-only VAC entry so we'll see the new one. */ -#ifdef HAVECACHE - if (cache_size) - cache_flush_page(pgva); -#endif - oldpte = get_pte(pgva); - if ((oldpte & PG_VALID) == 0) { - db_printf(" address 0x%x not a valid page\n", dst); - return; - } - tmppte = oldpte | PG_WRITE | PG_NC; - - set_pte(pgva, tmppte); - - /* Now we can write in this page of kernel text... */ - *dst = (char) ch; - - /* Temporary PTE was non-cacheable; no flush needed. */ - set_pte(pgva, oldpte); - ICIA(); -} - -/* - * Write bytes to kernel address space for debugger. - */ -void -db_write_bytes(addr, size, data) - vm_offset_t addr; - int size; - char *data; -{ - extern char kernel_text[], etext[] ; - register char *dst = (char *)addr; - -#ifdef DEBUG - if (db_machdep_debug) - printf("db_write_bytes: addr=0x%x, size=%d ", addr, size); -#endif - - /* If any part is in kernel text, use db_write_text() */ - if ((dst < etext) && ((dst + size) > kernel_text)) { - /* This is slow, but is only used for breakpoints. */ -#ifdef DEBUG - if (db_machdep_debug) - printf("(in text)\n"); -#endif - while (size > 0) { - --size; - db_write_text(dst, *data); - dst++; data++; - } - return; - } - -#ifdef DEBUG - if (db_machdep_debug) - printf("(in data)\n"); -#endif - - if (size == 4) { - *((int*)addr) = *((int*)data); - return; - } - - if (size == 2) { - *((short*)addr) = *((short*)data); - return; - } - - while (size > 0) { - --size; - *dst++ = *data++; - } -} static char *pgt_names[] = { "MEM", "OBIO", "VMES", "VMEL" };