public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Chris Morrow <cmorrow@YottaYotta.com>
To: 'eCos mailing list' <ecos-discuss@sources.redhat.com>
Subject: [ECOS] RM7000 interrupt handling
Date: Mon, 30 Jul 2001 16:39:00 -0000	[thread overview]
Message-ID: <3B65F068.E2A4234D@YottaYotta.com> (raw)
In-Reply-To: <3B65C7A3.77EE0FF1@redhat.com>

For the mips architecture HAL_INTERRUPT_MASK is defined as
follows;

#define HAL_INTERRUPT_MASK( _vector_ )          \
CYG_MACRO_START                                 \
    asm volatile (                              \
        "mfc0   $3,$12\n"                       \
        "la     $2,0x00000400\n"                \
        "sllv   $2,$2,%0\n"                     \
        "nor    $2,$2,$0\n"                     \
        "and    $3,$3,$2\n"                     \
        "mtc0   $3,$12\n"                       \
        "nop; nop; nop\n"                       \
        :                                       \
        : "r"(_vector_)                         \
        : "$2", "$3"                            \
        );                                      \
CYG_MACRO_END

It is possible to get an interrupt between the mfco and mtco.
As long as the status register is not modified as part of
interrupt processing this is not a problem.

Recently the following was added at the end of
_default_interrupt handler in vectors.S
#ifndef CYG_HAL_MIPS_R3900	
	# Keep the current settings of the IM[7:0] bits within the status
	# register.  These may be used as interrupt masks, so if an ISR or
	# DSR masks interrupts they must be preserved.
	# If they are not used, then this does no harm.
	ori	k0,zero,0xff00
	nor	k0,k0,k0			# 0xffff00ff
	and	k1,k1,k0			# all interrupts disabled

	mfc0	k0,status			# V0 = current SR
	nop
	nop
	andi	k0,k0,0xff00			# preserve interrupt set
	or	k1,k1,k0			# insert into "saved SR"
#endif

Consider the following scenario;

Suppose status register has interrupts 1 & 2 are unmasked
- first half of HAL_INTERRUPT_MASK for interrupt 1 is executed,
  r3 has copy of status register with 1 & 2 masked
- interrupt 2 occurs
- ISR masks off interrupt 2 in status register
- interrupt returns; status register has interrupt 1 unmasked
- second half of HAL_INTERRUPT_MASK executes; r3 has interrupt
  1 masked, 2 is still unmasked. r3 is copied to status register.

We have just lost the masking of interrupt 2.

Does this make sense to people?


-- 
Chris Morrow	YottaYotta Inc. email: cmorrow@yottayotta.com
phone: (780) 989 6814 web:	http:  //www.yottayotta.com

  reply	other threads:[~2001-07-30 16:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-30  7:47 [ECOS] i386 TARGET network programming Trenton D. Adams
2001-07-30 11:59 ` Jonathan Larmour
2001-07-30 12:14   ` Trenton D. Adams
2001-07-30 12:20     ` Jonathan Larmour
2001-07-30 12:34       ` Trenton D. Adams
2001-07-30 12:42         ` Jonathan Larmour
2001-07-30 12:46           ` Trenton D. Adams
2001-07-30 12:57             ` Jonathan Larmour
2001-07-30 13:01               ` Trenton D. Adams
2001-07-30 13:44               ` Trenton D. Adams
2001-07-30 13:46                 ` Jonathan Larmour
2001-07-30 16:39                   ` Chris Morrow [this message]
2001-07-31  5:53                     ` [ECOS] RM7000 interrupt handling Hugo Tyson
2001-07-31  6:13                       ` Mark Salter
2001-07-31  7:17                         ` Robin Farine
2001-07-31  9:43                           ` Hugo Tyson
2001-07-31  9:59                             ` Robin Farine
2001-07-31 10:28                             ` Chris Morrow
2001-07-31 11:08                               ` Hugo Tyson
2001-08-02  6:32                           ` Hugo Tyson
2001-08-02  7:47                             ` Robin Farine
2001-08-02  8:08                               ` Hugo Tyson
2001-07-30 16:47       ` [ECOS] i386 TARGET network programming Fabrice Gautier
2001-07-31 14:33         ` Jonathan Larmour
2001-07-31 14:36           ` Jonathan Larmour
2001-07-31 14:44             ` Jonathan Larmour
2001-07-31 16:12               ` Fabrice Gautier
2001-07-31 17:49                 ` Jonathan Larmour
2001-07-30 13:22     ` Fabrice Gautier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B65F068.E2A4234D@YottaYotta.com \
    --to=cmorrow@yottayotta.com \
    --cc=ecos-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).