]>
Commit | Line | Data |
---|---|---|
9071550e | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | Debug.c\r | |
14 | \r | |
15 | Abstract:\r | |
16 | \r | |
17 | Revision History:\r | |
18 | \r | |
19 | --*/\r | |
20 | #include "EfiLdr.h"\r | |
21 | #include "Debug.h"\r | |
22 | \r | |
23 | UINT8 *mCursor;\r | |
24 | UINT8 mHeaderIndex = 10;\r | |
25 | \r | |
26 | VOID\r | |
27 | PrintHeader (\r | |
28 | CHAR8 Char\r | |
29 | )\r | |
30 | {\r | |
31 | *(UINT8 *)(UINTN)(0x000b8000 + mHeaderIndex) = Char;\r | |
32 | mHeaderIndex += 2;\r | |
33 | }\r | |
34 | \r | |
35 | VOID\r | |
36 | ClearScreen (\r | |
37 | VOID\r | |
38 | )\r | |
39 | {\r | |
40 | UINT32 Index;\r | |
41 | \r | |
42 | mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);\r | |
43 | for (Index = 0; Index < 80 * 49; Index++) {\r | |
44 | *mCursor = ' ';\r | |
45 | mCursor += 2;\r | |
46 | }\r | |
47 | mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);\r | |
48 | }\r | |
49 | \r | |
50 | VOID\r | |
51 | PrintValue64 (\r | |
52 | UINT64 Value\r | |
53 | )\r | |
54 | {\r | |
55 | PrintValue ((UINT32) RShiftU64 (Value, 32));\r | |
56 | PrintValue ((UINT32) Value);\r | |
57 | }\r | |
58 | \r | |
59 | VOID\r | |
60 | PrintValue (\r | |
61 | UINT32 Value\r | |
62 | )\r | |
63 | {\r | |
64 | UINT32 Index;\r | |
65 | UINT8 Char;\r | |
66 | \r | |
67 | for (Index = 0; Index < 8; Index++) {\r | |
e188a609 | 68 | Char = (UINT8)(((Value >> ((7 - Index) * 4)) & 0x0f) + '0');\r |
9071550e | 69 | if (Char > '9') {\r |
e188a609 | 70 | Char = (UINT8) (Char - '0' - 10 + 'A');\r |
9071550e | 71 | }\r |
72 | *mCursor = Char;\r | |
73 | mCursor += 2;\r | |
74 | }\r | |
75 | }\r | |
76 | \r | |
77 | VOID\r | |
78 | PrintString (\r | |
e188a609 | 79 | CHAR8 *String\r |
9071550e | 80 | )\r |
81 | {\r | |
82 | UINT32 Index;\r | |
83 | \r | |
84 | for (Index = 0; String[Index] != 0; Index++) {\r | |
85 | if (String[Index] == '\n') {\r | |
86 | mCursor = (UINT8 *)(UINTN)(0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));\r | |
87 | } else {\r | |
88 | *mCursor = String[Index];\r | |
89 | mCursor += 2;\r | |
90 | }\r | |
91 | }\r | |
92 | }\r | |
93 | \r |