]>
Commit | Line | Data |
---|---|---|
2aa62f2b | 1 | /** @file\r |
2 | Constructor and Deconstructor functions for <wchar.h>.\r | |
3 | \r | |
4 | Unless explicitly stated otherwise, the functions defined in this file order\r | |
5 | two wide characters the same way as two integers of the underlying integer\r | |
6 | type designated by wchar_t.\r | |
7 | \r | |
7476ad72 | 8 | Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r |
2aa62f2b | 9 | This program and the accompanying materials are licensed and made available under\r |
10 | the terms and conditions of the BSD License that accompanies this distribution.\r | |
11 | The full text of the license may be found at\r | |
53e1e5c6 | 12 | http://opensource.org/licenses/bsd-license.\r |
2aa62f2b | 13 | \r |
14 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
15 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
16 | **/\r | |
17 | #include <Uefi.h>\r | |
53e1e5c6 | 18 | #include <Library/DebugLib.h>\r |
2aa62f2b | 19 | \r |
20 | #include <LibConfig.h>\r | |
21 | \r | |
2aa62f2b | 22 | #include <wchar.h>\r |
23 | \r | |
24 | /* Data initialized by the library constructor */\r | |
25 | UINT8 *__wchar_bitmap = NULL;\r | |
26 | UINTN __wchar_bitmap_size;\r | |
27 | UINTN __wchar_bitmap_64;\r | |
28 | \r | |
29 | EFI_STATUS\r | |
30 | EFIAPI\r | |
31 | __wchar_construct(\r | |
32 | IN EFI_HANDLE ImageHandle,\r | |
33 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
34 | )\r | |
35 | {\r | |
53e1e5c6 | 36 | EFI_STATUS Status;\r |
37 | \r | |
2aa62f2b | 38 | if( __wchar_bitmap == NULL) {\r |
39 | __wchar_bitmap_size = (WCHAR_MAX + 8) / 8U;\r | |
53e1e5c6 | 40 | \r |
41 | Status = SystemTable->BootServices->AllocatePool(\r | |
42 | EfiBootServicesData, __wchar_bitmap_size, (VOID **)&__wchar_bitmap);\r | |
43 | ASSERT(__wchar_bitmap != NULL);\r | |
44 | if (EFI_ERROR (Status)) {\r | |
45 | __wchar_bitmap = NULL;\r | |
6d16cca5 | 46 | return Status;\r |
2aa62f2b | 47 | }\r |
48 | return RETURN_SUCCESS;\r | |
49 | }\r | |
50 | return RETURN_ALREADY_STARTED;\r | |
51 | }\r | |
52 | \r | |
53 | EFI_STATUS\r | |
54 | EFIAPI\r | |
55 | __wchar_deconstruct(\r | |
56 | IN EFI_HANDLE ImageHandle,\r | |
57 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
58 | )\r | |
59 | {\r | |
53e1e5c6 | 60 | EFI_STATUS Status = RETURN_SUCCESS;\r |
61 | \r | |
2aa62f2b | 62 | if( __wchar_bitmap != NULL) {\r |
53e1e5c6 | 63 | Status = SystemTable->BootServices->FreePool( __wchar_bitmap);\r |
64 | ASSERT_EFI_ERROR (Status);\r | |
2aa62f2b | 65 | __wchar_bitmap = NULL;\r |
66 | }\r | |
53e1e5c6 | 67 | return Status;\r |
2aa62f2b | 68 | }\r |