This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: changing the stack ptr
- To: Dan Conti <danc at iobjects dot com>
- Subject: RE: [ECOS] changing the stack ptr
- From: Gary Thomas <gthomas at redhat dot com>
- Date: Thu, 26 Jul 2001 18:46:08 -0600 (MDT)
- Cc: "Ecos-Discuss (E-mail)" <ecos-discuss at sources dot redhat dot com>
- Organization: Red Hat, Inc.
Chainging the stack with interrupts enabled is just asking for trouble.
How long of a routine is this? Can you justify leaving interrupts off
for the time it runs?
Can't you get by with one fewer registers?
[questions asked just to play advocate]
On 26-Jul-2001 Dan Conti wrote:
> I'm working on the cirrus part.
>
> I have a piece of code that needs to use all available registers. As
> such, i'm storing the sp off to a seperate location and reusing it as a
> normal data register. I have actually done this in the past with
> moderate success (on older kernels), but i'm having some problems now.
>
> In the past, i used the sp to point into the middle of a data structure,
> the "upper" (as in >= sp) part of the structure being state data for the
> routine, and the "lower" (as in < sp) part of the structure was a small
> 1k stack, completely unrelated to the main thread stack. So basically i
> was able to use the sp register for my own purposes, but there was still
> a psuedo-stack that, if my routine was interrupted, could be used to
> store data on.
>
> Using this same code on current cvs kernels i get the following
> exception:
>
> ASSERT FAIL: <3>sched.cxx [ 170] static void
> Cyg_Scheduler::unlock_inner()
> Bad next thread
>
> I set a break in cyg_assert_fail(), and it appears that the entire stack
> is hosed.
>
> Any thoughts?
>
> -Dan
>
> --
> Dan Conti e danc@iobjects.com
> Software Engineer p (425) 289 0326