From a1d3be118e2e98489a7c39c6f31243dc4d91f96e Mon Sep 17 00:00:00 2001 From: glass Date: Tue, 10 Aug 1993 08:42:34 +0000 Subject: [PATCH] fixed problem that caused two consecutive segments to be using the same pmeg unknowingly. still too many printfs, not sure how many are actualy in the machine dependent code. reaches cpu_startup() where it stops deliberately. next project: autoconfig(), maybe kgdb --- sys/arch/m68k/include/db_machdep.h | 11 +++++++++-- sys/arch/m68k/m68k/db_interface.c | 18 +++++++++++++++--- sys/arch/m68k/m68k/db_trace.c | 14 ++++++++++---- sys/arch/sun3/include/asm.h | 3 ++- sys/arch/sun3/include/db_machdep.h | 11 +++++++++-- sys/arch/sun3/include/trap.h | 2 ++ sys/arch/sun3/sun3/db_interface.c | 18 +++++++++++++++--- sys/arch/sun3/sun3/db_trace.c | 14 ++++++++++---- sys/arch/sun3/sun3/interrupt.s | 18 +++++++++--------- sys/arch/sun3/sun3/m68k.s | 30 +++++++++++++++++++++++++++++- sys/arch/sun3/sun3/machdep.c | 5 +++++ sys/arch/sun3/sun3/pmap.c | 13 +++++++++---- 12 files changed, 124 insertions(+), 33 deletions(-) diff --git a/sys/arch/m68k/include/db_machdep.h b/sys/arch/m68k/include/db_machdep.h index 1940f7a6df6d..2ea4b39e7b06 100644 --- a/sys/arch/m68k/include/db_machdep.h +++ b/sys/arch/m68k/include/db_machdep.h @@ -26,9 +26,15 @@ /* * HISTORY * $Log: db_machdep.h,v $ - * Revision 1.1 1993/08/08 12:18:27 glass - * various changes + * Revision 1.2 1993/08/10 08:42:37 glass + * fixed problem that caused two consecutive segments to be using the same + * pmeg unknowingly. still too many printfs, not sure how many are actualy + * in the machine dependent code. reaches cpu_startup() where it stops + * deliberately. next project: autoconfig(), maybe kgdb * + * Revision 1.1 93/08/08 12:18:27 glass + * various changes + * * Revision 2.5 91/07/31 18:12:56 dbg * Changed register save area name. * [91/07/12 dbg] @@ -101,6 +107,7 @@ db_regs_t ddb_regs; /* register state */ #define FIXUP_PC_AFTER_BREAK ddb_regs.pc -= 2; +#define SR_T1 0x8000 #define db_clear_single_step(regs) ((regs)->sr &= ~SR_T1) #define db_set_single_step(regs) ((regs)->sr |= SR_T1) diff --git a/sys/arch/m68k/m68k/db_interface.c b/sys/arch/m68k/m68k/db_interface.c index b837f47458b1..3f115ff24040 100644 --- a/sys/arch/m68k/m68k/db_interface.c +++ b/sys/arch/m68k/m68k/db_interface.c @@ -26,9 +26,15 @@ /* * HISTORY * $Log: db_interface.c,v $ - * Revision 1.1 1993/08/08 12:22:06 glass - * lots of changes, too many printfs + * Revision 1.2 1993/08/10 08:42:52 glass + * fixed problem that caused two consecutive segments to be using the same + * pmeg unknowingly. still too many printfs, not sure how many are actualy + * in the machine dependent code. reaches cpu_startup() where it stops + * deliberately. next project: autoconfig(), maybe kgdb * + * Revision 1.1 93/08/08 12:22:06 glass + * lots of changes, too many printfs + * * Revision 2.6 92/01/03 20:31:01 dbg * Ignore RB_KDB - always enter DDB. * [91/11/06 dbg] @@ -153,7 +159,8 @@ kdb_trap(type, regs) } extern char * trap_type[]; -extern int TRAP_TYPES; +#define TRAP_TYPES 15 +/*extern int TRAP_TYPES;*/ /* * Print trap reason. @@ -237,3 +244,8 @@ db_write_bytes(addr, size, data) #endif } +int +Debugger() +{ + asm ("trap #15"); +} diff --git a/sys/arch/m68k/m68k/db_trace.c b/sys/arch/m68k/m68k/db_trace.c index 5657e65fe2c6..e959b47c0efc 100644 --- a/sys/arch/m68k/m68k/db_trace.c +++ b/sys/arch/m68k/m68k/db_trace.c @@ -26,9 +26,15 @@ /* * HISTORY * $Log: db_trace.c,v $ - * Revision 1.1 1993/08/08 12:22:09 glass - * lots of changes, too many printfs + * Revision 1.2 1993/08/10 08:42:55 glass + * fixed problem that caused two consecutive segments to be using the same + * pmeg unknowingly. still too many printfs, not sure how many are actualy + * in the machine dependent code. reaches cpu_startup() where it stops + * deliberately. next project: autoconfig(), maybe kgdb * + * Revision 1.1 93/08/08 12:22:09 glass + * lots of changes, too many printfs + * * Revision 2.5 91/10/09 16:17:23 af * Added parens in initializers for db_regs. * [91/10/07 af] @@ -76,7 +82,7 @@ #include #define jmp_buf_t jmp_buf -extern jmp_buf_t *db_recover; +jmp_buf_t *db_recover; /* * Register list @@ -284,7 +290,7 @@ findentry( sp ) jmp_buf_t db_jmpbuf; jmp_buf_t *savejmp = db_recover; - if (_setjmp(db_recover = &db_jmpbuf)) { + if (setjmp(db_recover = &db_jmpbuf)) { /* oops -- we touched something we ought not to have */ /* cannot trace caller of "start" */ sp->k_entry = MAXINT; diff --git a/sys/arch/sun3/include/asm.h b/sys/arch/sun3/include/asm.h index 4cb47bcd3b0c..684b722fed92 100644 --- a/sys/arch/sun3/include/asm.h +++ b/sys/arch/sun3/include/asm.h @@ -55,6 +55,7 @@ #endif #define _ASM_FUNC(x) x +#define ALIGN_TEXT .align 2 #ifdef GPROF # define _BEGIN_ENTRY # define _END_ENTRY link a6,#0; jbsr mcount; unlk a6 ; @@ -65,7 +66,7 @@ # define _ENTER_FUNC(x) ; #endif -#define _ENTRY(x) .globl x; x: +#define _ENTRY(x) .globl x; ALIGN_TEXT; x: #define ENTRY(y) _BEGIN_ENTRY; _ENTRY(_C_FUNC(y)); _END_ENTRY #define TWOENTRY(y,z) _BEGIN_ENTRY; _ENTRY(_C_FUNC(z)); _END_ENTRY \ diff --git a/sys/arch/sun3/include/db_machdep.h b/sys/arch/sun3/include/db_machdep.h index 1940f7a6df6d..2ea4b39e7b06 100644 --- a/sys/arch/sun3/include/db_machdep.h +++ b/sys/arch/sun3/include/db_machdep.h @@ -26,9 +26,15 @@ /* * HISTORY * $Log: db_machdep.h,v $ - * Revision 1.1 1993/08/08 12:18:27 glass - * various changes + * Revision 1.2 1993/08/10 08:42:37 glass + * fixed problem that caused two consecutive segments to be using the same + * pmeg unknowingly. still too many printfs, not sure how many are actualy + * in the machine dependent code. reaches cpu_startup() where it stops + * deliberately. next project: autoconfig(), maybe kgdb * + * Revision 1.1 93/08/08 12:18:27 glass + * various changes + * * Revision 2.5 91/07/31 18:12:56 dbg * Changed register save area name. * [91/07/12 dbg] @@ -101,6 +107,7 @@ db_regs_t ddb_regs; /* register state */ #define FIXUP_PC_AFTER_BREAK ddb_regs.pc -= 2; +#define SR_T1 0x8000 #define db_clear_single_step(regs) ((regs)->sr &= ~SR_T1) #define db_set_single_step(regs) ((regs)->sr |= SR_T1) diff --git a/sys/arch/sun3/include/trap.h b/sys/arch/sun3/include/trap.h index 1bbad51c7258..cc9a2f7f65ec 100644 --- a/sys/arch/sun3/include/trap.h +++ b/sys/arch/sun3/include/trap.h @@ -60,6 +60,8 @@ #define T_COPERR 12 #define T_ASTFLT 13 #define T_TRAP15 15 +#define T_BRKPT T_TRAP15 +#define T_WATCHPOINT 16 #define T_USER 0x80 /* user-mode flag or'ed with type */ diff --git a/sys/arch/sun3/sun3/db_interface.c b/sys/arch/sun3/sun3/db_interface.c index b837f47458b1..3f115ff24040 100644 --- a/sys/arch/sun3/sun3/db_interface.c +++ b/sys/arch/sun3/sun3/db_interface.c @@ -26,9 +26,15 @@ /* * HISTORY * $Log: db_interface.c,v $ - * Revision 1.1 1993/08/08 12:22:06 glass - * lots of changes, too many printfs + * Revision 1.2 1993/08/10 08:42:52 glass + * fixed problem that caused two consecutive segments to be using the same + * pmeg unknowingly. still too many printfs, not sure how many are actualy + * in the machine dependent code. reaches cpu_startup() where it stops + * deliberately. next project: autoconfig(), maybe kgdb * + * Revision 1.1 93/08/08 12:22:06 glass + * lots of changes, too many printfs + * * Revision 2.6 92/01/03 20:31:01 dbg * Ignore RB_KDB - always enter DDB. * [91/11/06 dbg] @@ -153,7 +159,8 @@ kdb_trap(type, regs) } extern char * trap_type[]; -extern int TRAP_TYPES; +#define TRAP_TYPES 15 +/*extern int TRAP_TYPES;*/ /* * Print trap reason. @@ -237,3 +244,8 @@ db_write_bytes(addr, size, data) #endif } +int +Debugger() +{ + asm ("trap #15"); +} diff --git a/sys/arch/sun3/sun3/db_trace.c b/sys/arch/sun3/sun3/db_trace.c index 5657e65fe2c6..e959b47c0efc 100644 --- a/sys/arch/sun3/sun3/db_trace.c +++ b/sys/arch/sun3/sun3/db_trace.c @@ -26,9 +26,15 @@ /* * HISTORY * $Log: db_trace.c,v $ - * Revision 1.1 1993/08/08 12:22:09 glass - * lots of changes, too many printfs + * Revision 1.2 1993/08/10 08:42:55 glass + * fixed problem that caused two consecutive segments to be using the same + * pmeg unknowingly. still too many printfs, not sure how many are actualy + * in the machine dependent code. reaches cpu_startup() where it stops + * deliberately. next project: autoconfig(), maybe kgdb * + * Revision 1.1 93/08/08 12:22:09 glass + * lots of changes, too many printfs + * * Revision 2.5 91/10/09 16:17:23 af * Added parens in initializers for db_regs. * [91/10/07 af] @@ -76,7 +82,7 @@ #include #define jmp_buf_t jmp_buf -extern jmp_buf_t *db_recover; +jmp_buf_t *db_recover; /* * Register list @@ -284,7 +290,7 @@ findentry( sp ) jmp_buf_t db_jmpbuf; jmp_buf_t *savejmp = db_recover; - if (_setjmp(db_recover = &db_jmpbuf)) { + if (setjmp(db_recover = &db_jmpbuf)) { /* oops -- we touched something we ought not to have */ /* cannot trace caller of "start" */ sp->k_entry = MAXINT; diff --git a/sys/arch/sun3/sun3/interrupt.s b/sys/arch/sun3/sun3/interrupt.s index ab6210817027..402991873b00 100644 --- a/sys/arch/sun3/sun3/interrupt.s +++ b/sys/arch/sun3/sun3/interrupt.s @@ -8,15 +8,15 @@ _intrcnt: .text -#define INTERRUPT_HANDLE(interrupt num) \ - addql #1,_intrcnt+interrupt_num \ - movw sr,sp@- | push current SR value \ - clrw sp@- | padded to longword \ - jbsr _intrhand | handle interrupt \ - addql #4,sp | pop SR - moveml sp@+,#0x0303 \ - addql #2,sp \ - addql #1, _cnt+V_INTR \ +#define INTERRUPT_HANDLE(interrupt_num) \ + addql #1,_intrcnt+interrupt_num ;\ + movw sr,sp@- ; /* push current SR value */\ + clrw sp@- ; /* padded to longword */\ + jbsr _intrhand ; /* handle interrupt */\ + addql #4,sp ; /* pop SR */\ + moveml sp@+,#0x0303 ; \ + addql #2,sp ; \ + addql #1, _cnt+V_INTR ; \ jra rei .globl _level1intr, _level2intr, _level3intr, _level4intr diff --git a/sys/arch/sun3/sun3/m68k.s b/sys/arch/sun3/sun3/m68k.s index 36af5dda989d..57515125e037 100644 --- a/sys/arch/sun3/sun3/m68k.s +++ b/sys/arch/sun3/sun3/m68k.s @@ -75,17 +75,45 @@ ENTRY(set_control_word) * * [I don't think the ENTRY() macro will do the right thing with this -- glass] */ - .globl _getsp + .globl _getsp; .align 2 _getsp: movl sp,d0 | get current SP addql #4,d0 | compensate for return address rts .globl _getsfc, _getdfc +.align 2 _getsfc: movc sfc,d0 rts +.align 2 _getdfc: movc dfc,d0 rts + +/* + * non-local gotos + */ +ENTRY(setjmp) + movl sp@(4),a0 | savearea pointer + moveml #0xFCFC,a0@ | save d2-d7/a2-a7 + movl sp@,a0@(48) | and return address + moveq #0,d0 | return 0 + rts + +ENTRY(qsetjmp) + movl sp@(4),a0 | savearea pointer + lea a0@(40),a0 | skip regs we do not save + movl a6,a0@+ | save FP + movl sp,a0@+ | save SP + movl sp@,a0@ | and return address + moveq #0,d0 | return 0 + rts + +ENTRY(longjmp) + movl sp@(4),a0 + moveml a0@+,#0xFCFC + movl a0@,sp@ + moveq #1,d0 + rts diff --git a/sys/arch/sun3/sun3/machdep.c b/sys/arch/sun3/sun3/machdep.c index 6bafc767204c..a7059146ad49 100644 --- a/sys/arch/sun3/sun3/machdep.c +++ b/sys/arch/sun3/sun3/machdep.c @@ -28,8 +28,10 @@ #include "machine/pte.h" #include "machine/mon.h" +#include "machine/isr.h" #include "net/netisr.h" + char kstack[NBPG]; /* totally bogus */ struct proc *proc0paddr = &proc0; @@ -721,6 +723,7 @@ netintr() intrhand(sr) int sr; { +#if 0 register struct isr *isr; register int found = 0; register int ipl; @@ -753,4 +756,6 @@ intrhand(sr) printf("intrhand: unexpected sr 0x%x\n", sr); break; } +#endif } + diff --git a/sys/arch/sun3/sun3/pmap.c b/sys/arch/sun3/sun3/pmap.c index 2416645bb54b..dae3634d8836 100644 --- a/sys/arch/sun3/sun3/pmap.c +++ b/sys/arch/sun3/sun3/pmap.c @@ -473,14 +473,19 @@ pmeg_t pmeg_allocate_invalid(pmap, va) } pmap_remove_range(pmegp->pmeg_owner, pmegp->pmeg_va, pmegp->pmeg_va+NBSG); - } + } else + panic("pmeg_allocate_invalid: failed\n"); + if (!pmegp) + panic("pmeg_allocate_invalid: unable to allocate pmeg"); pmegp->pmeg_owner = pmap; pmegp->pmeg_owner_version = pmap->pm_version; pmegp->pmeg_va = va; pmegp->pmeg_wired_count = 0; pmegp->pmeg_reserved = 0; pmegp->pmeg_vpages = 0; - pmegp = (pmeg_t) enqueue_tail(&pmeg_active_queue, pmegp); + enqueue_tail(&pmeg_active_queue, pmegp); + printf("pmeg_allocate_invalid: pmeg %d allocated to pmap %x\n", + pmegp->pmeg_index, pmap); return pmegp; } @@ -1261,14 +1266,14 @@ add_pte: /* can be destructive */ if (mem_type & PG_TYPE) set_pte(va, pte_proto | PG_NC); else { - printf("before pv_link\n"); nflags = pv_link(kernel_pmap, pa, va, PG_TO_PV_FLAGS(pte_proto)); - printf("after pv_link\n"); if (nflags & PV_NC) set_pte(va, pte_proto | PG_NC); else set_pte(va, pte_proto); } + printf("pmap_enter_kernel: va: %x pa: %x pte_proto: %x\n", va, pa, + pte_proto); pmegp->pmeg_vpages++; /* assumes pmap_enter can never insert a non-valid page*/ splx(s);