summaryrefslogtreecommitdiff
path: root/common/tf_printf.c
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2016-02-02 12:03:38 +0000
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2016-02-18 09:45:39 +0000
commitf0dd061ae64deb016b5197162de3896155816b41 (patch)
tree557697a381aa562ab14c2521db81d00b78008e58 /common/tf_printf.c
parent4a9663062cef254e79189e4fbde85172eb58f9ce (diff)
Add support for %p in tf_printf()
This patch adds support for the `%p` format specifier in tf_printf() following the example of the printf implementation of the stdlib used in the trusted firmware. Fixes ARM-software/tf-issues#292 Change-Id: I0b3230c783f735d3e039be25a9405f00023420da
Diffstat (limited to 'common/tf_printf.c')
-rw-r--r--common/tf_printf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/tf_printf.c b/common/tf_printf.c
index c68b9904..c1d41889 100644
--- a/common/tf_printf.c
+++ b/common/tf_printf.c
@@ -68,6 +68,7 @@ static void string_print(const char *str)
* %u - unsigned 32 bit decimal format
* %ld and %lld - signed 64 bit decimal format
* %lu and %llu - unsigned 64 bit decimal format
+ * %p - pointer format
* Exits on all other formats.
*******************************************************************/
@@ -107,6 +108,14 @@ loop:
str = va_arg(args, char *);
string_print(str);
break;
+ case 'p':
+ unum = (uint64_t)va_arg(args, void *);
+
+ if (unum)
+ string_print("0x");
+
+ unsigned_num_print(unum, 16);
+ break;
case 'x':
if (bit64)
unum = va_arg(args, uint64_t);