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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [sim/] [ppc/] [interrupts.h] - Diff between revs 835 and 841

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 835 Rev 841
/*  This file is part of the program psim.
/*  This file is part of the program psim.
 
 
    Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
    Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
 
 
    This program is free software; you can redistribute it and/or modify
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    (at your option) any later version.
 
 
    This program is distributed in the hope that it will be useful,
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    GNU General Public License for more details.
 
 
    You should have received a copy of the GNU General Public License
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 
    */
    */
 
 
 
 
#ifndef _INTERRUPTS_H_
#ifndef _INTERRUPTS_H_
#define _INTERRUPTS_H_
#define _INTERRUPTS_H_
 
 
/* Interrupts:
/* Interrupts:
 
 
   The code below handles two different types of interrupts.
   The code below handles two different types of interrupts.
   Synchronous and Asynchronous.
   Synchronous and Asynchronous.
 
 
   Synchronous:
   Synchronous:
 
 
   Interrupts that must immediately force either an abort or restart
   Interrupts that must immediately force either an abort or restart
   of a current instruction are implemented by forcing an instruction
   of a current instruction are implemented by forcing an instruction
   restart. (or to put it another way, long jump).  In looking at the
   restart. (or to put it another way, long jump).  In looking at the
   code it may occure to you that, for some interrupts, they could
   code it may occure to you that, for some interrupts, they could
   return instead of restarting the cpu (eg system_call).  While true
   return instead of restarting the cpu (eg system_call).  While true
   (it once was like that) I've decided to make the behavour of all
   (it once was like that) I've decided to make the behavour of all
   interrupt routines roughly identical.
   interrupt routines roughly identical.
 
 
   Because, a cpu's recorded state (ie what is in the cpu structure)
   Because, a cpu's recorded state (ie what is in the cpu structure)
   is allowed to lag behind the cpu's true current state (eg PC not
   is allowed to lag behind the cpu's true current state (eg PC not
   updated) sycnronous interrupt handers are parameterized with the
   updated) sycnronous interrupt handers are parameterized with the
   the cpu being interrupted so that, as part of moddeling the
   the cpu being interrupted so that, as part of moddeling the
   interrupt, the cpu's state can be updated.
   interrupt, the cpu's state can be updated.
 
 
   Asynchronous:
   Asynchronous:
 
 
   Interrupts such as reset or external exception are delivered using
   Interrupts such as reset or external exception are delivered using
   more normal (returning) functions.  It is assumed that these
   more normal (returning) functions.  It is assumed that these
   functions are called out side of the normal processor execution
   functions are called out side of the normal processor execution
   cycle. */
   cycle. */
 
 
 
 
/* Software generated interrupts.
/* Software generated interrupts.
 
 
   The below are generated by software driven events.  For instance,
   The below are generated by software driven events.  For instance,
   an invalid instruction or access (virtual or physical) to an
   an invalid instruction or access (virtual or physical) to an
   invalid address */
   invalid address */
 
 
typedef enum {
typedef enum {
  direct_store_storage_interrupt,
  direct_store_storage_interrupt,
  hash_table_miss_storage_interrupt,
  hash_table_miss_storage_interrupt,
  protection_violation_storage_interrupt,
  protection_violation_storage_interrupt,
  earwax_violation_storage_interrupt,
  earwax_violation_storage_interrupt,
  segment_table_miss_storage_interrupt,
  segment_table_miss_storage_interrupt,
  earwax_disabled_storage_interrupt,
  earwax_disabled_storage_interrupt,
  vea_storage_interrupt,
  vea_storage_interrupt,
} storage_interrupt_reasons;
} storage_interrupt_reasons;
 
 
 
 
INLINE_INTERRUPTS\
INLINE_INTERRUPTS\
(void) data_storage_interrupt
(void) data_storage_interrupt
(cpu *processor,
(cpu *processor,
 unsigned_word cia,
 unsigned_word cia,
 unsigned_word ea,
 unsigned_word ea,
 storage_interrupt_reasons reason,
 storage_interrupt_reasons reason,
 int is_store);
 int is_store);
 
 
INLINE_INTERRUPTS\
INLINE_INTERRUPTS\
(void) instruction_storage_interrupt
(void) instruction_storage_interrupt
(cpu *processor,
(cpu *processor,
 unsigned_word cia,
 unsigned_word cia,
 storage_interrupt_reasons reason);
 storage_interrupt_reasons reason);
 
 
INLINE_INTERRUPTS\
INLINE_INTERRUPTS\
(void) alignment_interrupt
(void) alignment_interrupt
(cpu *processor,
(cpu *processor,
 unsigned_word cia,
 unsigned_word cia,
 unsigned_word ra);
 unsigned_word ra);
 
 
typedef enum {
typedef enum {
  floating_point_enabled_program_interrupt,
  floating_point_enabled_program_interrupt,
  illegal_instruction_program_interrupt,
  illegal_instruction_program_interrupt,
  privileged_instruction_program_interrupt,
  privileged_instruction_program_interrupt,
  trap_program_interrupt,
  trap_program_interrupt,
  optional_instruction_program_interrupt, /* subset of illegal instruction */
  optional_instruction_program_interrupt, /* subset of illegal instruction */
  mpc860c0_instruction_program_interrupt, /* fwd br, taken but not predicted, near EO page */
  mpc860c0_instruction_program_interrupt, /* fwd br, taken but not predicted, near EO page */
  nr_program_interrupt_reasons
  nr_program_interrupt_reasons
} program_interrupt_reasons;
} program_interrupt_reasons;
 
 
INLINE_INTERRUPTS\
INLINE_INTERRUPTS\
(void) program_interrupt
(void) program_interrupt
(cpu *processor,
(cpu *processor,
 unsigned_word cia,
 unsigned_word cia,
 program_interrupt_reasons reason);
 program_interrupt_reasons reason);
 
 
INLINE_INTERRUPTS\
INLINE_INTERRUPTS\
(void) floating_point_unavailable_interrupt
(void) floating_point_unavailable_interrupt
(cpu *processor,
(cpu *processor,
 unsigned_word cia);
 unsigned_word cia);
 
 
INLINE_INTERRUPTS\
INLINE_INTERRUPTS\
(void) system_call_interrupt
(void) system_call_interrupt
(cpu *processor,
(cpu *processor,
 unsigned_word cia);
 unsigned_word cia);
 
 
INLINE_INTERRUPTS\
INLINE_INTERRUPTS\
(void) floating_point_assist_interrupt
(void) floating_point_assist_interrupt
(cpu *processor,
(cpu *processor,
 unsigned_word cia);
 unsigned_word cia);
 
 
INLINE_INTERRUPTS\
INLINE_INTERRUPTS\
(void) machine_check_interrupt
(void) machine_check_interrupt
(cpu *processor,
(cpu *processor,
 unsigned_word cia);
 unsigned_word cia);
 
 
/* Hardware generated interrupts:
/* Hardware generated interrupts:
 
 
   These asynchronous hardware generated interrupts may be called at
   These asynchronous hardware generated interrupts may be called at
   any time.  It is the responsibility of this (the interrupts) module
   any time.  It is the responsibility of this (the interrupts) module
   to ensure that interrupts are delivered correctly (when possible).
   to ensure that interrupts are delivered correctly (when possible).
   The delivery of these interrupts is controlled by the MSR's
   The delivery of these interrupts is controlled by the MSR's
   external interrupt enable bit.  When ever the MSR's value is
   external interrupt enable bit.  When ever the MSR's value is
   changed, the processor must call the check_masked_interrupts()
   changed, the processor must call the check_masked_interrupts()
   function in case delivery has been made possible.
   function in case delivery has been made possible.
 
 
   decrementer_interrupt is `edge' sensitive.  Multiple edges arriving
   decrementer_interrupt is `edge' sensitive.  Multiple edges arriving
   before the first edge has been delivered result in only one
   before the first edge has been delivered result in only one
   interrupt.
   interrupt.
 
 
   external_interrupt is `level' sensitive.  An external interrupt
   external_interrupt is `level' sensitive.  An external interrupt
   will only be delivered when the external interrupt port is
   will only be delivered when the external interrupt port is
   `asserted'. While interrupts are disabled, the external interrupt
   `asserted'. While interrupts are disabled, the external interrupt
   can be asserted and then de-asserted without an interrupt
   can be asserted and then de-asserted without an interrupt
   eventually being delivered. */
   eventually being delivered. */
 
 
enum {
enum {
  external_interrupt_pending = 1,
  external_interrupt_pending = 1,
  decrementer_interrupt_pending = 2,
  decrementer_interrupt_pending = 2,
};
};
 
 
typedef struct _interrupts {
typedef struct _interrupts {
  event_entry_tag delivery_scheduled;
  event_entry_tag delivery_scheduled;
  int pending_interrupts;
  int pending_interrupts;
} interrupts;
} interrupts;
 
 
INLINE_INTERRUPTS\
INLINE_INTERRUPTS\
(void) check_masked_interrupts
(void) check_masked_interrupts
(cpu *processor);
(cpu *processor);
 
 
INLINE_INTERRUPTS\
INLINE_INTERRUPTS\
(void) decrementer_interrupt
(void) decrementer_interrupt
(cpu *processor);
(cpu *processor);
 
 
INLINE_INTERRUPTS\
INLINE_INTERRUPTS\
(void) external_interrupt
(void) external_interrupt
(cpu *processor,
(cpu *processor,
 int is_asserted);
 int is_asserted);
 
 
#endif /* _INTERRUPTS_H_ */
#endif /* _INTERRUPTS_H_ */
 
 

powered by: WebSVN 2.1.0

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