[syslinux] Syslinux malloc
Murali Krishnan Ganapathy
gmurali at cs.uchicago.edu
Sun Feb 8 10:11:27 PST 2004
TenThumbs wrote:
> I mentioned in a private email recently that it would be useful if
> syslinux
> had a malloc implementation. I have one now if anyone's interested.
>
>
I just implemented a simple malloc for a 16-bit COMBOOT application. I
will surely be interested in seeing your implementation. We should
probably starting building an implementation of all useful C routines.
Ideally, we should be able to create an include file "comboot.h", which
declares all the useful C routines, and defines them to generate an
error message. That way one can use any of the C libraries as long as
they include comboot.h as well. If the C function cannot work under
comboot, then there will be an error generated.
Here is a small example.
/* COMBOOT.H starts */
#define fopen 1=7
#define fclose 1=7
....
#include "heap.h"
#include "string.h"
extern void * malloc(unsigned int );
extern void * memset(void *, char, unsigned int);
....
// COMBOOT.H ends
Now any C file which includes comboot.h cannot use fopen (it will result
in a compile error).
If one includes <stdlib.h> and tries to use malloc, then there will be
two implementations and will result in a linker error.
This will be useful till we have mini libc, one can use for comboot coding.
BTW, how mature is klibc to use for this?
- Murali
More information about the Syslinux
mailing list