[En-Nut-Discussion] NutHeapRealloc

Moritz Struebe morty at gmx.net
Tue May 27 14:16:41 CEST 2008


Ole Reinhardt schrieb:
> Hi Morty,
>
>   
>> Hmm looks like this wasn't such a smart idea because enter & switch 
>> frame are Arch dependent. Maybe I did it the wrong way round: Keep 
>> NutThreadCreate in arch and add a NutThreadTdInit to the os/thread.c.
>>     
>
> Perhaps I've missed a part of this thread. What do you exactly plan? I
> have implemented a private memory possebility for every thread by simply
> adding a new pointer to the thread structure. This way you can assign /
> query any chunk of memory / variable you like to this thread. I just did
> not check this code in. So did we plan the same?
>   

We did the same. See my posting form 2008-05-06 and the last from 
Thiago. I added quite a few new features, though (e.g. realloc).
The problem with adding a pointer to the thread structure is, that it 
has to be initialized. Therefore _every_ NutThreadCreate must be 
adjusted for it to work. Further on the thread structure is the same for 
every architecture. It can therefore easily be made architecture 
independent. The same for adding the deadbeef to the Stack. If the 
latter is moved to arch-independent a stack-check can be done on every 
context-switch and a something-horrible-happened-function can be called 
if it's overwritten. Or, you can just spare the deadbeef unless you're 
debugging. Again this only makes sense if it's not in the /arch.


> I would not move NutThreadCreate anywhere else than into the arch
> directory. All these thread specific funktions are highly architecture
> specific and therefore should not be moved away. Addind new functions
> that will be calles instead from a global NutThreadCreate function would
> only add extra jumps and code size and does not make things cleaner.
>   

Ok, but if you have a static inline NutThreadInitThreadStructure you 
have no overhead and a clean design (reasons see above.).


> Could you perhaps explain me in a few short headlines what you plan to
> do? (Perhaps you simply write me a private mail in german)
>   
I hope my explanations makes more sense. :-) If not, I'll send you a 
sample.

Cheers
Morty




More information about the En-Nut-Discussion mailing list