From: John Hodge Date: Thu, 4 Aug 2011 00:14:28 +0000 (+0800) Subject: Kernel - Added %P to vsnprintf, print physical address X-Git-Tag: rel0.10~17 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=a45616f079defd57d6447862ce1663c773db43a2;p=tpg%2Facess2.git Kernel - Added %P to vsnprintf, print physical address - Also added some commenting --- diff --git a/Kernel/lib.c b/Kernel/lib.c index acf36aac..83965cc0 100644 --- a/Kernel/lib.c +++ b/Kernel/lib.c @@ -315,22 +315,29 @@ int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args) } itoa(tmpBuf, val, 10, minSize, pad); goto printString; - case 'u': + case 'u': // Unsigned GETVAL(); itoa(tmpBuf, val, 10, minSize, pad); goto printString; - case 'X': + case 'P': // Physical Address + PUTCH('0'); + PUTCH('x'); + if(sizeof(tPAddr) > 4) isLongLong = 1; + GETVAL(); + itoa(tmpBuf, val, 16, minSize, pad); + goto printString; + case 'X': // Hex if(BITS == 64) isLongLong = 1; // TODO: Handle non-x86 64-bit archs GETVAL(); itoa(tmpBuf, val, 16, minSize, pad); goto printString; - case 'x': + case 'x': // Lower case hex GETVAL(); itoa(tmpBuf, val, 16, minSize, pad); goto printString; - case 'o': + case 'o': // Octal GETVAL(); itoa(tmpBuf, val, 8, minSize, pad); goto printString;