Libpayload: Difference between revisions

From coreboot
Jump to navigation Jump to search
m (→‎Libc Coverage: Change table layout for better readability.)
Line 42: Line 42:
! align="left" | Function/Macro/Variable
! align="left" | Function/Macro/Variable


|- bgcolor="red"
|- bgcolor="#6699ff"
| colspan=2 align="center" | assert.h
| colspan=2 | '''assert.h'''
 
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>assert( )</code> (macro)
| <code>assert( )</code> (macro)


|- bgcolor="yellow"
|- bgcolor="#6699ff"
| colspan=2 align="center" | ctype.h
| colspan=2 | '''ctype.h'''
 
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int isalnum(int character)</code>
| <code>int isalnum(int character)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int isalpha(int character)</code>
| <code>int isalpha(int character)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int iscntrl(int character)</code>
| <code>int iscntrl(int character)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>int isdigit(int character)</code>
| <code>int isdigit(int character)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int isgraph(int character)</code>
| <code>int isgraph(int character)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int islower(int character)</code>
| <code>int islower(int character)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int isprint(int character)</code>
| <code>int isprint(int character)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int ispunct(int character)</code>
| <code>int ispunct(int character)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>int isspace(int character)</code>
| <code>int isspace(int character)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int isupper(int character)</code>
| <code>int isupper(int character)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int isxdigit(int character)</code>
| <code>int isxdigit(int character)</code>


|- bgcolor="red"
|- bgcolor="#6699ff"
| colspan=2 align="center" | errno.h
| colspan=2 | '''errno.h'''
 
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>errno</code> (global)
| <code>errno</code> (global)


|- bgcolor="red"
|- bgcolor="#6699ff"
| colspan=2 align="center" | float.h
| colspan=2 | '''float.h'''


|- bgcolor="red"
|- bgcolor="#6699ff"
| colspan=2 align="center" | limits.h
| colspan=2 | '''limits.h'''
 
|- bgcolor="red"
| colspan=2 align="center" | locale.h


|- bgcolor="#6699ff"
| colspan=2 | '''locale.h'''
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char *setlocale(int category, const char *locale)</code>
| <code>char *setlocale(int category, const char *locale)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>struct lconv *localeconv(void)</code>
| <code>struct lconv *localeconv(void)</code>


|- bgcolor="red"
|- bgcolor="#6699ff"
| colspan=2 align="center" | math.h
| colspan=2 | '''math.h'''
 
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double exp(double x)</code>
| <code>double exp(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double log(double x)</code>
| <code>double log(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double log10(double x)</code>
| <code>double log10(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double pow(double x, double y)</code>
| <code>double pow(double x, double y)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double sqrt(double x)</code>
| <code>double sqrt(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double ceil(double x)</code>
| <code>double ceil(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double floor(double x)</code>
| <code>double floor(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double fabs(double x)</code>
| <code>double fabs(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double ldexp(double x, int n)</code>
| <code>double ldexp(double x, int n)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double frexp(double x, int* exp)</code>
| <code>double frexp(double x, int* exp)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double modf(double x, double* ip)</code>
| <code>double modf(double x, double* ip)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double fmod(double x, double y)</code>
| <code>double fmod(double x, double y)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double sin(double x)</code>
| <code>double sin(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double cos(double x)</code>
| <code>double cos(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double tan(double x)</code>
| <code>double tan(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double asin(double x)</code>
| <code>double asin(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double acos(double x)</code>
| <code>double acos(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double atan(double x)</code>
| <code>double atan(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double atan2(double y, double x)</code>
| <code>double atan2(double y, double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double sinh(double x)</code>
| <code>double sinh(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double cosh(double x)</code>
| <code>double cosh(double x)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double tanh(double x)</code>
| <code>double tanh(double x)</code>


|- bgcolor="red"
|- bgcolor="#6699ff"
| colspan=2 align="center" | setjmp.h
| colspan=2 | '''setjmp.h'''
 
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int setjmp(jmp_buf env)</code>
| <code>int setjmp(jmp_buf env)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void longjmp(jmp_buf env, int val)</code>
| <code>void longjmp(jmp_buf env, int val)</code>


|- bgcolor="red"
|- bgcolor="#6699ff"
| colspan=2 align="center" | signal.h
| colspan=2 | '''signal.h'''
 
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void (*signal(int sig, void (*handler)(int)))(int)</code>
| <code>void (*signal(int sig, void (*handler)(int)))(int)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int raise(int sig)</code>
| <code>int raise(int sig)</code>


|- bgcolor="red"
|- bgcolor="#6699ff"
| colspan=2 align="center" | stdarg.h
| colspan=2 | '''stdarg.h'''
 
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void va_start(va_list ap, lastarg)</code>
| <code>void va_start(va_list ap, lastarg)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>type va_arg(va_list ap, type)</code>
| <code>type va_arg(va_list ap, type)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void va_end(va_list ap)</code>
| <code>void va_end(va_list ap)</code>


|- bgcolor="red"
|- bgcolor="#6699ff"
| colspan=2 align="center" | stddef.h
| colspan=2 | '''stddef.h'''


|- colspan=2  
|- colspan=2  
| TODO
| TODO


|- bgcolor="yellow"
|- bgcolor="#6699ff"
| colspan=2 align="center" | stdio.h
| colspan=2 | '''stdio.h'''
 
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>FILE* fopen(const char* filename, const char* mode)</code>
| <code>FILE* fopen(const char* filename, const char* mode)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>FILE* freopen(const char* filename, const char* mode, FILE* stream)</code>
| <code>FILE* freopen(const char* filename, const char* mode, FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int fflush(FILE* stream)</code>
| <code>int fflush(FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int fclose(FILE* stream)</code>
| <code>int fclose(FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int remove(const char* filename)</code>
| <code>int remove(const char* filename)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int rename(const char* oldname, const char* newname)</code>
| <code>int rename(const char* oldname, const char* newname)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>FILE* tmpfile()</code>
| <code>FILE* tmpfile()</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char* tmpnam(char s[L_tmpnam])</code>
| <code>char* tmpnam(char s[L_tmpnam])</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int setvbuf(FILE* stream, char* buf, int mode, size_t size)</code>
| <code>int setvbuf(FILE* stream, char* buf, int mode, size_t size)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void setbuf(FILE* stream, char* buf)</code>
| <code>void setbuf(FILE* stream, char* buf)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int fprintf(FILE* stream, const char* format, ...)</code>
| <code>int fprintf(FILE* stream, const char* format, ...)</code>
|-  
|-  
| style="background:yellow" | partial
| style="background:yellow" | partial
| <code>int printf(const char* format, ...)</code>
| <code>int printf(const char* format, ...)</code>
|-  
|-  
| style="background:yellow" | partial
| style="background:yellow" | partial
| <code>int sprintf(char* s, const char* format, ...)</code>
| <code>int sprintf(char* s, const char* format, ...)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int vfprintf(FILE* stream, const char* format, va_list arg)</code>
| <code>int vfprintf(FILE* stream, const char* format, va_list arg)</code>
|-  
|-  
| style="background:yellow" | partial
| style="background:yellow" | partial
| <code>int vprintf(const char* format, va_list arg)</code>
| <code>int vprintf(const char* format, va_list arg)</code>
|-  
|-  
| style="background:yellow" | partial
| style="background:yellow" | partial
| <code>int vsprintf(char* s, const char* format, va_list arg)</code>
| <code>int vsprintf(char* s, const char* format, va_list arg)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int fscanf(FILE* stream, const char* format, ...)</code>
| <code>int fscanf(FILE* stream, const char* format, ...)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int scanf(const char* format, ...)</code>
| <code>int scanf(const char* format, ...)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int sscanf(char* s, const char* format, ...)</code>
| <code>int sscanf(char* s, const char* format, ...)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int fgetc(FILE* stream)</code>
| <code>int fgetc(FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char* fgets(char* s, int n, FILE* stream)</code>
| <code>char* fgets(char* s, int n, FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int fputc(int c, FILE* stream)</code>
| <code>int fputc(int c, FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char* fputs(const char* s, FILE* stream)</code>
| <code>char* fputs(const char* s, FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int getc(FILE* stream)</code>
| <code>int getc(FILE* stream)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>int getchar(void)</code>
| <code>int getchar(void)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char* gets(char* s)</code>
| <code>char* gets(char* s)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int putc(int c, FILE* stream)</code>
| <code>int putc(int c, FILE* stream)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>int putchar(int c)</code>
| <code>int putchar(int c)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>int puts(const char* s)</code>
| <code>int puts(const char* s)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int ungetc(int c, FILE* stream)</code>
| <code>int ungetc(int c, FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>size_t fread(void* ptr, size_t size, size_t nobj, FILE* stream)</code>
| <code>size_t fread(void* ptr, size_t size, size_t nobj, FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>size_t fwrite(const void* ptr, size_t size, size_t nobj, FILE* stream)</code>
| <code>size_t fwrite(const void* ptr, size_t size, size_t nobj, FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int fseek(FILE* stream, long offset, int origin)</code>
| <code>int fseek(FILE* stream, long offset, int origin)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>long ftell(FILE* stream)</code>
| <code>long ftell(FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void rewind(FILE* stream)</code>
| <code>void rewind(FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int fgetpos(FILE* stream, fpos_t* ptr)</code>
| <code>int fgetpos(FILE* stream, fpos_t* ptr)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int fsetpos(FILE* stream, const fpos_t* ptr)</code>
| <code>int fsetpos(FILE* stream, const fpos_t* ptr)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void clearerr(FILE* stream)</code>
| <code>void clearerr(FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int feof(FILE* stream)</code>
| <code>int feof(FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int ferror(FILE* stream)</code>
| <code>int ferror(FILE* stream)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void perror(const char* s)</code>
| <code>void perror(const char* s)</code>


|- bgcolor="yellow"
|- bgcolor="#6699ff"
| colspan=2 align="center" | stdlib.h
| colspan=2 | '''stdlib.h'''
 
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int abs(int n)</code>
| <code>int abs(int n)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>long labs(long n)</code>
| <code>long labs(long n)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>div_t div(int num, int denom)</code>
| <code>div_t div(int num, int denom)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>ldiv_t ldiv(long num, long denom)</code>
| <code>ldiv_t ldiv(long num, long denom)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double atof(const char* s)</code>
| <code>double atof(const char* s)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int atoi(const char* s)</code>
| <code>int atoi(const char* s)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>long atol(const char* s)</code>
| <code>long atol(const char* s)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double strtod(const char* s, char** endp)</code>
| <code>double strtod(const char* s, char** endp)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>long strtol(const char* s, char** endp, int base)</code>
| <code>long strtol(const char* s, char** endp, int base)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>unsigned long strtoul(const char* s, char** endp, int base)</code>
| <code>unsigned long strtoul(const char* s, char** endp, int base)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>void* calloc(size_t nobj, size_t size)</code>
| <code>void* calloc(size_t nobj, size_t size)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>void* malloc(size_t size)</code>
| <code>void* malloc(size_t size)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>void* realloc(void* p, size_t size)</code>
| <code>void* realloc(void* p, size_t size)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>void free(void* p)</code>
| <code>void free(void* p)</code>
|-  
|-  
| style="background:lime" | yes as <code>halt()</code>
| style="background:lime" | yes as <code>halt()</code>
| <code>void abort()</code>
| <code>void abort()</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void exit(int status)</code>
| <code>void exit(int status)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int atexit(void (*fcm)(void))</code>
| <code>int atexit(void (*fcm)(void))</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int system(const char* s)</code>
| <code>int system(const char* s)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char* getenv(const char* name)</code>
| <code>char* getenv(const char* name)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void* bsearch(const void* key, const void* base, size_t n, size_t size, int (*cmp)(const void* keyval, const void* datum))</code>
| <code>void* bsearch(const void* key, const void* base, size_t n, size_t size, int (*cmp)(const void* keyval, const void* datum))</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void qsort(void* base, size_t n, size_t size, int (*cmp)(const void*, const void*))</code>
| <code>void qsort(void* base, size_t n, size_t size, int (*cmp)(const void*, const void*))</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int rand(void)</code>
| <code>int rand(void)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void srand(unsigned int seed)</code>
| <code>void srand(unsigned int seed)</code>


|- bgcolor="yellow"
|- bgcolor="#6699ff"
| colspan=2 align="center" | string.h
| colspan=2 | '''string.h'''
 
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>char* strcpy(char* s, const char* ct)</code>
| <code>char* strcpy(char* s, const char* ct)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>char* strncpy(char* s, const char* ct, size_t n)</code>
| <code>char* strncpy(char* s, const char* ct, size_t n)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char* strcat(char* s, const char* ct)</code>
| <code>char* strcat(char* s, const char* ct)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>char* strncat(char* s, const char* ct, size_t n)</code>
| <code>char* strncat(char* s, const char* ct, size_t n)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>int strcmp(const char* cs, const char* ct)</code>
| <code>int strcmp(const char* cs, const char* ct)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>int strncmp(const char* cs, const char* ct, size_t n)</code>
| <code>int strncmp(const char* cs, const char* ct, size_t n)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>int strcoll(const char* cs, const char* ct)</code>
| <code>int strcoll(const char* cs, const char* ct)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>char* strchr(const char* cs, int c)</code>
| <code>char* strchr(const char* cs, int c)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char* strrchr(const char* cs, int c)</code>
| <code>char* strrchr(const char* cs, int c)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>size_t strspn(const char* cs, const char* ct)</code>
| <code>size_t strspn(const char* cs, const char* ct)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>size_t strcspn(const char* cs, const char* ct)</code>
| <code>size_t strcspn(const char* cs, const char* ct)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char* strpbrk(const char* cs, const char* ct)</code>
| <code>char* strpbrk(const char* cs, const char* ct)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>char* strstr(const char* cs, const char* ct)</code>
| <code>char* strstr(const char* cs, const char* ct)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>size_t strlen(const char* cs)</code>
| <code>size_t strlen(const char* cs)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char* strerror(int n)</code>
| <code>char* strerror(int n)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char* strtok(char* s, const char* t)</code>
| <code>char* strtok(char* s, const char* t)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>size_t strxfrm(char* s, const char* ct, size_t n)</code>
| <code>size_t strxfrm(char* s, const char* ct, size_t n)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>void* memcpy(void* s, const void* ct, size_t n)</code>
| <code>void* memcpy(void* s, const void* ct, size_t n)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>void* memmove(void* s, const void* ct, size_t n)</code>
| <code>void* memmove(void* s, const void* ct, size_t n)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>int memcmp(const void* cs, const void* ct, size_t n)</code>
| <code>int memcmp(const void* cs, const void* ct, size_t n)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>void* memchr(const void* cs, int c, size_t n)</code>
| <code>void* memchr(const void* cs, int c, size_t n)</code>
|-  
|-  
| style="background:lime" | yes
| style="background:lime" | yes
| <code>void* memset(void* s, int c, size_t n)</code>
| <code>void* memset(void* s, int c, size_t n)</code>


|- bgcolor="red"
|- bgcolor="#6699ff"
| colspan=2 align="center" | time.h
| colspan=2 | '''time.h'''
 
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>clock_t clock(void)</code>
| <code>clock_t clock(void)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>time_t time(time_t* tp)</code>
| <code>time_t time(time_t* tp)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>double difftime(time_t time2, time_t time1)</code>
| <code>double difftime(time_t time2, time_t time1)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>time_t mktime(struct tm* tp)</code>
| <code>time_t mktime(struct tm* tp)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char* asctime(const struct tm* tp)</code>
| <code>char* asctime(const struct tm* tp)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>char* ctime(const time_t* tp)</code>
| <code>char* ctime(const time_t* tp)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>struct tm* gmtime(const time_t* tp)</code>
| <code>struct tm* gmtime(const time_t* tp)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no
| <code>struct tm* localtime(const time_t* tp)</code>
| <code>struct tm* localtime(const time_t* tp)</code>
|-  
|-  
| style="background:red" | no
| style="background:red" | no

Revision as of 00:14, 8 April 2008

libpayload is a small BSD-licensed static library (a lightweight implementation of common and useful functions) intended to be used as a basis for coreboot payloads.

Overview

The benefits of linking a coreboot payload against libpayload are:

  • Payloads do not have to implement and maintain low-level code for I/O, common functions, etc.
  • Payloads can be recompiled and deployed for CPU architectures supported by coreboot in the future.
  • The libpayload functions can be tested and scrutinized outside payload development.
  • Payloads themselves may be partly host-tested, e.g. against an emulation libpayload.

Just give us a main() and a pocket full of dreams and we'll do the rest.

Download

 $ svn co svn://coreboot.org/repos/trunk/payloads/libpayload

Features

  • Provides a subset of libc functions (e.g. malloc, printf, strcmp, etc).
  • Provides an optional tiny (n)curses implementation.
  • Provides various small drivers for
    • keyboard
    • PC speaker
    • NVRAM/CMOS access
    • serial console
    • VGA
    • Geode framebuffer
  • Reads and parses the coreboot table.

Payloads using libpayload

  • coreinfo is a small payload which can display system information such as PCI info, an NVRAM dump, or the coreboot v3 printk buffer.
  • GRUB invaders has been ported successfully to libpayload (patch pending)
  • tint (a console tetris clone) is currently ported to libpayload (patch pending).

Libc Coverage

Status Function/Macro/Variable
assert.h
no assert( ) (macro)
ctype.h
no int isalnum(int character)
no int isalpha(int character)
no int iscntrl(int character)
yes int isdigit(int character)
no int isgraph(int character)
no int islower(int character)
no int isprint(int character)
no int ispunct(int character)
yes int isspace(int character)
no int isupper(int character)
no int isxdigit(int character)
errno.h
no errno (global)
float.h
limits.h
locale.h
no char *setlocale(int category, const char *locale)
no struct lconv *localeconv(void)
math.h
no double exp(double x)
no double log(double x)
no double log10(double x)
no double pow(double x, double y)
no double sqrt(double x)
no double ceil(double x)
no double floor(double x)
no double fabs(double x)
no double ldexp(double x, int n)
no double frexp(double x, int* exp)
no double modf(double x, double* ip)
no double fmod(double x, double y)
no double sin(double x)
no double cos(double x)
no double tan(double x)
no double asin(double x)
no double acos(double x)
no double atan(double x)
no double atan2(double y, double x)
no double sinh(double x)
no double cosh(double x)
no double tanh(double x)
setjmp.h
no int setjmp(jmp_buf env)
no void longjmp(jmp_buf env, int val)
signal.h
no void (*signal(int sig, void (*handler)(int)))(int)
no int raise(int sig)
stdarg.h
no void va_start(va_list ap, lastarg)
no type va_arg(va_list ap, type)
no void va_end(va_list ap)
stddef.h
TODO
stdio.h
no FILE* fopen(const char* filename, const char* mode)
no FILE* freopen(const char* filename, const char* mode, FILE* stream)
no int fflush(FILE* stream)
no int fclose(FILE* stream)
no int remove(const char* filename)
no int rename(const char* oldname, const char* newname)
no FILE* tmpfile()
no char* tmpnam(char s[L_tmpnam])
no int setvbuf(FILE* stream, char* buf, int mode, size_t size)
no void setbuf(FILE* stream, char* buf)
no int fprintf(FILE* stream, const char* format, ...)
partial int printf(const char* format, ...)
partial int sprintf(char* s, const char* format, ...)
no int vfprintf(FILE* stream, const char* format, va_list arg)
partial int vprintf(const char* format, va_list arg)
partial int vsprintf(char* s, const char* format, va_list arg)
no int fscanf(FILE* stream, const char* format, ...)
no int scanf(const char* format, ...)
no int sscanf(char* s, const char* format, ...)
no int fgetc(FILE* stream)
no char* fgets(char* s, int n, FILE* stream)
no int fputc(int c, FILE* stream)
no char* fputs(const char* s, FILE* stream)
no int getc(FILE* stream)
yes int getchar(void)
no char* gets(char* s)
no int putc(int c, FILE* stream)
yes int putchar(int c)
yes int puts(const char* s)
no int ungetc(int c, FILE* stream)
no size_t fread(void* ptr, size_t size, size_t nobj, FILE* stream)
no size_t fwrite(const void* ptr, size_t size, size_t nobj, FILE* stream)
no int fseek(FILE* stream, long offset, int origin)
no long ftell(FILE* stream)
no void rewind(FILE* stream)
no int fgetpos(FILE* stream, fpos_t* ptr)
no int fsetpos(FILE* stream, const fpos_t* ptr)
no void clearerr(FILE* stream)
no int feof(FILE* stream)
no int ferror(FILE* stream)
no void perror(const char* s)
stdlib.h
no int abs(int n)
no long labs(long n)
no div_t div(int num, int denom)
no ldiv_t ldiv(long num, long denom)
no double atof(const char* s)
no int atoi(const char* s)
no long atol(const char* s)
no double strtod(const char* s, char** endp)
no long strtol(const char* s, char** endp, int base)
no unsigned long strtoul(const char* s, char** endp, int base)
yes void* calloc(size_t nobj, size_t size)
yes void* malloc(size_t size)
yes void* realloc(void* p, size_t size)
yes void free(void* p)
yes as halt() void abort()
no void exit(int status)
no int atexit(void (*fcm)(void))
no int system(const char* s)
no char* getenv(const char* name)
no void* bsearch(const void* key, const void* base, size_t n, size_t size, int (*cmp)(const void* keyval, const void* datum))
no void qsort(void* base, size_t n, size_t size, int (*cmp)(const void*, const void*))
no int rand(void)
no void srand(unsigned int seed)
string.h
yes char* strcpy(char* s, const char* ct)
yes char* strncpy(char* s, const char* ct, size_t n)
no char* strcat(char* s, const char* ct)
yes char* strncat(char* s, const char* ct, size_t n)
yes int strcmp(const char* cs, const char* ct)
yes int strncmp(const char* cs, const char* ct, size_t n)
no int strcoll(const char* cs, const char* ct)
yes char* strchr(const char* cs, int c)
no char* strrchr(const char* cs, int c)
no size_t strspn(const char* cs, const char* ct)
no size_t strcspn(const char* cs, const char* ct)
no char* strpbrk(const char* cs, const char* ct)
yes char* strstr(const char* cs, const char* ct)
yes size_t strlen(const char* cs)
no char* strerror(int n)
no char* strtok(char* s, const char* t)
no size_t strxfrm(char* s, const char* ct, size_t n)
yes void* memcpy(void* s, const void* ct, size_t n)
yes void* memmove(void* s, const void* ct, size_t n)
yes int memcmp(const void* cs, const void* ct, size_t n)
no void* memchr(const void* cs, int c, size_t n)
yes void* memset(void* s, int c, size_t n)
time.h
no clock_t clock(void)
no time_t time(time_t* tp)
no double difftime(time_t time2, time_t time1)
no time_t mktime(struct tm* tp)
no char* asctime(const struct tm* tp)
no char* ctime(const time_t* tp)
no struct tm* gmtime(const time_t* tp)
no struct tm* localtime(const time_t* tp)
no size_t strftime(char* s, size_t smax, const char* fmt, const struct tm* tp)


No Support
Partial Support
Full Support

Usage Example

hello.c:

#include <libpayload.h>

int main(void)
{
    printf("Hello, world!\n");
    halt();
    return 0;
}

Build example:

lpgcc -o hello.elf hello.c


Public domain I, the copyright holder of this work, hereby release it into the public domain. This applies worldwide.

In case this is not legally possible:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.