aboutsummaryrefslogtreecommitdiff
path: root/kernel/lib/printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/lib/printf.c')
-rw-r--r--kernel/lib/printf.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/kernel/lib/printf.c b/kernel/lib/printf.c
index fdf474d..c1ef83b 100644
--- a/kernel/lib/printf.c
+++ b/kernel/lib/printf.c
@@ -71,8 +71,7 @@ int vsnprintf(char *buff, size_t len, const char* format, va_list ap){
unsigned int hexa = va_arg(ap,int);
unsigned int nb;
int j, had_nonzero = 0;
- for(j = 0; j < 8; j++)
- {
+ for(j = 0; j < 8; j++) {
nb = (unsigned int)(hexa << (j*4));
nb = (nb >> 28) & 0xf;
// Skip the leading zeros
@@ -91,6 +90,20 @@ int vsnprintf(char *buff, size_t len, const char* format, va_list ap){
PUTCHAR('0');
break;
}
+ case 'p': {
+ unsigned int hexa = va_arg(ap,int);
+ unsigned int nb;
+ int j;
+ for (j = 0; j < 8; j++) {
+ nb = (unsigned int)(hexa << (j*4));
+ nb = (nb >> 28) & 0xf;
+ if (nb < 10)
+ PUTCHAR('0'+nb);
+ else
+ PUTCHAR('a'+(nb-10));
+ }
+ break;
+ }
default:
PUTCHAR('%');
PUTCHAR(format[i]);