To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 772
771  |  773
Subject: 
Re: __attribute__ ((rcx_interrrupt)) : how to use ?
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Tue, 1 Feb 2000 19:32:23 GMT
Viewed: 
5316 times
  
Hello Ben, you wrote:

> If you're using rcx_interrupt you
> probably have to use it on any function called in an interrupt context, since
> each one will have to preserve the scratch registers they use (because the top
> level function may not save them).

Well, i got the definitive answer from Markus 8-). It was in german, so
i'll try to translate it:

the effect of __attribute__ ((rcx_interrrupt)) depends on the calling
context:

- in leaf functions (that do not call other functions), it makes sure
all USED registers are saved and restored.

- in all other functions (that do call other functions), it makes sure
ALL registers are saved and restored.

Thus, you have to declare the attribute only for IRQ-handlers. If they
call other functions you do not have to declare the attribute for the
called functions, the compiler will arrange everything -- really great,
isn't it ?

The reason for the functions called from the systime-handler to have the
attribute is: systime-handler is written in assembler for historical
reasons, so it doesn´t save and restore registers as needed.

have a nice day, Martin



Message is in Reply To:
  Re: __attribute__ ((rcx_interrrupt)) : how to use ?
 
(...) Right. The calling conventions of the H8 say that r0-r3 are scratch registers (aka caller saves). However, interrupt handlers must preserve ALL of the registers. So the rcx_interrupt attribute makes that happen. (...) The compiler will only (...) (27 years ago, 31-Jan-00, to lugnet.robotics.rcx.legos)

3 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR