kdb
[Top] [All Lists]

SMP patche i386

To: jim.houston@xxxxxxxxx, kdb@xxxxxxxxxxx, ethan@xxxxxxxxxxxxxxx
Subject: SMP patche i386
From: Jim Houston <jhouston2@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 2 May 2002 23:50:17 -0400
Sender: owner-kdb@xxxxxxxxxxx
Hi!

I picked up Ethan Solomita's changes and did the first cut at getting
it to work on the i386.  I have attached the patch for kdba_bp.c.
There are still a few rough edges but I ran it through a bunch
several breakpoints on my old dual Pentium Pro and it kept going.

I still worry about access to kdb_state. I was thinking it would be
nice to separate the flags that are used for synchronization from those
that are only of interest to the local processor.  This would make it
clearer where we need to have to have spinlocks or other magic.

Jim Houston - Concurrent Computer Corp.

--

diff -urN old/arch/i386/kdb/kdba_bp.c new/arch/i386/kdb/kdba_bp.c
--- old/arch/i386/kdb/kdba_bp.c Thu May  2 22:23:52 2002
+++ new/arch/i386/kdb/kdba_bp.c Thu May  2 22:23:42 2002
@@ -95,43 +95,6 @@
        if (KDB_DEBUG(BP))
                kdb_printf("kdb: dr6 0x%lx dr7 0x%lx\n", dr6, dr7);
        if (dr6 & DR6_BS) {
-               if (KDB_STATE(SSBPT)) {
-                       if (KDB_DEBUG(BP))
-                               kdb_printf("ssbpt\n");
-                       KDB_STATE_CLEAR(SSBPT);
-                       for(i=0,bp=kdb_breakpoints;
-                           i < KDB_MAXBPT;
-                           i++, bp++) {
-                               if (KDB_DEBUG(BP))
-                                       kdb_printf("bp 0x%p enabled %d delayed 
%d global %d cpu %d\n",
-                                                  bp, bp->bp_enabled, 
bp->bp_delayed, bp->bp_global, bp->bp_cpu);
-                               if (!bp->bp_enabled)
-                                       continue;
-                               if (!bp->bp_global && bp->bp_cpu != 
smp_processor_id())
-                                       continue;
-                               if (KDB_DEBUG(BP))
-                                       kdb_printf("bp for this cpu\n");
-                               if (bp->bp_delayed) {
-                                       bp->bp_delayed = 0;
-                                       if (KDB_DEBUG(BP))
-                                               kdb_printf("kdba_installbp\n");
-                                       kdba_installbp(ef, bp);
-                                       if (!KDB_STATE(DOING_SS)) {
-                                               ef->eflags &= ~EF_TF;
-                                               return(KDB_DB_SSBPT);
-                                       }
-                                       break;
-                               }
-                       }
-                       if (i == KDB_MAXBPT) {
-                               kdb_printf("kdb: Unable to find delayed 
breakpoint\n");
-                       }
-                       if (!KDB_STATE(DOING_SS)) {
-                               ef->eflags &= ~EF_TF;
-                               return(KDB_DB_NOBPT);
-                       }
-                       /* FALLTHROUGH */
-               }
 
                /*
                 * KDB_STATE_DOING_SS is set when the kernel debugger is using
@@ -143,6 +106,16 @@
                if (!KDB_STATE(DOING_SS))
                        goto unknown;
 
+               if (KDB_STATE(DOING_SSBPT)) {
+                       if (KDB_DEBUG(BP))
+                               kdb_printf("ssbpt\n");
+                       KDB_STATE_CLEAR(DOING_SS);
+                       KDB_STATE_CLEAR(DOING_SSBPT);
+                       /* do we need to restore EF_IE? */
+                       ef->eflags &= ~EF_TF;
+                       return(KDB_DB_SSBPT);
+               }
+
                /* single step */
                rv = KDB_DB_SS;         /* Indicate single step */
                if (KDB_STATE(DOING_SSB)) {
@@ -321,7 +294,7 @@
                                  i, ef->eip);
                        kdb_id1(ef->eip);
                        rv = KDB_DB_BPT;
-                       bp->bp_delay = 1;
+                       KDB_STATE_SET(NEED_SSBPT);
                        break;
                }
        }
@@ -330,56 +303,6 @@
 }
 
 /*
- * kdba_handle_bp
- *
- *     Handle an instruction-breakpoint trap.  Called when re-installing
- *     an enabled breakpoint which has has the bp_delay bit set.
- *
- * Parameters:
- * Returns:
- * Locking:
- * Remarks:
- *
- * Ok, we really need to:
- *     1) Restore the original instruction byte
- *     2) Single Step
- *     3) Restore breakpoint instruction
- *     4) Continue.
- *
- *
- */
-
-static void
-kdba_handle_bp(kdb_eframe_t ef, kdb_bp_t *bp)
-{
-       if (!ef) {
-               kdb_printf("kdba_handle_bp: ef == NULL\n");
-               return;
-       }
-
-       if (KDB_DEBUG(BP))
-               kdb_printf("ef->eip = 0x%lx\n", ef->eip);
-
-       /*
-        * Setup single step
-        */
-       kdba_setsinglestep(ef);
-
-       /* KDB_STATE_SSBPT is set when the kernel debugger must single step
-        * a task in order to re-establish an instruction breakpoint which
-        * uses the instruction replacement mechanism. 
-        */
-       KDB_STATE_SET(SSBPT);
-
-       /*
-        * Reset delay attribute
-        */
-       bp->bp_delay = 0;
-       bp->bp_delayed = 1;
-}
-
-
-/*
  * kdba_bptype
  *
  *     Return a string describing type of breakpoint.
@@ -714,10 +637,6 @@
                                kdb_printf("kdba_installbp hardware reg %ld at 
" kdb_bfd_vma_fmt "\n",
                                           bp->bp_hard->bph_reg, bp->bp_addr);
                        }
-               } else if (bp->bp_delay) {
-                       if (KDB_DEBUG(BP))
-                               kdb_printf("kdba_installbp delayed bp\n");
-                       kdba_handle_bp(ef, bp);
                } else {
                        if (kdb_getarea_size(&(bp->bp_inst), bp->bp_addr, 1) ||
                            kdb_putword(bp->bp_addr, 
IA32_BREAKPOINT_INSTRUCTION, 1)) {

<Prev in Thread] Current Thread [Next in Thread>