This repository has been archived by the owner on Jul 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Adding vsprintf to kernel source
jerrinsg edited this page Apr 18, 2012
·
3 revisions
- Obtain Linux Kernel 0.10 source from link
- Extract source and find vsprintf source at linux-0.10/kernel/vsprintf.c
- Requires header file stdarg.h. Find header file at linux-0.10/include/stdarg.h. Create a copy in the source directory of our 32 bit kernel.
- vsprintf requires implementation of string manipulative functions. Find strlen() function implementation at link under the section 'Improving pipeline effect'
- Add implementation of strlen() to file common.c . Add prototype to common.h
- Copy necessary function implementations [int vsprintf(char *buf, const char *fmt, va_list args)] [static char * number(char * str, int num, int base, int size, int precision ,int type)] [static int skip_atoi(const char **s)] and #define tags from vsprintf.c into the source file monitor.c. Remember to include "stdarg.h" in monitor.c
- Function prototype for vsprintf and other functions need not be added in monitor.h. Do not include "stdarg.h" in any other header/source files.
- To test vsprintf, refer source at link
- Source help :
- Add "stdarg.h" to main.c
- Give defintion for vout function exactly as given (including third argument ... ! )
- vout copies the string with the given format into the argument 'string'
- use monitor_write to print string.
- supported formats are %s %d , rest to be explored!