|
From: | Jonathan Larmour |
Subject: | Re: [lwip-users] bug #17922 mem_malloc() |
Date: | Wed, 22 Nov 2006 12:45:17 +0000 |
User-agent: | Thunderbird 1.5.0.8 (X11/20061107) |
Christiaan Simons wrote:
Hi folks, I've started to work on bug #17922, but I need some help from you folks. If you have some spare time and want to fix this as much as I do, please have a look at what I've just commited to mem.c rev 1.26
I've had a look. It looks fine from a reading. Also I don't think we should handle near fits. Firstly, from the point of view of keeping it simple, and secondly because I don't think you could sensibly handle them anyway since you _always_ need to have an aligned struct mem following. A struct mem is only three words after all.
Please note this doesn't address possible alignment issues yet, I want to save this after nailing the algorithm down.
I don't think there are any in your changes, from my reading. ptr will be aligned as long as it started off aligned. SIZEOF_STRUCT_MEM will be appropriately aligned for the architecture, and size has been rounded up.
But I think there is a pre-existing problem - the ram array may only have byte alignment, but mem_init assigns a (struct mem *) to its base which may have stronger alignment constraints.
So in mem_init, it should actually be something like: mem = (struct mem*)((ram + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1)); Jifl -- eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts ------["The best things in life aren't things."]------ Opinions==mine
[Prev in Thread] | Current Thread | [Next in Thread] |