avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Sub-Function Pointer


From: Nick Brent
Subject: [avr-gcc-list] Sub-Function Pointer
Date: Sun, 27 Jun 2004 23:47:17 -0700

Hello All,

    I'm trying to write a small RTOS and I'm having a bit of trouble with 
re-enabling tasks when they're ready. The question, specifically, that I have 
is what happens when you call a sub-function from main or another function? If 
I had to guess, I'd assume the new address of the function being called is 
pushed onto the stack, and when the function exits, the address is popped off 
and the original address is loaded. Am I right? I'm sure it's a little more 
involved than that. I couldn't seem to find an explanation in the avr-libc user 
manual, so I'm hoping someone can explain it to me. 

    The problem that I'm running into is that I'm using lngjmp() to restore the 
context of a task, which is working just fine, but when it leaves the 
sub-function it just jumped back to, it goes to the last function that was 
left, not the one that was left before the context was saved. I don't know if 
that makes much sense, but a brief look at setjmp() and lngjmp() in the 
avr-libc user manual should explain it a little better.

    Thanks for the help in advanced.

                                                Best Regards,

                                                                -Nick Brent

reply via email to

[Prev in Thread] Current Thread [Next in Thread]