Re: NewQ: Difference between an isr and a subroutine is that an isr has no arguments




"Grant Edwards" <grante@xxxxxxxx> wrote in message
news:12mp47ilq7kab2d@xxxxxxxxxxxxxxxxxxxxx
On 2006-11-28, Wilco Dijkstra <Wilco_dot_Dijkstra@xxxxxxxxxxxx> wrote:

Since you don't know what is in the resisters when the ISR is
jumped to the idea of function arguments is meaningless.

The unstated assumption seems to be that function arguments are
passed in registers?

Absolutely, if you have a decent set of registers it is the most
efficient way of passing arguments.

Well I can see some good uses for interrupts with arguments,
making interrupt routines even easier to write in C. I'm sure
someone has patented the idea already as it is quite obvious...

Obvious but impossible (in general). The hardware designer has
no way of knowing how the ISR is going to expect arguments to
be passed. If varies from one language to the next, from one
compiler to the next, and even from one build to the next when
compiler flags are changed.

The hardware could set up a few registers and the compiler
would assign parameters to those registers on functions marked
as interrupts - very easy to implement. You could ignore them if
you didn't support them.

Wilco


.



Relevant Pages

  • Re: switching context on MSP430
    ... registers R15,R14,R13 and R12on stack. ... are you aware that not every c compiler for the MSP430 ... Preemption vs Cooperation ... Another important decision to make is whether or not a real-time clock ...
    (comp.arch.embedded)
  • Re: Ive seen the future...and it works! (was: my view on this assembler is blah)
    ... The compiler has the advantage, granted, that it can "remember" what all ... the registers are...but "remembering" isn't the challenge here, ... registers with the CPU... ... The HLLs, though - shackled by a whole bunch of factors that they have to ...
    (alt.lang.asm)
  • Ive seen the future...and it works! (was: my view on this assembler is blah)
    ... > though the registers are few. ... And the 64 bit CPU designers ... what my Borland _C++ compiler_ does when you ask for assembly output...it ... out programming with something like BASIC or Pascal, ...
    (alt.lang.asm)
  • Re: 32-bit vs. 64-bit x86 Speed
    ... You compiler people probably have intimate knowledge of the ISA ... What is the underlying chip architecture and memory subsystem? ... Do you use the x87 floating point stack or xmm registers? ... Do you use of tuned math and string libraries? ...
    (comp.compilers)
  • Re: Moving to 64 bit
    ... 30% faster than in 32 bit mode because it offers twice as many registers. ... I think you have the choice with the gnu-cc compiler. ... It depends on your programming style, and whether the optimizer in the ... Back when a friend and I were writing the optimizer for the C compiler, ...
    (comp.os.linux.misc)