1
/* $Id: VBoxPrintHex.c $ */
3
* VBoxPrintHex.c - Implementation of the VBoxPrintHex() debug logging routine.
7
* Copyright (C) 2009-2010 Sun Microsystems, Inc.
9
* This file is part of VirtualBox Open Source Edition (OSE), as
10
* available from http://www.virtualbox.org. This file is free software;
11
* you can redistribute it and/or modify it under the terms of the GNU
12
* General Public License (GPL) as published by the Free Software
13
* Foundation, in version 2 as it comes in the "COPYING" file of the
14
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18
* Clara, CA 95054 USA or visit http://www.sun.com if you need
19
* additional information or have any questions.
24
/*******************************************************************************
26
*******************************************************************************/
27
#include "VBoxDebugLib.h"
33
* @param ch The char to print.
35
DECLINLINE(void) vboxPrintHexChar(int ch)
37
ASMOutU8(EFI_DEBUG_PORT, (uint8_t)ch);
42
* Print a hex number, up to 64-bit long.
44
* @returns Number of chars printed.
46
* @param uValue The value.
47
* @param cbType The size of the value type.
49
size_t VBoxPrintHex(UINT64 uValue, size_t cbType)
51
static const char s_szHex[17] = "0123456789abcdef";
55
vboxPrintHexChar(s_szHex[(uValue >> 60) & 0xf]);
56
vboxPrintHexChar(s_szHex[(uValue >> 56) & 0xf]);
57
vboxPrintHexChar(s_szHex[(uValue >> 52) & 0xf]);
58
vboxPrintHexChar(s_szHex[(uValue >> 48) & 0xf]);
59
vboxPrintHexChar(s_szHex[(uValue >> 44) & 0xf]);
60
vboxPrintHexChar(s_szHex[(uValue >> 40) & 0xf]);
61
vboxPrintHexChar(s_szHex[(uValue >> 36) & 0xf]);
62
vboxPrintHexChar(s_szHex[(uValue >> 32) & 0xf]);
64
vboxPrintHexChar(s_szHex[(uValue >> 28) & 0xf]);
65
vboxPrintHexChar(s_szHex[(uValue >> 24) & 0xf]);
66
vboxPrintHexChar(s_szHex[(uValue >> 20) & 0xf]);
67
vboxPrintHexChar(s_szHex[(uValue >> 16) & 0xf]);
69
vboxPrintHexChar(s_szHex[(uValue >> 12) & 0xf]);
70
vboxPrintHexChar(s_szHex[(uValue >> 8) & 0xf]);
72
vboxPrintHexChar(s_szHex[(uValue >> 4) & 0xf]);
73
vboxPrintHexChar(s_szHex[(uValue ) & 0xf]);