public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] I call cyg_mbox_get in DSR, System corrupt.
@ 2007-04-19 15:04 redheart
  2007-04-19 15:07 ` Fabian Scheler
  2007-04-19 15:08 ` Gary Thomas
  0 siblings, 2 replies; 4+ messages in thread
From: redheart @ 2007-04-19 15:04 UTC (permalink / raw)
  To: ecos-discuss


I firstly called cyg_mbox_get in DSR, and block certain thread
then i called cyg_mbox_put in another thread,
then the scheduler attempt to wake up the blocked thread
but at the time of switching context, the system corrupt.

the debugger show that "previus frame inner to this frame (corrupt stack?)" 
I know that call blockable function in a DSR is illegal.
but i don'r know what resulted in the corrupt.

why?

-- 
View this message in context: http://www.nabble.com/I-call-cyg_mbox_get-in-DSR%2C-System-corrupt.-tf3607513.html#a10079093
Sent from the Sourceware - ecos-discuss mailing list archive at Nabble.com.


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] I call cyg_mbox_get in DSR, System corrupt.
  2007-04-19 15:04 [ECOS] I call cyg_mbox_get in DSR, System corrupt redheart
@ 2007-04-19 15:07 ` Fabian Scheler
  2007-04-19 15:08 ` Gary Thomas
  1 sibling, 0 replies; 4+ messages in thread
From: Fabian Scheler @ 2007-04-19 15:07 UTC (permalink / raw)
  To: redheart; +Cc: ecos-discuss

> the debugger show that "previus frame inner to this frame (corrupt stack?)"
> I know that call blockable function in a DSR is illegal.
> but i don'r know what resulted in the corrupt.

Doing something illegal or something that is not explicitly defined
normally results in undefined behaviour, so what are you complaining
about?

Ciao, Fabian

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] I call cyg_mbox_get in DSR, System corrupt.
  2007-04-19 15:04 [ECOS] I call cyg_mbox_get in DSR, System corrupt redheart
  2007-04-19 15:07 ` Fabian Scheler
@ 2007-04-19 15:08 ` Gary Thomas
  2007-04-19 16:43   ` Paul D. DeRocco
  1 sibling, 1 reply; 4+ messages in thread
From: Gary Thomas @ 2007-04-19 15:08 UTC (permalink / raw)
  To: redheart; +Cc: ecos-discuss

redheart wrote:
> I firstly called cyg_mbox_get in DSR, and block certain thread
> then i called cyg_mbox_put in another thread,
> then the scheduler attempt to wake up the blocked thread
> but at the time of switching context, the system corrupt.
> 
> the debugger show that "previus frame inner to this frame (corrupt stack?)" 
> I know that call blockable function in a DSR is illegal.
> but i don'r know what resulted in the corrupt.
> 
> why?
> 

Because this is an unsafe operation and "not allowed" to
be called from a DSR.  DSRs cannot call any kernel function
which might block (because they are run anonymously, not in
any particular thread context).

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [ECOS] I call cyg_mbox_get in DSR, System corrupt.
  2007-04-19 15:08 ` Gary Thomas
@ 2007-04-19 16:43   ` Paul D. DeRocco
  0 siblings, 0 replies; 4+ messages in thread
From: Paul D. DeRocco @ 2007-04-19 16:43 UTC (permalink / raw)
  To: eCos Discuss

> > redheart wrote:
> >
> > I firstly called cyg_mbox_get in DSR, and block certain 
> > thread then i 
> > called cyg_mbox_put in another thread, then the scheduler 
> > attempt to 
> > wake up the blocked thread but at the time of switching 
> > context, the 
> > system corrupt.
> > 
> > the debugger show that "previus frame inner to this frame (corrupt 
> > stack?)"
> > I know that call blockable function in a DSR is illegal.
> > but i don'r know what resulted in the corrupt.
> > 
> > why?
> 
> From: Gary Thomas
> 
> Because this is an unsafe operation and "not allowed" to
> be called from a DSR.  DSRs cannot call any kernel function 
> which might block (because they are run anonymously, not in 
> any particular thread context).

You can, however, use the cyg_mbox_tryget operation in DSR context. I could
imagine using a mailbox to pass info to the DSR, by having the thread that
sends to the mailbox enable the appropriate interrupt, and then having the
DSR disable the interrupt if it detects an empty mailbox. However, I think
it's easier just to use a condition variable and a mutex and design one's
own FIFO mechanism.

-- 

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco@ix.netcom.com


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-19 16:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-19 15:04 [ECOS] I call cyg_mbox_get in DSR, System corrupt redheart
2007-04-19 15:07 ` Fabian Scheler
2007-04-19 15:08 ` Gary Thomas
2007-04-19 16:43   ` Paul D. DeRocco

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).