On Jun 30, 2014, at 14:41 , Joel Sherrill <joel.sherr...@oarcorp.com> wrote:

> Is your "struct handler_arguments" declared on the stack (e.g. an
> automatic variable)? If so, then the memory is likely clobbered by
> the time the ISR runs.

Not necessarily. A common method would be:

thread_to_process_something() {
        struct handler_arguments on_stack;
        install_isr_that_uses_on_stack();

        while (work_to_do_with_isr()) {
                receive_and_process_semaphore_from_isr();
        }
        shutdown_isr();
}

You just need to ensure that the stack isn't out of scope when the isr can fire.

You can't do this on systems that have per-thread stacks that are only mapped 
when the thread is active, but I don't know of any RTEMS usage of that.  I've 
used multi-processor systems that have that attribute.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to