mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-27 07:15:20 +00:00
Align tf_printf implementation between AArch32 and AArch64
No need for these wrapper functions anymore. The compiler-rt builtins provide runtime support for 64-bit division and modulo operations. Change-Id: Ib785d37c86f0c82ebd34c35023a4c1822c03e7df Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
This commit is contained in:
parent
1bd61d0aa2
commit
6ba71d65ac
1 changed files with 0 additions and 80 deletions
|
@ -29,85 +29,6 @@ static void string_print(const char *str)
|
|||
putchar(*str++);
|
||||
}
|
||||
|
||||
#ifdef AARCH32
|
||||
#define unsigned_num_print(unum, radix) \
|
||||
do { \
|
||||
if ((radix) == 16) \
|
||||
unsigned_hex_print(unum); \
|
||||
else if ((radix) == 10) \
|
||||
unsigned_dec_print(unum); \
|
||||
else \
|
||||
string_print("tf_printf : Unsupported radix");\
|
||||
} while (0);
|
||||
|
||||
/*
|
||||
* Utility function to print an unsigned number in decimal format for AArch32.
|
||||
* The function doesn't support printing decimal integers higher than 32 bits
|
||||
* to avoid having to implement 64-bit integer compiler library functions.
|
||||
*/
|
||||
static void unsigned_dec_print(unsigned long long int unum)
|
||||
{
|
||||
unsigned int local_num;
|
||||
/* Just need enough space to store 32 bit decimal integer */
|
||||
unsigned char num_buf[10];
|
||||
int i = 0, rem;
|
||||
|
||||
if (unum > UINT_MAX) {
|
||||
string_print("tf_printf : decimal numbers higher than 32 bits"
|
||||
" not supported\n");
|
||||
return;
|
||||
}
|
||||
|
||||
local_num = (unsigned int)unum;
|
||||
|
||||
do {
|
||||
rem = local_num % 10;
|
||||
num_buf[i++] = '0' + rem;
|
||||
} while (local_num /= 10);
|
||||
|
||||
while (--i >= 0)
|
||||
putchar(num_buf[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Utility function to print an unsigned number in hexadecimal format for
|
||||
* AArch32. The function doesn't use 64-bit integer arithmetic to avoid
|
||||
* having to implement 64-bit compiler library functions. It splits the
|
||||
* 64 bit number into two 32 bit numbers and converts them into equivalent
|
||||
* ASCII characters.
|
||||
*/
|
||||
static void unsigned_hex_print(unsigned long long int unum)
|
||||
{
|
||||
/* Just need enough space to store 16 characters */
|
||||
unsigned char num_buf[16];
|
||||
int i = 0, rem;
|
||||
uint32_t num_local = 0, num_msb = 0;
|
||||
|
||||
/* Get the LSB of 64 bit unum */
|
||||
num_local = (uint32_t)unum;
|
||||
/* Get the MSB of 64 bit unum. This works only on Little Endian */
|
||||
assert((read_sctlr() & SCTLR_EE_BIT) == 0);
|
||||
num_msb = *(((uint32_t *) &unum) + 1);
|
||||
|
||||
do {
|
||||
do {
|
||||
rem = (num_local & 0xf);
|
||||
if (rem < 0xa)
|
||||
num_buf[i++] = '0' + rem;
|
||||
else
|
||||
num_buf[i++] = 'a' + (rem - 0xa);
|
||||
} while (num_local >>= 4);
|
||||
|
||||
num_local = num_msb;
|
||||
num_msb = 0;
|
||||
} while (num_local);
|
||||
|
||||
while (--i >= 0)
|
||||
putchar(num_buf[i]);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void unsigned_num_print(unsigned long long int unum, unsigned int radix)
|
||||
{
|
||||
/* Just need enough space to store 64 bit decimal integer */
|
||||
|
@ -125,7 +46,6 @@ static void unsigned_num_print(unsigned long long int unum, unsigned int radix)
|
|||
while (--i >= 0)
|
||||
putchar(num_buf[i]);
|
||||
}
|
||||
#endif /* AARCH32 */
|
||||
|
||||
/*******************************************************************
|
||||
* Reduced format print for Trusted firmware.
|
||||
|
|
Loading…
Add table
Reference in a new issue