stack check support on embedded targets

Joel Sherrill joel@OARcorp.com
Fri Jul 6 09:19:00 GMT 2001


Hi,

I would like to add stack check support for RTEMS tasks/threads.  This is an
run-time environment for embedded CPUs (about a dozen now) without an
MMU.  The generic stack probe code seems to assume that an MMU will
catch an access of an invalid address.  On RTEMS, the test for stack in 
range
is portable and quite simple.  The valid stack range is in the thread 
control block.
So one can write a short portable C routine to catch the fault;

void check_sp( void *sp current_sp );
  if current_sp is NOT in range
    ERROR

Any thoughts on how to generically add support for calling a probe routine
with the current stack pointer as a single argument?  It would be
fabulous if this could be added in such a way that all targets would support
it instantly.

Thanks.

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the Gcc-help mailing list