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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_1_x/] [or1ksim/] [cpu/] [or1k/] [except.c] - Diff between revs 261 and 344

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

Rev 261 Rev 344
Line 22... Line 22...
#include <string.h>
#include <string.h>
 
 
#include "abstract.h"
#include "abstract.h"
#include "except.h"
#include "except.h"
#include "sprs.h"
#include "sprs.h"
 
#include "sim-config.h"
 
 
static void except_handle_backend(int,unsigned long,unsigned long);
static void except_handle_backend(int,unsigned long,unsigned long);
 
 
extern int cont_run;
extern int cont_run;
extern struct iqueue_entry iqueue[20];
extern struct iqueue_entry iqueue[20];
Line 135... Line 136...
  cycle_delay = 0;  /* An exception stalls the CPU 0 clock cycles */
  cycle_delay = 0;  /* An exception stalls the CPU 0 clock cycles */
}
}
 
 
static void except_handle_backend(int except, unsigned long ea, unsigned long pc_saved)
static void except_handle_backend(int except, unsigned long ea, unsigned long pc_saved)
{
{
 
  /* Ignore masked exceptions */
 
  if (! IS_NME(except) && (!(mfspr(SPR_SR) & SPR_SR_EXR))) {
 
    if (config.sim.verbose)
 
                  printf("INFO: Exception occured while exception detection was disabled.\n");
 
                return;
 
        }
      pending.valid = 0;
      pending.valid = 0;
      pending.type = 0;
      pending.type = 0;
      pending.address = 0;
      pending.address = 0;
      pending.saved = 0;
      pending.saved = 0;
 
 
#if ONLY_VIRTUAL_MACHINE
#if ONLY_VIRTUAL_MACHINE
        printf("WARNING: No exception processing while ONLY_VIRTUAL_MACHINE is defined.\n");
        fprintf(stderr, "WARNING: No exception processing while ONLY_VIRTUAL_MACHINE is defined.\n");
        cont_run = 0;
        cont_run = 0;
#else
#else
 
 
        if (delay_insn) {
        if (delay_insn) {
                printf(" INFO: Exception during execution of delay slot insn.\n");
                printf(" INFO: Exception during execution of delay slot insn.\n");
Line 158... Line 165...
                decode(&iqueue[0]);                                      /* (itlbmiss is special case) */
                decode(&iqueue[0]);                                      /* (itlbmiss is special case) */
                execute();
                execute();
        }
        }
#endif
#endif
 
 
  if (! IS_NME(except) && (!(mfspr(SPR_SR) & SPR_SR_EXR))) {
 
                printf("ABORT: Exception occured while exception detection was disabled.\n");
 
                cont_run = 0;
 
                return;
 
        }
 
 
 
        pc_saved = pc & ~0x3;
        pc_saved = pc & ~0x3;
        mtspr(SPR_EPCR_BASE, pc_saved);
        mtspr(SPR_EPCR_BASE, pc_saved);
        mtspr(SPR_EEAR_BASE, ea);
        mtspr(SPR_EEAR_BASE, ea);
        mtspr(SPR_ESR_BASE, mfspr(SPR_SR));
        mtspr(SPR_ESR_BASE, mfspr(SPR_SR));
 
 

powered by: WebSVN 2.1.0

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