aboutsummaryrefslogtreecommitdiff
path: root/kernel/lib/printf.c
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2014-12-01 17:24:38 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2014-12-01 17:24:38 +0100
commit0921a33fc9f3724cb36a03a24b58b0a5bfc519b1 (patch)
tree6f3db52ba8c38928749806cb2d94ca548b3b19bd /kernel/lib/printf.c
parent6f11c9e5c15cc8ef936741e5ee7575b731a47e0f (diff)
downloadmacroscope-0921a33fc9f3724cb36a03a24b58b0a5bfc519b1.tar.gz
macroscope-0921a33fc9f3724cb36a03a24b58b0a5bfc519b1.zip
Advance HH, GDT, IDT (details below)
- Implement higher-half in loader with paging (using 4Mb pages) - Add GDT installation code - Add IDT installation code (spend a loong time debugging the ISRs!) - Add CDROM generation scripts - Add scripts to launch bochs (debug) and qemu (debug)
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]);