xref: /reactos/boot/environ/lib/misc/rtlcompat.c (revision 1734f297)
1 /*
2 * COPYRIGHT:       See COPYING.ARM in the top level directory
3 * PROJECT:         ReactOS UEFI Boot Manager
4 * FILE:            boot/environ/lib/misc/rtlcompat.c
5 * PURPOSE:         RTL Library Compatibility Routines
6 * PROGRAMMER:      Alex Ionescu (alex.ionescu@reactos.org)
7 */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include "bl.h"
12 
13 /* FUNCTIONS *****************************************************************/
14 
15 #if DBG
16 VOID FASTCALL
17 CHECK_PAGED_CODE_RTL (
18     char *file,
19     int line
20     )
21 {
22     // boot-code is always ok
23 }
24 #endif
25 
26 #ifdef _WIN64
27 PVOID MmHighestUserAddress = (PVOID)0xFFFFFFFFULL; // CHECKME
28 #else
29 PVOID MmHighestUserAddress = (PVOID)0xFFFFFFFF;
30 #endif
31 
32 PVOID
33 NTAPI
34 RtlpAllocateMemory (
35     _In_ ULONG Bytes,
36     _In_ ULONG Tag
37     )
38 {
39     UNREFERENCED_PARAMETER(Tag);
40     return BlMmAllocateHeap(Bytes);
41 }
42 
43 VOID
44 NTAPI
45 RtlpFreeMemory (
46     _In_ PVOID Mem,
47     _In_ ULONG Tag
48     )
49 {
50     UNREFERENCED_PARAMETER(Tag);
51     BlMmFreeHeap(Mem);
52 }
53 
54 NTSTATUS
55 NTAPI
56 RtlpSafeCopyMemory (
57     _Out_writes_bytes_all_(Length) VOID UNALIGNED *Destination,
58     _In_reads_bytes_(Length) CONST VOID UNALIGNED *Source,
59     _In_ SIZE_T Length
60     )
61 {
62     RtlCopyMemory(Destination, Source, Length);
63     return STATUS_SUCCESS;
64 }
65 
66 VOID
67 NTAPI
68 RtlAssert (
69     IN PVOID FailedAssertion,
70     IN PVOID FileName,
71     IN ULONG LineNumber,
72     IN PCHAR Message OPTIONAL
73     )
74 {
75     if (Message != NULL)
76     {
77         EfiPrintf(L"*** ASSERTION \'%S\' FAILED AT line %lu in %S (%S) ***\r\n",
78                   (PCHAR)FailedAssertion,
79                   LineNumber,
80                   (PCHAR)FileName,
81                   Message);
82     }
83     else
84     {
85         EfiPrintf(L"*** ASSERTION \'%S\' FAILED AT line %lu in %S ***\r\n",
86                   (PCHAR)FailedAssertion,
87                   LineNumber,
88                   (PCHAR)FileName);
89     }
90 
91     /* Issue a breakpoint */
92     __debugbreak();
93 }
94 
95 ULONG
96 DbgPrint (
97     const char *Format,
98     ...
99     )
100 {
101     EfiPrintf(L"%S\r\n", Format);
102     return 0;
103 }
104 
105 // FIXME: DECLSPEC_NORETURN
106 VOID
107 NTAPI
108 KeBugCheckEx(
109     _In_ ULONG BugCheckCode,
110     _In_ ULONG_PTR BugCheckParameter1,
111     _In_ ULONG_PTR BugCheckParameter2,
112     _In_ ULONG_PTR BugCheckParameter3,
113     _In_ ULONG_PTR BugCheckParameter4)
114 {
115     __assume(0);
116 }
117