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

RE: Stack and interrupt question



The stack expands automatically until the memory is exhausted
so it never gets full. If you get a corrupt stack it is much 
more likely that your program has a memory overwrite e.g.

char data[100];
data[100] = 3;

Maybe you can try to explain your problem with some short
piece of code that repeats the problem?

/Mikael

-----Original Message-----
From: owner-dev-etrax@xxxxxxx.com">mailto:owner-dev-etrax@xxxxxxx.com] On Behalf Of Daniel Fraile Vergel
Sent: Thursday, September 09, 2004 3:14 PM
To: dev-etrax
Subject: Re: Stack and interrupt question



Mikael, thank you for your quick answer, but if the stack is expanded 
automatically,  how can I know when the stack is full? And what is the 
maximum size for the stack?

Mikael Starvik wrote:

>The default stack size in user space is 1 page of memory (8KB) but
>it is expanded automatically when needed.
>
>You can't really use interrupts in user space applications. Instead
>you must have a kernel driver that puts the application to sleep until
>the interrupt arrives. The application can then use e.g read() or
>select() to wait for the driver to wake it up.
>
>The easiest example I can think of is arch/cris/drivers/sync_serial.c.
>In sync_serial_read() you'll find a interruptible_sleep_on which
>will put the application to sleep until the interrupt occurs if
>it reads in blocking mode. In tr_interrupt() you'll find the
>corresponding wake_up_interruptible that will wake it up again.
>
>/Mikael
>
>-----Original Message-----
>From: owner-dev-etrax@xxxxxxx.com">mailto:owner-dev-etrax@xxxxxxx.com] On Behalf Of Daniel Fraile Vergel
>Sent: Thursday, September 09, 2004 11:10 AM
>To: dev-etrax
>Subject: Stack and interrupt question
>
>
>Hi all,
> I noticed some strange behavior with functions arguments in my software. I think it could be due to a stack problem.
>What is the default stack size? How do I change this size?. I'm using 2.4.22 linux version, and Developer Board 82 Release 1.92 tools.
>
>At the moment my software interact with external devices polling them. I'm planning to change this, and use interrupts instead of polling.
>Unfortunately I don't know much about interruptions in C using the developer board. I really appreciate if someone could me send some basic
>example code or point me to a good tutorial.
>
>Thank you
>
>  
>

-- 
Daniel Fraile i Vergel
W-onesys, SL
WDM Optical NEtworks SYStems
c/ Francesc Vila Nave 11, Poligon Industrial Can Magi
08190 Sant Cugat del VallÚs (Barcelona) - SPAIN
Tel. + 34 93 590 11 49
fax  + 34 93 590 11 57
www.w-onesys.com