Hi folks, we (lewurm and me) are currently working on USB support for
mini
(only OHCI for now) and need to implement support for allocating
dynamic memory
as this will surely be helpful, both for our host controller driver
and maybe
for future device drivers respectively mini features.
In ppcskel, Doug Leas version of malloc (dlmalloc) is used and it
seems to be
obvious to adapt it for mini, too. However, we have some problems
providing the
correct values of _sbrk_start and _sbrk_end in the ld linker script,
mini.ld.
We changed the position of mem2 in MEMORY from 0x13f00000 to
0x13e00000 to have
one more free megabyte at the end of the memory which can then be used
as heap
segment.
We don't know whether this is allowed or not, as it could conflict
with other
data that is stored in this memory area. In fact we get some IPC error
message
("IPC: Unhandled message: 0070001 .......") on the first gecko-upload
after a
cold-start when trying out some "big" (see patch) malloc() calls. That
is,
when "fun" is #defined in main.c:111. It seems the allocated memory
overwrites
some important data.
Get the patches on mini.ld, main.c and the new file malloc.c here on
git:
$ git checkout 4d854edb5
$ git checkout -b malloc
$ git pull git://
github.com/lewurm/mini.git malloc
We would appreciate any kind of help!
Best regards,
theStack
P.S.: In types.h:34 there is a strange typedef causing a bunch of
compare
warnings in dlmalloc:
typedef s32 size_t;
Now, shouldn't size_t always be unsigned? Sizes can never be negative,
can't
they?