I would like to write a routine to detect if the stack stack has
reached a high water mark and put that routine into the
taskSwitchHook. Unfortunately the hook is executed in the kernel
context and it is thefore not possible to generate a printout,
generate a signal, or raise an exception. Has anyone ideas how to
react properly in such a case ? Can anyone give me a more detailed
list of functions, tha can be called in the kernal context.
Thx, Th.
--
___________________________________________________________________________
Thomas Scholz HW related Software Design EED/E/D/R
_/_/_/_/ _/_/_/_/ _/_/_/ Ericsson Eurolab Deutschland GmbH
_/ _/ _/ _/ D-31135 Hildesheim, Daimlerring 9
_/_/_/ _/_/_/ _/ _/
_/ _/ _/ _/ phone : +49 5121 707-228
_/_/_/_/ _/_/_/_/ _/_/_/ fax : +49 5121 707-333
mailto:Thomas...@eed.ericsson.se
___________________________________________________________________________
IMHO it should be safe to call functions that are allowed in interrupt
context.
For Tornado versions 1.0.1 & 2.0, see section 2.5.3 of the VxWorks
Programmer's Guide for a list of functions, and
other restrictions.
HTH
Werner
Thomas Scholz <eed...@sun239.eede.ericsson.se> wrote in message
news:8hfqck$idv$1...@aken.eed.ericsson.se...
You could simply send a message containing the offending task ID
(remember to use NO_WAIT for the timeout as per an ISR using msgQSend).
If you have a high priority task waiting for these messages, then it
will get to run (basically, the scheduling code will be repeated after
your hook, and any other hooks, terminate since you will have
"disturbed" things).
You could equally well use a semaphore, but obviously in that case you
cannot pass any data to your task.
Hope that helps,
John...
In article <8hfqck$idv$1...@aken.eed.ericsson.se>,
Thomas Scholz <eed...@sun239.eede.ericsson.se> wrote:
> Hi,
>
> I would like to write a routine to detect if the stack stack has
> reached a high water mark and put that routine into the
> taskSwitchHook. Unfortunately the hook is executed in the kernel
> context and it is thefore not possible to generate a printout,
> generate a signal, or raise an exception. Has anyone ideas how to
> react properly in such a case ? Can anyone give me a more detailed
> list of functions, tha can be called in the kernal context.
>
> Thx, Th.
>
> --
>
________________________________________________________________________
___
>
> Thomas Scholz HW related Software Design
EED/E/D/R
>
> _/_/_/_/ _/_/_/_/ _/_/_/ Ericsson Eurolab Deutschland GmbH
> _/ _/ _/ _/ D-31135 Hildesheim, Daimlerring 9
> _/_/_/ _/_/_/ _/ _/
> _/ _/ _/ _/ phone : +49 5121 707-228
> _/_/_/_/ _/_/_/_/ _/_/_/ fax : +49 5121 707-333
>
> mailto:Thomas...@eed.ericsson.se
>
________________________________________________________________________
___
>
Sent via Deja.com http://www.deja.com/
Before you buy.
In the past I used the next code (typically for x86 targets):
int switchHandler(WIND_TCB *pOldTcb, WIND_TCB *pNewTcb)
{
if ((pOldTcb->regs.esp < (ULONG)pOldTcb->pStackLimit) ||
(!(pOldTcb->options & VX_NO_STACK_FILL) &&
((int)*(int *)(pOldTcb->pStackLimit) != 0xeeeeeeee)))
{
logMsg("Stack overflow task 0x%08x\n", (int)pOldTcb,0,0,0,0,0);
taskSuspend((int)pOldTcb);
/* __asm__("int $12"); */
}
return 0;
}
int start_application(void)
{
/* Enable kind of dynamic stack checking */
if (taskSwitchHookAdd(switchHandler) == ERROR)
{
printf("taskSwitchHookAdd error\n");
return ERROR;
}
...
}
Gerald