OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [remote-or1k.c] - Diff between revs 372 and 373

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 372 Rev 373
Line 164... Line 164...
/* Current register values.  */
/* Current register values.  */
unsigned int dmr1 = 0;
unsigned int dmr1 = 0;
unsigned int dmr2 = 0;
unsigned int dmr2 = 0;
unsigned int dsr = 0;
unsigned int dsr = 0;
unsigned int drr = 0;
unsigned int drr = 0;
 
//unsigned int npc = 0;
 
//unsigned int ppc = 0;
 
 
/* Current matchpoints.  */
/* Current matchpoints.  */
unsigned int dvr[MAX_MATCHPOINTS];
unsigned int dvr[MAX_MATCHPOINTS];
struct dcr_struct dcr[MAX_MATCHPOINTS];
struct dcr_struct dcr[MAX_MATCHPOINTS];
 
 
Line 734... Line 736...
{
{
  unsigned int pc;
  unsigned int pc;
  unsigned int ppc;
  unsigned int ppc;
  unsigned int npc;
  unsigned int npc;
  unsigned int val;
  unsigned int val;
 
  int two_steps = 0;
 
 
  pc = read_pc();
  pc = read_pc();
  npc = or1k_read_spr_reg (PC_SPRNUM);
  npc = or1k_read_spr_reg (PC_SPRNUM);
  ppc = or1k_read_spr_reg (PPC_SPRNUM);
  ppc = or1k_read_spr_reg (PPC_SPRNUM);
  debug ("pc = %08x BP = %x npc = %08x ppc = %08x\n", pc, breakpoint_here_p (pc), npc, ppc);
  debug ("pc = %08x BP = %x npc = %08x ppc = %08x\n", pc, breakpoint_here_p (pc), npc, ppc);
Line 752... Line 755...
  /* Clear reason register for later.  */
  /* Clear reason register for later.  */
  or1k_write_spr_reg (DRR_SPRNUM, 0);
  or1k_write_spr_reg (DRR_SPRNUM, 0);
 
 
  or1k_commit_debug_registers ();
  or1k_commit_debug_registers ();
 
 
  /* Else clause added by CZ 26/06/01 */
  if (step) {
  if (step)
    /* Always set program counter to branch instruction and reexecute it */
 
    if (insn_has_delay_slot (or1k_fetch_instruction (ppc)))
    {
    {
      /* HW STEP.  Set DMR1_ST.  */
        or1k_write_spr_reg (PC_SPRNUM, ppc);
      dmr1 |= DMR1_ST;
        two_steps = 1;
      or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
      }
      dmr1 &= ~DMR1_ST;
    else if (breakpoint_here_p (pc) && ((ppc + 4) != npc))
 
 
      if (breakpoint_here_p (pc) && ((ppc + 4) != npc))
 
       {
       {
          /* Trapped on delay slot instruction. */
          /* Trapped on delay slot instruction. */
          /* Set PC to branch insn preceding delay slot. */
          /* Set PC to branch insn preceding delay slot. */
          or1k_write_spr_reg (PC_SPRNUM, ppc - 4);
          or1k_write_spr_reg (PC_SPRNUM, ppc - 4);
 
        two_steps = 1;
 
      } else if (breakpoint_here_p (pc))
 
        or1k_write_spr_reg (PC_SPRNUM, pc);
 
 
          or1k_unstall ();
      /* HW STEP.  Set DMR1_ST.  */
 
      dmr1 |= DMR1_ST;
 
      or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
 
      dmr1 &= ~DMR1_ST;
 
 
          or1k_set_chain (SC_REGISTER);
      if (two_steps)
          val = or1k_read_reg (JTAG_RISCOP);
 
          do {
 
            val = or1k_read_reg (JTAG_RISCOP);
 
          } while ((val & 1) == 0);
 
        }
 
      else if (breakpoint_here_p (npc) && insn_has_delay_slot (or1k_fetch_instruction (ppc)))
 
        {
        {
          /* Steping to the trap insn in delay slot - we need to execute branch insn again */
 
          debug ("resume: steping to the trap insn in delay slot\n");
 
          or1k_write_spr_reg (PC_SPRNUM, ppc);
 
 
 
          or1k_unstall ();
          or1k_unstall ();
 
 
          or1k_set_chain (SC_REGISTER);
          or1k_set_chain (SC_REGISTER);
          val = or1k_read_reg (JTAG_RISCOP);
          val = or1k_read_reg (JTAG_RISCOP);
          do {
          do
            val = or1k_read_reg (JTAG_RISCOP);
            val = or1k_read_reg (JTAG_RISCOP);
          } while ((val & 1) == 0);
          while ((val & 1) == 0);
        }
        }
      else if (breakpoint_here_p (pc))
 
        or1k_write_spr_reg (PC_SPRNUM, pc);
 
    }
    }
  else
  else
    {
    {
      dmr1 &= ~DMR1_ST;
      dmr1 &= ~DMR1_ST;
      or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
      or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
 
      if (breakpoint_here_p (pc))
 
        or1k_write_spr_reg (PC_SPRNUM, pc);
    }
    }
 
 
  /* We can now continue normally, independent of step */
  /* We can now continue normally, independent of step */
  or1k_unstall ();
  or1k_unstall ();
  or1k_status = TARGET_RUNNING;
  or1k_status = TARGET_RUNNING;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.