From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.92.67.72]) by mx.groups.io with SMTP id smtpd.web11.9001.1575325065365227157 for ; Mon, 02 Dec 2019 14:17:46 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: outlook.de, ip: 40.92.67.72, mailfrom: mhaeuser@outlook.de) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CDWyfkiVWaFzUy/8pqL/REDZsjmz74GMMe6lKNe/P/Fu5fdvY/Gzoa4ErmahYtLBcWbCA63wffaTnY/jRaEa2vu8zJPUpyiqd/eEiznBjJRC9mwOUc5BfKqdutHmxyBcoumLOsM25kOWmOeA2xxjyk7d/ho1L/JaLe5nenSX1iR+D/zJvdhqKNA/v9bAslI3DxEHANp+Ki7LTcumlII2yaAttyqVZfKS7VfhtQVJsJCtoXIjqkqD6Am5HEWpFuvzTMShTGr1/KtFyGUDa9LKxUx6uVjzkMDK8bx44mRBuMOfpujxP45BRAdPYgxhEh6o8OIoWDuQPybzsU/InW75rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=95FivoJegJpTm2AEdVGkEEYy+po77D5GUS/lW2X1jlo=; b=YZ3OKWtQ+dm3Cc/BuskmrE7PPuMRXG5cDdmL8PQ5dboHPUl70QxGyd/Yd5C0iyxi2dqSdOps4Du2uXr8cabXAiiN7qnQ1BCAoxGqDgR2eW8MRnx5S/D+f1FbesTDCVrGUqmH6nomg4EGBZSVRuBb0JY76Yfi7HgXOXUfgKtYQuyLYCEFZ23/ftklOZrFSgUDLirEPC1bHkWpIhL6VbFSvbxaeysfEd5LSy2sZTrcu2PzzY/5b9TmBD7enQTfEI/IQdIMCCbFL/YNnSlu9q9nbvFuw+AQqs3HJlDRQeyhV9jjYs1tLzCwb4/WL+SMmHWIIUEQvM4ZeVBIC7Z09GKLpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=outlook.de; dmarc=pass action=none header.from=outlook.de; dkim=pass header.d=outlook.de; arc=none Received: from VE1EUR02FT027.eop-EUR02.prod.protection.outlook.com (10.152.12.60) by VE1EUR02HT221.eop-EUR02.prod.protection.outlook.com (10.152.13.253) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.18; Mon, 2 Dec 2019 22:17:42 +0000 Received: from AM6PR07MB5859.eurprd07.prod.outlook.com (10.152.12.55) by VE1EUR02FT027.mail.protection.outlook.com (10.152.12.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.18 via Frontend Transport; Mon, 2 Dec 2019 22:17:42 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:3FD5DA991A137B1161C106E1B2ABE87FA1676559286C1DA18ED835B69A501124;UpperCasedChecksum:651CD2FCF0E7B5DD0D3CC77470AA47F86D73107E8F7213C65105D00370FBA60D;SizeAsReceived:8048;Count:47 Received: from AM6PR07MB5859.eurprd07.prod.outlook.com ([fe80::edda:1279:2ef6:da91]) by AM6PR07MB5859.eurprd07.prod.outlook.com ([fe80::edda:1279:2ef6:da91%4]) with mapi id 15.20.2516.003; Mon, 2 Dec 2019 22:17:42 +0000 Subject: Re: [edk2-devel] CdePkg - added unit test for ASSERT.H and LOCALE.H functions To: devel@edk2.groups.io, KILIAN_KEGEL@OUTLOOK.COM Cc: "Kinney, Michael D" , "Richardson, Brian" References: From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= Message-ID: Date: Mon, 2 Dec 2019 23:17:42 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 In-Reply-To: X-ClientProxiedBy: AM0PR07CA0032.eurprd07.prod.outlook.com (2603:10a6:208:ac::45) To AM6PR07MB5859.eurprd07.prod.outlook.com (2603:10a6:20b:37::21) Return-Path: mhaeuser@outlook.de X-Microsoft-Original-Message-ID: MIME-Version: 1.0 Received: from [192.168.1.234] (95.89.0.25) by AM0PR07CA0032.eurprd07.prod.outlook.com (2603:10a6:208:ac::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2516.6 via Frontend Transport; Mon, 2 Dec 2019 22:17:42 +0000 X-Microsoft-Original-Message-ID: X-TMN: [zk7/Q038ZuAG5vKondGsCSjvSnaF0m5v] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: e5241c56-df03-463c-1735-08d77775732a X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEslM7TFn0cQW3xUlE9vaNL2fFYK6UJqJNEz6J23HKVfMOFtps8bNrwkXaRYrYRGiAay01n9DqKBQXDFObqzFsnKA0IDr4slfu+T/Iq7UzXyWbwfK2+4mgDUG+7g0mXz2RMwmgHJ/OU6GEolmY7DWlwfTBF3I4nYic/F0LS2G2PYve27b6HiW3yj2iJxceC3hHJKkqahplogf81SRWAsXL373lbfKPstfltDtg1aoHGHqjbM44TsK47XSD//TituzQYk46fvJ+JGqa8yoviAfiWbI10ibLnyKDfp/pD3hzzFJdTHiAtrlwIxx0ew6XjVg9ynu8OD1WL6IMURZy5lgWRIjgURFjGQDGWfiRn7uOa9fZ9itVKU5cJdRd5IJ0+LU4XUBqQGFdT6b4+24jeG5zBngpyuNGeL2XWwhtN+QqiH2YFpu1N81C5d/eEmeMDaZimG7V7VhLe1mEr4EQngXnAdzYVM7IKv/ruykVSOssfwzX1WXPJ/MP8Vo37K78ABqAhTRIC5OnfRIkHq8zrXaWjWw8k4HoYagNFh8CPMbss1pfCd4HWT6nIxFT4VLgwIWP+ENO86J98Jt2sluM4pDvipGJCX0hydGDPr7eaK1SOc4dtLgyaohbyCVGNcdN+K/qRWuT6r64vbzeHBiSzEHjiaCXuNjcYl4Mtfj4lNJoUxDDv7sy2YifX8PhbbBy+3Eml4BJqFeS3YXJhhp9szg0XdLkTBVcUU928BOHzHHifnwp9JkfZVwi4pZ7EOU8IJ8Dr41pMIO7eCcN3YZECct2in X-MS-TrafficTypeDiagnostic: VE1EUR02HT221: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t3fHTLo7KKEgSMDAnqCcIcpGJNaO91A86UgufQvT3WUpO+Ed/71s2Zodtgbr6SPePYVwhaKO0fFxGC5SOsjj1DzGOsfpUgSVgksQMQkcHXgetc1S+tOzmSOqa6zHFoEWUBWrfFTMp/qYgGXxwXppvfM+3czJiS8l0ytzVnRMTIhc5SQWNDKRM9vyurfHEwLqj7RniAP3A7KDfSthSuEVayz7ekNpzwFShSCJC7DnccI= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5241c56-df03-463c-1735-08d77775732a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2019 22:17:42.8488 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR02HT221 Content-Type: multipart/alternative; boundary="------------0F2D931FCF6C2770FB1796B8" --------------0F2D931FCF6C2770FB1796B8 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Good day, I have seen e-mails about this package several times now and got a bit curious about its purpose and future. As far as I understood it, it aims to provide an actual full C standard library implementation. Is this planned to land in edk2 and if so, in what ways will one be encouraged to use it? Usually it's considered best practice to keep the code quantity in low levels to a minimum, and I do not think even most kernel spaces implement a *full* C standard library for this reason. Will it be a first-class citizen, properly reviewed, and is there a chance the rest of edk2 is (very slowly) transfered to a standard C stack? Or will it "just" be a handy set of libraries for porting purposes? Especially in latter case, this, to me intuitively, sounds like a maintainance and reviewing nightmare, but I'm happy to hear about the future plans if you're willing to share them. Best regards, Marvin Am 02.12.2019 um 21:37 schrieb Kilian Kegel: > > Hi UEFI community, > > I’d like to inform you about an update in the *CdePkg* branch of >  edk2-staging. > > https://github.com/tianocore/edk2-staging/tree/CdePkg#cdepkg > > The goal of the *CdePkg* is to provide an *ANSI C Interface* for UEFI > POST drivers, > > that enables BIOS engineers to (more) easily port standard C programs > or libraries > > (e.g. the openSSL library, already done) to POST drivers. > > Furthermore the *ANSI C Interface* is disseminated widely, also it’s > bugs and pitfalls are known very well > > by a broad range of IT professionals and may help to be better > supportable by the open source initiative > > compared to the proprietary interface that is available today in > Tianocore UEFI. > > Now *3*new ANSI C functions *_w**assert()* *from ASSERT.H* and > *setlocale(), localeconv()**from LOCALE.H*** > > are introduced for *PEI* and *DXE*. > > Currently there are *13* examples implemented, demonstrating all in > all *110* functions defined by ANSI C: > > 1. *argvc: > *https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/HOSTED_ENV/argcv/main.c#L57*//* > > argc/argv handling according to > https://msdn.microsoft.com/en-us/library/a1y7w461.aspx > > > 2. *systeminterfacePEI*: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfacePEI/main.c#L57 > > demonstration, how *PeiServices*and *FileHandle*are passed into *main()* > > 3. *systeminterfaceDXE*: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfaceDXE/main.c#L57 > > demonstration, how *SystemTable*and *ImageHandle*are passed into *main()* > > *__* > > *_ANSI C LIBRARY functions:_* > > 4. *time.h > **clock()*:https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/TIME_H/clock/main.c#L1 > > for PEI and DXE phase. It provides TSC based, millisecond precise, > exact and chipset independent *clock() *function. > > *NOTE: in emulation mode the TSC nominal frequency is supposed to be 1GHz* > > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/clock?view=vs-2019 > > 5. *time.h **difftime()*: > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/difftime-difftime32-difftime64?view=vs-2019 > > *time.h **mktime()*: > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/mktime-mktime32-mktime64?view=vs-2019 > <%20https:/docs.microsoft.com/en-us/cpp/c-runtime-library/reference/mktime-mktime32-mktime64?view=vs-2019> > > *time.h **time()*: > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32-time64?view=vs-2019 > <%20https:/docs.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32-time64?view=vs-2019> > > *time.h **asctime()*: > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/asctime-wasctime?view=vs-2019 > > *time.h c**time()*: > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/ctime-ctime32-ctime64-wctime-wctime32-wctime64?view=vs-2019 > > *time.h gm**time()*: > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/gmtime-gmtime32-gmtime64?view=vs-2019 > > *time.h local**time()*: > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/localtime-localtime32-localtime64?view=vs-2019 > > *time.h strf**time()*: > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?view=vs-2019 > > *NOTE: All TIME.H functions support UTC only.* > > All functions are tested in one single driver PEI/DXE: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/TIME_H/timehfunctions/main.c#L52 > > 6. *STRING.H > **memcpy():*https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memcpy-wmemcpy?view=vs-2019 > > *STRING.H > **memmove():*https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memmove-wmemmove?view=vs-2019** > > *STRING.H strcpy(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcpy-wcscpy-mbscpy?view=vs-2019 > > *STRING.H **strncpy(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncpy-strncpy-l-wcsncpy-wcsncpy-l-mbsncpy-mbsncpy-l?view=vs-2019 > > *STRING.H **strcat(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcat-wcscat-mbscat?view=vs-2019 > > *STRING.H **strncat(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncat-strncat-l-wcsncat-wcsncat-l-mbsncat-mbsncat-l?view=vs-2019 > > *STRING.H **memcmp(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memcmp-wmemcmp?view=vs-2019 > > *STRING.H **strcmp(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcmp-wcscmp-mbscmp?view=vs-2019 > > *STRING.H **strncmp(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncmp-wcsncmp-mbsncmp-mbsncmp-l?view=vs-2019 > > *STRING.H **memchr(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memchr-wmemchr?view=vs-2019 > > *STRING.H **strchr(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strchr-wcschr-mbschr-mbschr-l?view=vs-2019 > > *STRING.H **strcspn(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcspn-wcscspn-mbscspn-mbscspn-l?view=vs-2019 > > *STRING.H **strpbrk(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strpbrk-wcspbrk-mbspbrk-mbspbrk-l?view=vs-2019 > > *STRING.H **strrchr(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strrchr-wcsrchr-mbsrchr-mbsrchr-l?view=vs-2019 > > *STRING.H **strspn(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strspn-wcsspn-mbsspn-mbsspn-l?view=vs-2019 > > *STRING.H **strstr(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l?view=vs-2019 > > *STRING.H **strtok(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l?view=vs-2019 > > *STRING.H **memset(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memset-wmemset?view=vs-2019 > > *STRING.H **strerror(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strerror-strerror-wcserror-wcserror?view=vs-2019 > > *STRING.H **strlen(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l?view=vs-2019 > > *NOTE: All STRING.H functions are completely available in PEI and DXE, > except strcoll() and strxftm()* > > All functions are tested in one single driver PEI/DXE: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/STRING_H/stringhfunctions/main.c#L52 > > 7. *WCHAR.H **wprintf(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/printf-printf-l-wprintf-wprintf-l?view=vs-2019 > > *WCHAR.H **swprintf(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/sprintf-sprintf-l-swprintf-swprintf-l-swprintf-l?view=vs-2019** > > *WCHAR.H **vswprintf(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsprintf-vsprintf-l-vswprintf-vswprintf-l-vswprintf-l?view=vs-2019 > > *WCHAR.H **wcscpy(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcpy-wcscpy-mbscpy?view=vs-2019 > > *WCHAR.H **wcsncpy(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncpy-strncpy-l-wcsncpy-wcsncpy-l-mbsncpy-mbsncpy-l?view=vs-2019 > > *WCHAR.H **wcscat(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcat-wcscat-mbscat?view=vs-2019** > > *WCHAR.H **wcsncat(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncat-strncat-l-wcsncat-wcsncat-l-mbsncat-mbsncat-l?view=vs-2019 > > *WCHAR.H **wcscmp(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcmp-wcscmp-mbscmp?view=vs-2019 > > *WCHAR.H **wcsncmp(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncmp-wcsncmp-mbsncmp-mbsncmp-l?view=vs-2019 > > *WCHAR.H **wcschr(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strchr-wcschr-mbschr-mbschr-l?view=vs-2019 > > *WCHAR.H **wcscspn(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcspn-wcscspn-mbscspn-mbscspn-l?view=vs-2019** > > *WCHAR.H **wcspbrk(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strpbrk-wcspbrk-mbspbrk-mbspbrk-l?view=vs-2019** > > *WCHAR.H **wcsrchr*(): > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strrchr-wcsrchr-mbsrchr-mbsrchr-l?view=vs-2019** > > *WCHAR.H **wcsspn(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strspn-wcsspn-mbsspn-mbsspn-l?view=vs-2019** > > *WCHAR.H **wcsstr(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strstr-wcsstr-mbsstr-mbsstr-l?view=vs-2019 > > *WCHAR.H **wcstok(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l?view=vs-2019 > > *WCHAR.H **wcslen(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l?view=vs-2019 > > *WCHAR.H **wmemcmp(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memcmp-wmemcmp?view=vs-2019** > > *WCHAR.H **wmemcpy(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memcpy-wmemcpy?view=vs-2019** > > *WCHAR.H **wmemmove(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memmove-wmemmove?view=vs-2019** > > *WCHAR.H **wmemset(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memset-wmemset?view=vs-2019 > > *NOTE: 21 WCHAR.H functions are available in PEI and DXE. 29 functions > are not yet implemented, that are file and multi byte functions* > > All functions are tested in one single driver PEI/DXE: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/WCHAR_H/wcharhfunctions/main.c > > > 8. *STDIO.H**tmpnam(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tempnam-wtempnam-tmpnam-wtmpnam?view=vs-2019** > > *STDIO.H**printf(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/printf-printf-l-wprintf-wprintf-l?view=vs-2019 > > *STDIO.H**snprintf(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=vs-2019** > > *STDIO.H**sprintf(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/sprintf-sprintf-l-swprintf-swprintf-l-swprintf-l?view=vs-2019** > > *STDIO.H**vsnprintf(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsnprintf-vsnprintf-vsnprintf-l-vsnwprintf-vsnwprintf-l?view=vs-2019** > > *STDIO.H**vsscanf(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsscanf-vswscanf?view=vs-2019** > > *STDIO.H**sscanf(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/sscanf-sscanf-l-swscanf-swscanf-l?view=vs-2019** > > *STDIO.H**vprintf(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vprintf-vprintf-l-vwprintf-vwprintf-l?view=vs-2019** > > *STDIO.H**vsprintf(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsprintf-vsprintf-l-vswprintf-vswprintf-l-vswprintf-l?view=vs-2019** > > *NOTE: 9 STDIO.H functions are available in PEI and DXE. 36 functions > are not implemented for POST drivers because of file I/O (it is > standard IO dot h)* > > *NOTE: snprintf(), vsnprintf() and vsscanf() are C99 and implemented > due to their usefulness for security related software* > > *NOTE: printf() and vprintf() write to ConOut that is actually not > visible in PEI and DXE, but in the Emulator.* > > All functions are tested in one single driver PEI/DXE: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/STDIO_H/stdiohfunctions/main.c > > 9. *STDLIB.H atoi(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/atoi-atoi-l-wtoi-wtoi-l?view=vs-2019*** > > *STDLIB.H atol(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/atol-atol-l-wtol-wtol-l?view=vs-2019*** > > *STDLIB.H strtol(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strtol-wcstol-strtol-l-wcstol-l?view=vs-2019*** > > *STDLIB.H strtoul(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strtoul-strtoul-l-wcstoul-wcstoul-l?view=vs-2019*** > > *STDLIB.H rand(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/rand?view=vs-2019*** > > *STDLIB.H srand(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/srand?view=vs-2019*** > > *STDLIB.H calloc(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/calloc?view=vs-2019*** > > *STDLIB.H free(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/free?view=vs-2019*** > > *STDLIB.H malloc(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/malloc?view=vs-2019*** > > *STDLIB.H realloc(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/realloc?view=vs-2019*** > > *STDLIB.H atexit(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/atexit?view=vs-2019*** > > *STDLIB.H exit(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/exit-exit-exit?view=vs-2019*** > > *STDLIB.H qsort(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/qsort?view=vs-2019*** > > *STDLIB.H abs(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/abs-labs-llabs-abs64?view=vs-2019*** > > *STDLIB.H labs(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/abs-labs-llabs-abs64?view=vs-2019*** > > *STDLIB.H div(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/div?view=vs-2019*** > > *STDLIB.H ldiv(): > **https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/div?view=vs-2019*** > > *NOTE: missing from STDLIB.H: abort(), strtod(), atof(), getenv(), > system(), bsearch()* > > All functions are tested in one single driver PEI/DXE: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/STDLIB_H/stdlibhfunctions/main.c > > 10. *CTYPE.**H isalnum()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isalnum-iswalnum-isalnum-l-iswalnum-l?view=vs-2019 > > *CTYPE.H **isalpha()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isalpha-iswalpha-isalpha-l-iswalpha-l?view=vs-2019 > > *CTYPE.H **iscntrl()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/iscntrl-iswcntrl-iscntrl-l-iswcntrl-l?view=vs-2019 > > *CTYPE.H **isdigit()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isdigit-iswdigit-isdigit-l-iswdigit-l?view=vs-2019 > > *CTYPE.H **isgraph()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isgraph-iswgraph-isgraph-l-iswgraph-l?view=vs-2019 > > *CTYPE.H **islower()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/islower-iswlower-islower-l-iswlower-l?view=vs-2019 > > *CTYPE.H **isprint()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isprint-iswprint-isprint-l-iswprint-l?view=vs-2019 > > *CTYPE.H **ispunct()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/ispunct-iswpunct-ispunct-l-iswpunct-l?view=vs-2019 > > *CTYPE.H **isspace()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isspace-iswspace-isspace-l-iswspace-l?view=vs-2019 > > *CTYPE.H **isupper()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isupper-isupper-l-iswupper-iswupper-l?view=vs-2019 > > *CTYPE.H **isxdigit()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isxdigit-iswxdigit-isxdigit-l-iswxdigit-l?view=vs-2019 > > *CTYPE.H **tolower()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tolower-tolower-towlower-tolower-l-towlower-l?view=vs-2019 > > *CTYPE.H **toupper()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/toupper-toupper-towupper-toupper-l-towupper-l?view=vs-2019 > > *NOTE: C locale support only* > > All functions are tested in one single driver PEI/DXE: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/CTYPE_H/ctypehfunctions/main.c > > 11. *WCTYPE.H **iswalnum()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isalnum-iswalnum-isalnum-l-iswalnum-l?view=vs-2019 > > *WCTYPE.H **iswalpha(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isalpha-iswalpha-isalpha-l-iswalpha-l?view=vs-2019 > > *WCTYPE.H **iswblank(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isblank-iswblank-isblank-l-iswblank-l?view=vs-2019 > > *WCTYPE.H **iswcntrl(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/iscntrl-iswcntrl-iscntrl-l-iswcntrl-l?view=vs-2019 > > *WCTYPE.H **iswdigit(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isdigit-iswdigit-isdigit-l-iswdigit-l?view=vs-2019 > > *WCTYPE.H **iswgraph(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isgraph-iswgraph-isgraph-l-iswgraph-l?view=vs-2019 > > *WCTYPE.H **iswlower(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/islower-iswlower-islower-l-iswlower-l?view=vs-2019 > > *WCTYPE.H **iswprint(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isprint-iswprint-isprint-l-iswprint-l?view=vs-2019 > > *WCTYPE.H **iswpunct(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/ispunct-iswpunct-ispunct-l-iswpunct-l?view=vs-2019 > > *WCTYPE.H **iswspace(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isspace-iswspace-isspace-l-iswspace-l?view=vs-2019 > > *WCTYPE.H **iswupper(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isupper-isupper-l-iswupper-iswupper-l?view=vs-2019 > > *WCTYPE.H **iswxdigit(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isxdigit-iswxdigit-isxdigit-l-iswxdigit-l?view=vs-2019 > > *WCTYPE.H **iswctype(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isctype-iswctype-isctype-l-iswctype-l?view=vs-2019 > > *WCTYPE.H **wctype(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/wctype?view=vs-2019 > > *WCTYPE.H **towlower(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tolower-tolower-towlower-tolower-l-towlower-l?view=vs-2019 > > *WCTYPE.H **towupper(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/toupper-toupper-towupper-toupper-l-towupper-l?view=vs-2019 > > *WCTYPE.H **towctrans(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/towctrans?view=vs-2019 > > *WCTYPE.H **wctrans(): > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/wctrans?view=vs-2019 > > *NOTE: C locale support only* > > All functions are tested in one single driver PEI/DXE: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/WCTYPE_H/wctypehfunctions/main.c > > 12. *NEW ASSERT.**H _wassert()**: > *https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/assert-macro-assert-wassert?view=vs-2019 > > *NOTE: assert() does NOT run into dead loop.* > > All functions are tested in one single driver PEI/DXE: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/ASSERT_H/asserthfunctions/main.c > ** > > 13. *NEW LOCALE.**H localeconv()**:* > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/localeconv?view=vs-2019 > > *NEW LOCALE.**H > setlocale()**:*https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale?view=vs-2019 > > *NOTE: locale functions are provided for compatibility. Only “C” > locale is supported only.* > > All functions are tested in one single driver PEI/DXE: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/LOCALE_H/localehfunctions/main.c > > > Best Regards, > > Kilian > > *From: *Kilian Kegel > *Sent: *Wednesday, October 23, 2019 10:03 PM > *To: *devel@edk2.groups.io > *Cc: *Kinney, Michael D ; > Richardson, Brian > *Subject: *[edk2-devel] [staging/branch]: CdePkg - C Development > Environment Package > > Hi UEFI community, > > I’d like to introduce the CdePkg to edk2-staging. > > Some time ago I decided to write my own ANSI C Library for UEFI Shell > and POST. > > The UEFI Shell library (“Torito C Library”) has been production-ready > for more than one year. > > The POST version of the library (“CdeLib”) is not yet fully tested. > > I will be demonstrating my verification procedure in the upcoming > weeks on EDK2 STAGING > https://github.com/tianocore/edk2-staging/tree/CdePkg > > Currently there are 3 examples implemented: > > 14. *argvc: > *https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/HOSTED_ENV/argcv/main.c#L57*//* > > argc/argv handling according to > https://msdn.microsoft.com/en-us/library/a1y7w461.aspx > > > 15. *systeminterfacePEI*: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfacePEI/main.c#L57 > > demonstration, how *PeiServices*and *FileHandle*are passed into *main()* > > 16. *systeminterfaceDXE*: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfaceDXE/main.c#L57 > > demonstration, how *SystemTable*and *ImageHandle*are passed into *main()* > > ** > > Upcoming next demonstration will be the *clock()*function end of this week > > The idea is to bring the ANSI C Library interface into POST drivers. > > This will: > > 1. ease porting tasks > 2. allow cross development > 3. allow developers to focus on their aims, because they aren’t > forced to keep in mind a lot of additional info (e.g. *RShiftU64*) > 4. provide all intrisics to allow the compiler to be a “C compiler” > > (e.g. *char buffer[256] = { 1*};) > > What is CdePkg and Torito C Library? > > * CdePkg and Torito C Library are a /one man show / after work > party/, that is owned and written solely by myself > * CdePkg is a reference implementation only for Microsoft C compiler > * CdePkg is a feasibility study > * CdePkg is the successor of Torito C, based on the same source code > * CdePkg C Development Environment is similar to  MdePkg Module > Development Environment > > but guarantees  that the C compiler is always fully usable (all > intrinsics available) and the C90/C95 standard library is always available > > What are the design goals? > > * to rewrite the whole thing from scratch, without using any public > source code from GNU, BSD, Watcom > * completeness: full blown C90 + C95 support, as lowest common > denominator > * tailored for UEFI: small code size, for UEFI-POST-driver uses a > C-Library-Driver, that contains core/worker functions for > *realloc()* == *malloc()*and*free()*, > > entire*printf()*-family, entire*scanf()*-family. > > UEFI-POST-driver just uses small wrapper functions to run the > C-Library-Driver code. > > * stable, exact, chipset independent TSC based *clock()* > with*CLOCKS_PER_SEC* == 1000 > * complete set of the Microsoft C-compiler intrinsic functions > * ROM-able! Runs with stack but w/o any static storage duration in > .data segment, e.g. for *rand(), strtok(), tmpfile()*** > > This is required for early PEI before memory sizing, when PEI-images > run directly out of flash > > * Microsoft (bug) compatible (as far as possible) > > 1. use original Microsoft header files for UEFI Shell Apps > created in VS2019 > 2. allow expensive debugging tasks of ANSI C .EFI applications in > Visual Studio in its Windows NT counter part > 3. to save my lifetime writing a documentation > https://github.com/tianocore/edk2-staging/tree/CdePkg/implemented.md#validation-status > > * all the above in one single C-Library CdeLib.lib > > *CdePkg*shall be adjusted to other compilers/tool chains too, once it > is feature-complete and accepted by the UEFI community. > > As long as it is for Microsoft VS2019 only. > > ** > > *CdePkg*README.md is here: > > https://github.com/tianocore/edk2-staging/tree/CdePkg#cdepkg > > *CdePkg* HOWTO is here: > https://github.com/tianocore/edk2-staging/blob/CdePkg/README.md#howto > > *CdeValidationPkg*README.md is here: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/README.md > > > *CdeValidationPkg* HOWTO is here: > https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/README.md > > > HOWTO: > > 1. clone the *edk2-staging* repository > 2. checkout *CdePkg* > 3. run *LAUNCH.BAT* > 4. run |*build -p EmulatorPkg\EmulatorPkg.dsc -t VS2015x86 -a IA32*||| > 5. |run*DBGEMU.BAT *to start emulation*(EmulatorPkg)*| > 6. |run*build -a IA32 -a X64 -n 5 -t VS2015x86 -b DEBUG -p > Vlv2TbltDevicePkg\PlatformPkgX64.dsc*||**| > 7. |update MinnowBoard > with*Build/Vlv2TbltDevicePkgX64\DEBUG_VS2015x86\FV\VLV.fd*| > > |**| > > |Best regards,| > > |Kilian Kegel| > > --------------0F2D931FCF6C2770FB1796B8 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit
Good day,

I have seen e-mails about this package several times now and got a bit curious about its purpose and future. As far as I understood it, it aims to provide an actual full C standard library implementation. Is this planned to land in edk2 and if so, in what ways will one be encouraged to use it? Usually it's considered best practice to keep the code quantity in low levels to a minimum, and I do not think even most kernel spaces implement a *full* C standard library for this reason.

Will it be a first-class citizen, properly reviewed, and is there a chance the rest of edk2 is (very slowly) transfered to a standard C stack? Or will it "just" be a handy set of libraries for porting purposes? Especially in latter case, this, to me intuitively, sounds like a maintainance and reviewing nightmare, but I'm happy to hear about the future plans if you're willing to share them.

Best regards,
Marvin

Am 02.12.2019 um 21:37 schrieb Kilian Kegel:

Hi UEFI community,

 

I’d like to inform you about an update in the CdePkg branch of  edk2-staging.

https://github.com/tianocore/edk2-staging/tree/CdePkg#cdepkg

 

The goal of the CdePkg is to provide an ANSI C Interface for UEFI POST drivers,

that enables BIOS engineers to (more) easily port standard C programs or libraries

(e.g. the openSSL library, already done) to POST drivers.

 

Furthermore the ANSI C Interface is disseminated widely, also it’s bugs and pitfalls are known very well

by a broad range of IT professionals and may help to be better supportable by the open source initiative

compared to the proprietary interface that is available today in Tianocore UEFI.

 

Now 3 new ANSI C functions _wassert() from ASSERT.H and setlocale(), localeconv() from LOCALE.H

are introduced for PEI and DXE.

 

Currently there are 13 examples implemented, demonstrating all in all  110 functions defined by ANSI C:

  1. argvc: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/HOSTED_ENV/argcv/main.c#L57

argc/argv handling according to https://msdn.microsoft.com/en-us/library/a1y7w461.aspx

  1. systeminterfacePEI: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfacePEI/main.c#L57

demonstration, how PeiServices and FileHandle are passed into main()

  1. systeminterfaceDXE: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfaceDXE/main.c#L57

demonstration, how SystemTable and ImageHandle are passed into main()

 

ANSI C LIBRARY functions:

  1. time.h clock(): https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/TIME_H/clock/main.c#L1

for PEI and DXE phase. It provides TSC based, millisecond precise, exact and chipset independent clock() function.

NOTE: in emulation mode the TSC nominal frequency is supposed to be 1GHz

https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/clock?view=vs-2019

  1. time.h  difftime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/difftime-difftime32-difftime64?view=vs-2019

time.h  mktime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/mktime-mktime32-mktime64?view=vs-2019

time.h time(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32-time64?view=vs-2019

time.h asctime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/asctime-wasctime?view=vs-2019

time.h  ctime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/ctime-ctime32-ctime64-wctime-wctime32-wctime64?view=vs-2019

time.h  gmtime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/gmtime-gmtime32-gmtime64?view=vs-2019

time.h  localtime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/localtime-localtime32-localtime64?view=vs-2019

time.h  strftime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?view=vs-2019

NOTE: All TIME.H functions support UTC only.

All functions are tested in one single driver PEI/DXE: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/TIME_H/timehfunctions/main.c#L52

  1. STRING.H memcpy():https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memcpy-wmemcpy?view=vs-2019

STRING.H memmove():https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memmove-wmemmove?view=vs-2019

STRING.H strcpy(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcpy-wcscpy-mbscpy?view=vs-2019

STRING.H strncpy(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncpy-strncpy-l-wcsncpy-wcsncpy-l-mbsncpy-mbsncpy-l?view=vs-2019

STRING.H strcat(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcat-wcscat-mbscat?view=vs-2019

STRING.H strncat(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncat-strncat-l-wcsncat-wcsncat-l-mbsncat-mbsncat-l?view=vs-2019

STRING.H memcmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memcmp-wmemcmp?view=vs-2019

STRING.H strcmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcmp-wcscmp-mbscmp?view=vs-2019

STRING.H strncmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncmp-wcsncmp-mbsncmp-mbsncmp-l?view=vs-2019

STRING.H memchr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memchr-wmemchr?view=vs-2019

STRING.H strchr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strchr-wcschr-mbschr-mbschr-l?view=vs-2019

STRING.H strcspn(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcspn-wcscspn-mbscspn-mbscspn-l?view=vs-2019

STRING.H strpbrk(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strpbrk-wcspbrk-mbspbrk-mbspbrk-l?view=vs-2019

STRING.H strrchr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strrchr-wcsrchr-mbsrchr-mbsrchr-l?view=vs-2019

STRING.H strspn(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strspn-wcsspn-mbsspn-mbsspn-l?view=vs-2019

STRING.H strstr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l?view=vs-2019

STRING.H strtok(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l?view=vs-2019

STRING.H memset(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memset-wmemset?view=vs-2019

STRING.H strerror(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strerror-strerror-wcserror-wcserror?view=vs-2019

STRING.H strlen(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l?view=vs-2019

NOTE: All STRING.H functions are completely available in PEI and DXE, except strcoll() and strxftm()

All functions are tested in one single driver PEI/DXE: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/STRING_H/stringhfunctions/main.c#L52

  1. WCHAR.H wprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/printf-printf-l-wprintf-wprintf-l?view=vs-2019

WCHAR.H swprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/sprintf-sprintf-l-swprintf-swprintf-l-swprintf-l?view=vs-2019

WCHAR.H vswprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsprintf-vsprintf-l-vswprintf-vswprintf-l-vswprintf-l?view=vs-2019

WCHAR.H wcscpy(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcpy-wcscpy-mbscpy?view=vs-2019

WCHAR.H wcsncpy(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncpy-strncpy-l-wcsncpy-wcsncpy-l-mbsncpy-mbsncpy-l?view=vs-2019

WCHAR.H wcscat(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcat-wcscat-mbscat?view=vs-2019

WCHAR.H wcsncat(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncat-strncat-l-wcsncat-wcsncat-l-mbsncat-mbsncat-l?view=vs-2019

WCHAR.H wcscmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcmp-wcscmp-mbscmp?view=vs-2019

WCHAR.H wcsncmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncmp-wcsncmp-mbsncmp-mbsncmp-l?view=vs-2019

WCHAR.H wcschr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strchr-wcschr-mbschr-mbschr-l?view=vs-2019

WCHAR.H wcscspn(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcspn-wcscspn-mbscspn-mbscspn-l?view=vs-2019

WCHAR.H wcspbrk(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strpbrk-wcspbrk-mbspbrk-mbspbrk-l?view=vs-2019

WCHAR.H wcsrchr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strrchr-wcsrchr-mbsrchr-mbsrchr-l?view=vs-2019

WCHAR.H wcsspn(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strspn-wcsspn-mbsspn-mbsspn-l?view=vs-2019

WCHAR.H wcsstr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strstr-wcsstr-mbsstr-mbsstr-l?view=vs-2019

WCHAR.H wcstok(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l?view=vs-2019

WCHAR.H wcslen(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l?view=vs-2019

WCHAR.H wmemcmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memcmp-wmemcmp?view=vs-2019

WCHAR.H wmemcpy(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memcpy-wmemcpy?view=vs-2019

WCHAR.H wmemmove(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memmove-wmemmove?view=vs-2019

WCHAR.H wmemset(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memset-wmemset?view=vs-2019

NOTE: 21 WCHAR.H functions are available in PEI and DXE. 29 functions are not yet implemented, that are file and multi byte functions

All functions are tested in one single driver PEI/DXE: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/WCHAR_H/wcharhfunctions/main.c

  1. STDIO.H tmpnam(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tempnam-wtempnam-tmpnam-wtmpnam?view=vs-2019

STDIO.H printf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/printf-printf-l-wprintf-wprintf-l?view=vs-2019

STDIO.H snprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=vs-2019

STDIO.H sprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/sprintf-sprintf-l-swprintf-swprintf-l-swprintf-l?view=vs-2019

STDIO.H vsnprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsnprintf-vsnprintf-vsnprintf-l-vsnwprintf-vsnwprintf-l?view=vs-2019

STDIO.H vsscanf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsscanf-vswscanf?view=vs-2019

STDIO.H sscanf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/sscanf-sscanf-l-swscanf-swscanf-l?view=vs-2019

STDIO.H vprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vprintf-vprintf-l-vwprintf-vwprintf-l?view=vs-2019

STDIO.H vsprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsprintf-vsprintf-l-vswprintf-vswprintf-l-vswprintf-l?view=vs-2019

NOTE: 9 STDIO.H functions are available in PEI and DXE. 36 functions are not implemented for POST drivers because of file I/O (it is standard IO dot h)

NOTE: snprintf(), vsnprintf() and vsscanf() are C99 and implemented due to their usefulness for security related software

NOTE: printf() and vprintf() write to ConOut that is actually not visible in PEI and DXE, but in the Emulator.

All functions are tested in one single driver PEI/DXE: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/STDIO_H/stdiohfunctions/main.c

  1. STDLIB.H atoi(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/atoi-atoi-l-wtoi-wtoi-l?view=vs-2019

STDLIB.H atol(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/atol-atol-l-wtol-wtol-l?view=vs-2019

STDLIB.H strtol(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strtol-wcstol-strtol-l-wcstol-l?view=vs-2019

STDLIB.H strtoul(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strtoul-strtoul-l-wcstoul-wcstoul-l?view=vs-2019

STDLIB.H rand(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/rand?view=vs-2019

STDLIB.H srand(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/srand?view=vs-2019

STDLIB.H calloc(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/calloc?view=vs-2019

STDLIB.H free(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/free?view=vs-2019

STDLIB.H malloc(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/malloc?view=vs-2019

STDLIB.H realloc(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/realloc?view=vs-2019

STDLIB.H atexit(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/atexit?view=vs-2019

STDLIB.H exit(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/exit-exit-exit?view=vs-2019

STDLIB.H qsort(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/qsort?view=vs-2019

STDLIB.H abs(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/abs-labs-llabs-abs64?view=vs-2019

STDLIB.H labs(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/abs-labs-llabs-abs64?view=vs-2019

STDLIB.H div(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/div?view=vs-2019

STDLIB.H ldiv(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/div?view=vs-2019

NOTE: missing from STDLIB.H: abort(), strtod(), atof(), getenv(), system(), bsearch()

All functions are tested in one single driver PEI/DXE: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/STDLIB_H/stdlibhfunctions/main.c

  1. CTYPE.H isalnum(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isalnum-iswalnum-isalnum-l-iswalnum-l?view=vs-2019

CTYPE.H isalpha(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isalpha-iswalpha-isalpha-l-iswalpha-l?view=vs-2019

CTYPE.H iscntrl(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/iscntrl-iswcntrl-iscntrl-l-iswcntrl-l?view=vs-2019

CTYPE.H isdigit(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isdigit-iswdigit-isdigit-l-iswdigit-l?view=vs-2019

CTYPE.H isgraph(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isgraph-iswgraph-isgraph-l-iswgraph-l?view=vs-2019

CTYPE.H islower(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/islower-iswlower-islower-l-iswlower-l?view=vs-2019

CTYPE.H isprint(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isprint-iswprint-isprint-l-iswprint-l?view=vs-2019

CTYPE.H ispunct(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/ispunct-iswpunct-ispunct-l-iswpunct-l?view=vs-2019

CTYPE.H isspace(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isspace-iswspace-isspace-l-iswspace-l?view=vs-2019

CTYPE.H isupper(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isupper-isupper-l-iswupper-iswupper-l?view=vs-2019

CTYPE.H isxdigit(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isxdigit-iswxdigit-isxdigit-l-iswxdigit-l?view=vs-2019

CTYPE.H tolower(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tolower-tolower-towlower-tolower-l-towlower-l?view=vs-2019

CTYPE.H toupper(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/toupper-toupper-towupper-toupper-l-towupper-l?view=vs-2019

NOTE: C locale support only

All functions are tested in one single driver PEI/DXE:  https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/CTYPE_H/ctypehfunctions/main.c

  1. WCTYPE.H iswalnum(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isalnum-iswalnum-isalnum-l-iswalnum-l?view=vs-2019

WCTYPE.H iswalpha(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isalpha-iswalpha-isalpha-l-iswalpha-l?view=vs-2019

WCTYPE.H iswblank(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isblank-iswblank-isblank-l-iswblank-l?view=vs-2019

WCTYPE.H iswcntrl(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/iscntrl-iswcntrl-iscntrl-l-iswcntrl-l?view=vs-2019

WCTYPE.H iswdigit(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isdigit-iswdigit-isdigit-l-iswdigit-l?view=vs-2019

WCTYPE.H iswgraph(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isgraph-iswgraph-isgraph-l-iswgraph-l?view=vs-2019

WCTYPE.H iswlower(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/islower-iswlower-islower-l-iswlower-l?view=vs-2019

WCTYPE.H iswprint(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isprint-iswprint-isprint-l-iswprint-l?view=vs-2019

WCTYPE.H iswpunct(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/ispunct-iswpunct-ispunct-l-iswpunct-l?view=vs-2019

WCTYPE.H iswspace(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isspace-iswspace-isspace-l-iswspace-l?view=vs-2019

WCTYPE.H iswupper(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isupper-isupper-l-iswupper-iswupper-l?view=vs-2019

WCTYPE.H iswxdigit(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isxdigit-iswxdigit-isxdigit-l-iswxdigit-l?view=vs-2019

WCTYPE.H iswctype(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isctype-iswctype-isctype-l-iswctype-l?view=vs-2019

WCTYPE.H wctype(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/wctype?view=vs-2019

WCTYPE.H towlower(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tolower-tolower-towlower-tolower-l-towlower-l?view=vs-2019

WCTYPE.H towupper(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/toupper-toupper-towupper-toupper-l-towupper-l?view=vs-2019

WCTYPE.H towctrans(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/towctrans?view=vs-2019

WCTYPE.H wctrans(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/wctrans?view=vs-2019

NOTE: C locale support only

All functions are tested in one single driver PEI/DXE:  https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/WCTYPE_H/wctypehfunctions/main.c

  1. NEW ASSERT.H _wassert(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/assert-macro-assert-wassert?view=vs-2019

NOTE: assert() does NOT run into dead loop.

All functions are tested in one single driver PEI/DXE:  https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/ASSERT_H/asserthfunctions/main.c

  1. NEW LOCALE.H localeconv(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/localeconv?view=vs-2019

NEW LOCALE.H setlocale(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale?view=vs-2019

NOTE: locale functions are provided for compatibility. Only “C” locale is supported only.

All functions are tested in one single driver PEI/DXE:  https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/LOCALE_H/localehfunctions/main.c

 

Best Regards,

Kilian

 

From: Kilian Kegel
Sent: Wednesday, October 23, 2019 10:03 PM
To: devel@edk2.groups.io
Cc: Kinney, Michael D; Richardson, Brian
Subject: [edk2-devel] [staging/branch]: CdePkg - C Development Environment Package

 

Hi UEFI community,

 

I’d like to introduce the CdePkg to edk2-staging.

 

Some time ago I decided to write my own ANSI C Library for UEFI Shell and POST.

 

The UEFI Shell library (“Torito C Library”) has been production-ready for more than one year.

The POST version of the library (“CdeLib”) is not yet fully tested.

 

I will be demonstrating my verification procedure in the upcoming weeks on EDK2 STAGING  https://github.com/tianocore/edk2-staging/tree/CdePkg

 

Currently there are 3 examples implemented:

  1. argvc: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/HOSTED_ENV/argcv/main.c#L57

argc/argv handling according to https://msdn.microsoft.com/en-us/library/a1y7w461.aspx

  1. systeminterfacePEI: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfacePEI/main.c#L57

demonstration, how PeiServices and FileHandle are passed into main()

  1. systeminterfaceDXE: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfaceDXE/main.c#L57

demonstration, how SystemTable and ImageHandle are passed into main()

 

Upcoming next demonstration will be the clock() function end of this week

 

The idea is to bring the ANSI C Library interface into POST drivers.

This will:

  1. ease porting tasks
  2. allow cross development
  3. allow developers to focus on their aims, because they aren’t forced to keep in mind a lot of additional info (e.g. RShiftU64)
  4. provide all intrisics to allow the compiler to be a “C compiler”

(e.g. char buffer[256] = { 1 };)

 

What is CdePkg and Torito C Library?

  • CdePkg and Torito C Library are a one man show / after work party, that is owned and written solely by myself
  • CdePkg is a reference implementation only for Microsoft C compiler
  • CdePkg is a feasibility study
  • CdePkg is the successor of Torito C, based on the same source code
  • CdePkg C Development Environment is similar to  MdePkg Module Development Environment

but guarantees  that the C compiler is always fully usable (all intrinsics available) and the C90/C95 standard library is always available

 

What are the design goals?

  • to rewrite the whole thing from scratch, without using any public source code from GNU, BSD, Watcom
  • completeness: full blown C90 + C95 support, as lowest common denominator
  • tailored for UEFI: small code size, for UEFI-POST-driver uses a C-Library-Driver, that contains core/worker functions for realloc() ==  malloc() and free(),

entire printf()-family, entire scanf()-family.

UEFI-POST-driver just uses small wrapper functions to run the C-Library-Driver code.

  • stable, exact, chipset independent TSC based clock() with CLOCKS_PER_SEC == 1000
  • complete set of the Microsoft C-compiler intrinsic functions
  • ROM-able! Runs with stack but w/o any static storage duration in .data segment, e.g. for rand(), strtok(), tmpfile()

This is required for early PEI before memory sizing, when PEI-images run directly out of flash

  • Microsoft (bug) compatible (as far as possible)
    1. use original Microsoft header files for UEFI Shell Apps created in VS2019
    2. allow expensive debugging tasks of ANSI C .EFI applications in Visual Studio in its Windows NT counter part
    3. to save my lifetime writing a documentation https://github.com/tianocore/edk2-staging/tree/CdePkg/implemented.md#validation-status
  • all the above in one single C-Library CdeLib.lib

 

CdePkg shall be adjusted to other compilers/tool chains too, once it is feature-complete and accepted by the UEFI community.

As long as it is for Microsoft VS2019 only.

 

CdePkg README.md is here:   https://github.com/tianocore/edk2-staging/tree/CdePkg#cdepkg

CdePkg HOWTO is here: https://github.com/tianocore/edk2-staging/blob/CdePkg/README.md#howto

CdeValidationPkg README.md is here: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/README.md

CdeValidationPkg HOWTO is here: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/README.md

 

HOWTO:

  1. clone the edk2-staging repository
  2. checkout CdePkg
  3. run LAUNCH.BAT
  4. run build -p EmulatorPkg\EmulatorPkg.dsc -t VS2015x86 -a IA32
  5. run DBGEMU.BAT to start emulation (EmulatorPkg)
  6. run build -a IA32 -a X64 -n 5 -t VS2015x86 -b DEBUG -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc
  7. update MinnowBoard with Build/Vlv2TbltDevicePkgX64\DEBUG_VS2015x86\FV\VLV.fd

 

Best regards,

Kilian Kegel

 

 

 

 

 

 


--------------0F2D931FCF6C2770FB1796B8--