From f0dd061ae64deb016b5197162de3896155816b41 Mon Sep 17 00:00:00 2001 From: Antonio Nino Diaz Date: Tue, 2 Feb 2016 12:03:38 +0000 Subject: 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 --- common/tf_printf.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'common/tf_printf.c') 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); -- cgit