public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFA: RL78: Always select register bank 0 at the start of an ISR
@ 2013-01-03 12:49 Nick Clifton
  2013-01-07 19:54 ` DJ Delorie
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Clifton @ 2013-01-03 12:49 UTC (permalink / raw)
  To: dj; +Cc: gcc-patches

Hi DJ,

  Since interrupts can happen at any time, it is possible for a ISR to
  be called when register bank 0 is not the currently selected bank.
  Hence the prologue for an interrupt handler should always select bank
  0 before saving any registers.  The patch below makes sure that this
  happens.

  No regressions with a rl78-elf toolchain.

  OK to apply ?

Cheers
  Nick

gcc/ChangeLog
2013-01-03  Nick Clifton  <nickc@redhat.com>

	* config/rl78/rl78.c (rl78_expand_prologue): Always select
	register bank 0 at the start of an interrupt handler.

Index: gcc/config/rl78/rl78.c
===================================================================
--- gcc/config/rl78/rl78.c	(revision 194833)
+++ gcc/config/rl78/rl78.c	(working copy)
@@ -839,6 +839,9 @@
   if (flag_stack_usage_info)
     current_function_static_stack_size = cfun->machine->framesize;
 
+  if (is_interrupt_func (cfun->decl))
+    emit_insn (gen_sel_rb (GEN_INT (0)));
+
   for (i = 0; i < 16; i++)
     if (cfun->machine->need_to_push [i])
       {
  

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: RFA: RL78: Always select register bank 0 at the start of an ISR
  2013-01-03 12:49 RFA: RL78: Always select register bank 0 at the start of an ISR Nick Clifton
@ 2013-01-07 19:54 ` DJ Delorie
  0 siblings, 0 replies; 2+ messages in thread
From: DJ Delorie @ 2013-01-07 19:54 UTC (permalink / raw)
  To: Nick Clifton; +Cc: gcc-patches


I think that's right, since the ISR return restores the flag register,
which has the bank select bits in it.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-07 19:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-03 12:49 RFA: RL78: Always select register bank 0 at the start of an ISR Nick Clifton
2013-01-07 19:54 ` DJ Delorie

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).