On Wed, 19 Apr 2000, Olaf Petzold wrote:

> Could it be, that the amount of memory which I want to copy must be less than
> PAGE_SIZE???? The structure has a size of about 512 kB!
> The shared memory is allocated by mbuff, no problems. The local copy which I
> try to fill with the contents of the shm structure is a static variable, like
> 
> void *thread_code(void *param)
> {
>   shm_slut_t slut;
>    memcpy((void *)slut, (void *)shm_slut, sizeof(shm_slut_t));

Oh no, why I did not see it immediately. Also, probably "&" is missing.

So first of all shm_slut_t slut; here it is not static variable, but
automatic one and it is created on the stack every time you call the
function. And the size of the stack for RT thread is one of the parameters
you give when you create a new thread. For standard Linux kernel it is 8 KB.
Using automatic variables to store things larger than let's say 1 KB is
strongly discouraged. Overwriting the stack results in a crash. 

So of course, use vmalloc. Best allocate this memory in init_module, because
you can not call it from RT thread nor ISR.

Best regards,
--
Tomasz Motylewski

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to