-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathGlue.c
111 lines (92 loc) · 2.18 KB
/
Glue.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//
// Copyright (c) 2017, Linaro, Ltd. <[email protected]>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
#include "X86Emulator.h"
#include <Library/CacheMaintenanceLib.h>
#include <Library/PrintLib.h>
VOID
flush_icache_range (
IN UINTN Start,
IN UINTN End
)
{
InvalidateInstructionCacheRange ((VOID *)Start, End - Start + 1);
}
VOID
longjmp (
IN VOID *env,
IN INT32 val
)
{
LongJump((BASE_LIBRARY_JUMP_BUFFER *)env, (UINTN)((val == 0) ? 1 : val));
}
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL **stdout;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL **stderr;
UINTN
AsciiInternalPrint (
IN CONST CHAR8 *Format,
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console,
IN VA_LIST Marker
);
INT32
vfprintf (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL **stream,
IN CONST CHAR8 *format,
VA_LIST ap
)
{
ASSERT (stream == stdout || stream == stderr);
return (INT32)AsciiInternalPrint (format, *stream, ap);
}
INT32
fprintf (
IN VOID *stream,
IN CONST CHAR8 *format,
...)
{
VA_LIST Marker;
INT32 Result;
VA_START (Marker, format);
Result = vfprintf(stream, format, Marker);
VA_END (Marker);
return Result;
}
INT32
printf (
IN CONST CHAR8 *format,
...)
{
VA_LIST Marker;
INT32 Result;
VA_START (Marker, format);
Result = vfprintf(stdout, format, Marker);
VA_END (Marker);
return Result;
}
INT32
snprintf (
OUT CHAR8 *str,
IN UINTN sizeOfBuffer,
IN CONST CHAR8 *format,
...)
{
VA_LIST Marker;
INT32 NumberOfPrinted;
VA_START (Marker, format);
NumberOfPrinted = (INT32)AsciiVSPrint (str, sizeOfBuffer, format, Marker);
VA_END (Marker);
return NumberOfPrinted;
}
INT32
strcmp (
IN CONST CHAR8 *s1,
IN CONST CHAR8 *s2
)
{
return AsciiStrCmp (s1, s2);
}