From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.92.68.15]) by mx.groups.io with SMTP id smtpd.web09.6297.1575019312974404969 for ; Fri, 29 Nov 2019 01:21:54 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=VtCoEjgC; spf=pass (domain: outlook.com, ip: 40.92.68.15, mailfrom: kilian_kegel@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hU+AUWFG1YWf/bKKeji2F8X42qIpEh1ylCt+QHeMUNWk3OhKurRVfrVeVtnHmgQ4hyLCx+pwzFoVsWoL4WByZOYDJiekVydD2gL1vOvtkmv/Yy8c6dXNMW2abWCRXthY829FnoD+tJvI6mA7Hn7Qs6vRadNb9v1a80E8TJ7lVbEB3g58dHDp5SgREGK011+FWYyyLMxRGFdo8XU7Cv2urDX+uIh8Q5KVnzsr/MFKq6vBe8zlucYgmu71jObgAOSV4lV4Xj6pwYW3KpnY8NGOcSaysVuzVGdSOr4y8vA6bb/IIIPlc0eFU3xou1JSOQEvOeNxbpr82dJWSQUP0afFLw== 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=Xbj0vi7Ab24xDuCwmFYvKX8sNm5k+yAHvO1XUNov4sw=; b=m4ScPN9QjWliZdMTpXQpycsiM3MSELZYAq6Sa2zAX56ugMCeLSyNJzpOCTUmwsTjCAcNRNNDgiPbXz+fbbghqk4V4A+x/Y2egEbAuURmKwQMBrJ7u0eT0RTxBmaQGL0tdmrHjB4hqXpOTDdZmyv/1C8PPDfL4WoG7MTdwptrfDCPB/6UIFkLokErhDQ9LoVzgpF2my9JbZoz4OJWrTDHOP/BLakOxqz/XND/iQjvV2ciO2h6Pbu6moQ/KE3Alf1G/KIdkXeT6qqEHn2xF/0TMMLNB9tzRnVjWg8qz6eWL6t+73NhpgZMMGo7jHfh/5F7dZ28abeIRcsIsxA7ITTZog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Xbj0vi7Ab24xDuCwmFYvKX8sNm5k+yAHvO1XUNov4sw=; b=VtCoEjgCasa/oNXrbggqhurzpljRQiuaff+9Ft+n/Xtq387/eowYnIOofftAdAJYwYR+vvKXoKAsP074XUX5MSxmH4mzkgdUG+RlYh/o1WNbOrTV1G07zMjcSTb4MyoFu8z8/WET3vK2mvM3HY91G+4cohFL2dnQjIf/wrYDDYP1+La9CzbkMkRkmp33Uts2d0kvOCU+kTgON8LFLaz4wDFZTtFxrZeoCuT1oNxeywVcn3p4m0iInCEa24QtyBIrQJz4GIuBTQNjF21eCQ30cszWsLSXYc9tKsR60KYpOzlTEyXr+MPjEoIxtj/M76HK010pmw8MlsKlwETF7QCgAg== Received: from VE1EUR02FT006.eop-EUR02.prod.protection.outlook.com (10.152.12.60) by VE1EUR02HT104.eop-EUR02.prod.protection.outlook.com (10.152.13.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17; Fri, 29 Nov 2019 09:21:48 +0000 Received: from VI1PR0502MB3968.eurprd05.prod.outlook.com (10.152.12.56) by VE1EUR02FT006.mail.protection.outlook.com (10.152.12.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.18 via Frontend Transport; Fri, 29 Nov 2019 09:21:48 +0000 Received: from VI1PR0502MB3968.eurprd05.prod.outlook.com ([fe80::4408:c7c7:aaa3:2a91]) by VI1PR0502MB3968.eurprd05.prod.outlook.com ([fe80::4408:c7c7:aaa3:2a91%7]) with mapi id 15.20.2495.014; Fri, 29 Nov 2019 09:21:48 +0000 From: "Kilian Kegel" To: "devel@edk2.groups.io" CC: "Kinney, Michael D" , "Richardson, Brian" Subject: [edk2-devel] [staging/branch]: CdePkg - added unit test for CTYPE.H and WCTYPE.H functions Thread-Topic: [edk2-devel] [staging/branch]: CdePkg - added unit test for CTYPE.H and WCTYPE.H functions Thread-Index: AQHVppZMcRy9TVfyAk+8MBG5OgeV3A== Date: Fri, 29 Nov 2019 09:21:48 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:294F13F5C76AE9363D8608A58E30626E41F154213D6D2A62808F2318C5460DB1;UpperCasedChecksum:1FE69559846E4E7B32BA267683BE29F5EB5B8412C7397996C8AAA56F3C7FB4CA;SizeAsReceived:7011;Count:43 x-tmn: [pY3iH46epI/gGEEEDkVehwtBIVO+zTQK] x-ms-publictraffictype: Email x-incomingheadercount: 43 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: a5640f7c-a5b2-4602-5580-08d774ad8fa5 x-ms-traffictypediagnostic: VE1EUR02HT104: x-ms-exchange-purlcount: 92 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RKq2TdL8R+opzHwleI7XjfGQVvP1NbD8DESF1TkLpzOpJ3p5qxONXHjVpfmk9xNbQZeLWc6/IuNX/A4xaSEj/nRmZa/R3Ivz7c83E5r7mjWZDuNQ4NoJnVrsGe2JrYB36dJAefmBmH/sJ2oPFtH1IY5nxnR39j/QVosFkSLDbGLU0DGJaIJKvJzGRlnyJPsPlNwNbPN/m+nuLSlVMsl1gL+WbvdhNxSGmmZAiAiGBdY= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: a5640f7c-a5b2-4602-5580-08d774ad8fa5 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2019 09:21:48.3386 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR02HT104 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_VI1PR0502MB396836FC591E97269BC99E13EB460VI1PR0502MB3968_" --_000_VI1PR0502MB396836FC591E97269BC99E13EB460VI1PR0502MB3968_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi UEFI community, I=92d like to inform you about an update in the CdePkg branch of edk2-stag= ing. https://github.com/tianocore/edk2-staging/tree/CdePkg#cdepkg The goal of the CdePkg is to provide an ANSI C Interface for UEFI POST driv= ers, that enables BIOS engineers to (more) easily port standard C programs or li= braries (e.g. the openSSL library, already done) to POST drivers. Furthermore the ANSI C Interface is disseminated widely, also it=92s bugs a= nd 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 31 new ANSI C functions isalnum(),isalpha(),iscntrl(),isdigit(),isgraph= (),islower(),isprint(),ispunct(),isspace(),isupper(),isxdigit(),tolower(),t= oupper() from CTYPE.H and iswalnum(),iswalpha(),iswblank(),iswcntrl(),iswdigit(),iswgraph(),iswlo= wer(),iswprint(),iswpunct(),iswspace(), iswupper(),iswxdigit(),iswctype(),wctype(),towlower(),towupper(),towctrans(= ),wctrans() from WCTYPE.H are introduced for PEI and DXE. Currently there are 11 examples implemented, demonstrating all in all 107 = functions defined by ANSI C: 1. argvc: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValid= ationPkg/HOSTED_ENV/argcv/main.c#L57 argc/argv handling according to https://msdn.microsoft.com/en-us/library/a1= y7w461.aspx 1. systeminterfacePEI: https://github.com/tianocore/edk2-staging/blob/Cd= ePkg/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/Cd= ePkg/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 an= d 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= =3Dvs-2019 1. time.h difftime(): https://docs.microsoft.com/en-us/cpp/c-runtime-li= brary/reference/difftime-difftime32-difftime64?view=3Dvs-2019 time.h mktime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/mktime-mktime32-mktime64?view=3Dvs-2019<%20https:/docs.microsoft.co= m/en-us/cpp/c-runtime-library/reference/mktime-mktime32-mktime64?view=3Dvs-= 2019> time.h time(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/refer= ence/time-time32-time64?view=3Dvs-2019<%20https:/docs.microsoft.com/en-us/c= pp/c-runtime-library/reference/time-time32-time64?view=3Dvs-2019> time.h asctime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/asctime-wasctime?view=3Dvs-2019 time.h ctime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/ref= erence/ctime-ctime32-ctime64-wctime-wctime32-wctime64?view=3Dvs-2019 time.h gmtime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/gmtime-gmtime32-gmtime64?view=3Dvs-2019 time.h localtime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library= /reference/localtime-localtime32-localtime64?view=3Dvs-2019 time.h strftime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/strftime-wcsftime-strftime-l-wcsftime-l?view=3Dvs-2019 NOTE: All TIME.H functions support UTC only. All functions are tested in one single driver PEI/DXE: https://github.com/t= ianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/TIME_H/timehfunctions/ma= in.c#L52 1. STRING.H memcpy():https://docs.microsoft.com/en-us/cpp/c-runtime-libr= ary/reference/memcpy-wmemcpy?view=3Dvs-2019 STRING.H memmove():https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/memmove-wmemmove?view=3Dvs-2019 STRING.H strcpy(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strcpy-wcscpy-mbscpy?view=3Dvs-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=3Dvs-2= 019 STRING.H strcat(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strcat-wcscat-mbscat?view=3Dvs-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=3Dvs-2= 019 STRING.H memcmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/memcmp-wmemcmp?view=3Dvs-2019 STRING.H strcmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strcmp-wcscmp-mbscmp?view=3Dvs-2019 STRING.H strncmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/strncmp-wcsncmp-mbsncmp-mbsncmp-l?view=3Dvs-2019 STRING.H memchr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/memchr-wmemchr?view=3Dvs-2019 STRING.H strchr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strchr-wcschr-mbschr-mbschr-l?view=3Dvs-2019 STRING.H strcspn(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/strcspn-wcscspn-mbscspn-mbscspn-l?view=3Dvs-2019 STRING.H strpbrk(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/strpbrk-wcspbrk-mbspbrk-mbspbrk-l?view=3Dvs-2019 STRING.H strrchr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/strrchr-wcsrchr-mbsrchr-mbsrchr-l?view=3Dvs-2019 STRING.H strspn(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strspn-wcsspn-mbsspn-mbsspn-l?view=3Dvs-2019 STRING.H strstr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l?view=3Dvs-2019 STRING.H strtok(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l?view=3Dvs-2019 STRING.H memset(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/memset-wmemset?view=3Dvs-2019 STRING.H strerror(): https://docs.microsoft.com/en-us/cpp/c-runtime-library= /reference/strerror-strerror-wcserror-wcserror?view=3Dvs-2019 STRING.H strlen(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l?view=3Dvs-2019 NOTE: All STRING.H functions are completely available in PEI and DXE, excep= t strcoll() and strxftm() All functions are tested in one single driver PEI/DXE: https://github.com/t= ianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/STRING_H/stringhfunction= s/main.c#L52 1. WCHAR.H wprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/printf-printf-l-wprintf-wprintf-l?view=3Dvs-2019 WCHAR.H swprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/sprintf-sprintf-l-swprintf-swprintf-l-swprintf-l?view=3Dvs-2019 WCHAR.H vswprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library= /reference/vsprintf-vsprintf-l-vswprintf-vswprintf-l-vswprintf-l?view=3Dvs-= 2019 WCHAR.H wcscpy(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/strcpy-wcscpy-mbscpy?view=3Dvs-2019 WCHAR.H wcsncpy(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strncpy-strncpy-l-wcsncpy-wcsncpy-l-mbsncpy-mbsncpy-l?view=3Dvs-20= 19 WCHAR.H wcscat(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/strcat-wcscat-mbscat?view=3Dvs-2019 WCHAR.H wcsncat(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strncat-strncat-l-wcsncat-wcsncat-l-mbsncat-mbsncat-l?view=3Dvs-20= 19 WCHAR.H wcscmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/strcmp-wcscmp-mbscmp?view=3Dvs-2019 WCHAR.H wcsncmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strncmp-wcsncmp-mbsncmp-mbsncmp-l?view=3Dvs-2019 WCHAR.H wcschr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/strchr-wcschr-mbschr-mbschr-l?view=3Dvs-2019 WCHAR.H wcscspn(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strcspn-wcscspn-mbscspn-mbscspn-l?view=3Dvs-2019 WCHAR.H wcspbrk(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strpbrk-wcspbrk-mbspbrk-mbspbrk-l?view=3Dvs-2019 WCHAR.H wcsrchr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strrchr-wcsrchr-mbsrchr-mbsrchr-l?view=3Dvs-2019 WCHAR.H wcsspn(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/strspn-wcsspn-mbsspn-mbsspn-l?view=3Dvs-2019 WCHAR.H wcsstr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/strstr-wcsstr-mbsstr-mbsstr-l?view=3Dvs-2019 WCHAR.H wcstok(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l?view=3Dvs-2019 WCHAR.H wcslen(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l?view=3Dvs-2019 WCHAR.H wmemcmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/memcmp-wmemcmp?view=3Dvs-2019 WCHAR.H wmemcpy(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/memcpy-wmemcpy?view=3Dvs-2019 WCHAR.H wmemmove(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/memmove-wmemmove?view=3Dvs-2019 WCHAR.H wmemset(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/memset-wmemset?view=3Dvs-2019 NOTE: 21 WCHAR.H functions are available in PEI and DXE. 29 functions are n= ot yet implemented, that are file and multi byte functions All functions are tested in one single driver PEI/DXE: https://github.com/t= ianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/WCHAR_H/wcharhfunctions/= main.c 1. STDIO.H tmpnam(): https://docs.microsoft.com/en-us/cpp/c-runtime-libr= ary/reference/tempnam-wtempnam-tmpnam-wtmpnam?view=3Dvs-2019 STDIO.H printf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/printf-printf-l-wprintf-wprintf-l?view=3Dvs-2019 STDIO.H snprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=3Dvs-2019 STDIO.H sprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/sprintf-sprintf-l-swprintf-swprintf-l-swprintf-l?view=3Dvs-2019 STDIO.H vsnprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library= /reference/vsnprintf-vsnprintf-vsnprintf-l-vsnwprintf-vsnwprintf-l?view=3Dv= s-2019 STDIO.H vsscanf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/vsscanf-vswscanf?view=3Dvs-2019 STDIO.H sscanf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/sscanf-sscanf-l-swscanf-swscanf-l?view=3Dvs-2019 STDIO.H vprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/vprintf-vprintf-l-vwprintf-vwprintf-l?view=3Dvs-2019 STDIO.H vsprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/vsprintf-vsprintf-l-vswprintf-vswprintf-l-vswprintf-l?view=3Dvs-2= 019 NOTE: 9 STDIO.H functions are available in PEI and DXE. 36 functions are no= t 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 i= n PEI and DXE, but in the Emulator. All functions are tested in one single driver PEI/DXE: https://github.com/t= ianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/STDIO_H/stdiohfunctions/= main.c 1. STDLIB.H atoi(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/atoi-atoi-l-wtoi-wtoi-l?view=3Dvs-2019 STDLIB.H atol(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/ref= erence/atol-atol-l-wtol-wtol-l?view=3Dvs-2019 STDLIB.H strtol(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strtol-wcstol-strtol-l-wcstol-l?view=3Dvs-2019 STDLIB.H strtoul(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/strtoul-strtoul-l-wcstoul-wcstoul-l?view=3Dvs-2019 STDLIB.H rand(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/ref= erence/rand?view=3Dvs-2019 STDLIB.H srand(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/srand?view=3Dvs-2019 STDLIB.H calloc(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/calloc?view=3Dvs-2019 STDLIB.H free(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/ref= erence/free?view=3Dvs-2019 STDLIB.H malloc(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/malloc?view=3Dvs-2019 STDLIB.H realloc(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/realloc?view=3Dvs-2019 STDLIB.H atexit(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/atexit?view=3Dvs-2019 STDLIB.H exit(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/ref= erence/exit-exit-exit?view=3Dvs-2019 STDLIB.H qsort(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/qsort?view=3Dvs-2019 STDLIB.H abs(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/refe= rence/abs-labs-llabs-abs64?view=3Dvs-2019 STDLIB.H labs(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/ref= erence/abs-labs-llabs-abs64?view=3Dvs-2019 STDLIB.H div(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/refe= rence/div?view=3Dvs-2019 STDLIB.H ldiv(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/ref= erence/div?view=3Dvs-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/t= ianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/STDLIB_H/stdlibhfunction= s/main.c 1. NEW CTYPE.H isalnum(): https://docs.microsoft.com/en-us/cpp/c-runtime= -library/reference/isalnum-iswalnum-isalnum-l-iswalnum-l?view=3Dvs-2019 NEW CTYPE.H isalpha(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/isalpha-iswalpha-isalpha-l-iswalpha-l?view=3Dvs-2019 NEW CTYPE.H iscntrl(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/iscntrl-iswcntrl-iscntrl-l-iswcntrl-l?view=3Dvs-2019 NEW CTYPE.H isdigit(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/isdigit-iswdigit-isdigit-l-iswdigit-l?view=3Dvs-2019 NEW CTYPE.H isgraph(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/isgraph-iswgraph-isgraph-l-iswgraph-l?view=3Dvs-2019 NEW CTYPE.H islower(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/islower-iswlower-islower-l-iswlower-l?view=3Dvs-2019 NEW CTYPE.H isprint(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/isprint-iswprint-isprint-l-iswprint-l?view=3Dvs-2019 NEW CTYPE.H ispunct(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/ispunct-iswpunct-ispunct-l-iswpunct-l?view=3Dvs-2019 NEW CTYPE.H isspace(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/isspace-iswspace-isspace-l-iswspace-l?view=3Dvs-2019 NEW CTYPE.H isupper(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/isupper-isupper-l-iswupper-iswupper-l?view=3Dvs-2019 NEW CTYPE.H isxdigit(): https://docs.microsoft.com/en-us/cpp/c-runtime-libr= ary/reference/isxdigit-iswxdigit-isxdigit-l-iswxdigit-l?view=3Dvs-2019 NEW CTYPE.H tolower(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/tolower-tolower-towlower-tolower-l-towlower-l?view=3Dvs-2019 NEW CTYPE.H toupper(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/toupper-toupper-towupper-toupper-l-towupper-l?view=3Dvs-2019 NOTE: C locale support only All functions are tested in one single driver PEI/DXE: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValida= tionPkg/CTYPE_H/ctypehfunctions/main.c 1. NEW WCTYPE.H iswalnum(): https://docs.microsoft.com/en-us/cpp/c-runti= me-library/reference/isalnum-iswalnum-isalnum-l-iswalnum-l?view=3Dvs-2019 NEW WCTYPE.H iswalpha(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/isalpha-iswalpha-isalpha-l-iswalpha-l?view=3Dvs-2019 NEW WCTYPE.H iswblank(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/isblank-iswblank-isblank-l-iswblank-l?view=3Dvs-2019 NEW WCTYPE.H iswcntrl(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/iscntrl-iswcntrl-iscntrl-l-iswcntrl-l?view=3Dvs-2019 NEW WCTYPE.H iswdigit(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/isdigit-iswdigit-isdigit-l-iswdigit-l?view=3Dvs-2019 NEW WCTYPE.H iswgraph(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/isgraph-iswgraph-isgraph-l-iswgraph-l?view=3Dvs-2019 NEW WCTYPE.H iswlower(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/islower-iswlower-islower-l-iswlower-l?view=3Dvs-2019 NEW WCTYPE.H iswprint(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/isprint-iswprint-isprint-l-iswprint-l?view=3Dvs-2019 NEW WCTYPE.H iswpunct(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/ispunct-iswpunct-ispunct-l-iswpunct-l?view=3Dvs-2019 NEW WCTYPE.H iswspace(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/isspace-iswspace-isspace-l-iswspace-l?view=3Dvs-2019 NEW WCTYPE.H iswupper(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/isupper-isupper-l-iswupper-iswupper-l?view=3Dvs-2019 NEW WCTYPE.H iswxdigit(): https://docs.microsoft.com/en-us/cpp/c-runtime-li= brary/reference/isxdigit-iswxdigit-isxdigit-l-iswxdigit-l?view=3Dvs-2019 NEW WCTYPE.H iswctype(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/isctype-iswctype-isctype-l-iswctype-l?view=3Dvs-2019 NEW WCTYPE.H wctype(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/wctype?view=3Dvs-2019 NEW WCTYPE.H towlower(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/tolower-tolower-towlower-tolower-l-towlower-l?view=3Dvs-2019 NEW WCTYPE.H towupper(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/toupper-toupper-towupper-toupper-l-towupper-l?view=3Dvs-2019 NEW WCTYPE.H towctrans(): https://docs.microsoft.com/en-us/cpp/c-runtime-li= brary/reference/towctrans?view=3Dvs-2019 NEW WCTYPE.H wctrans(): https://docs.microsoft.com/en-us/cpp/c-runtime-libr= ary/reference/wctrans?view=3Dvs-2019 NOTE: C locale support only All functions are tested in one single driver PEI/DXE: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValida= tionPkg/WCTYPE_H/wctypehfunctions/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=92d like to introduce the CdePkg to edk2-staging. Some time ago I decided to write my own ANSI C Library for UEFI Shell and P= OST. The UEFI Shell library (=93Torito C Library=94) has been production-ready f= or more than one year. The POST version of the library (=93CdeLib=94) 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/CdeValid= ationPkg/HOSTED_ENV/argcv/main.c#L57 argc/argv handling according to https://msdn.microsoft.com/en-us/library/a1= y7w461.aspx 1. systeminterfacePEI: https://github.com/tianocore/edk2-staging/blob/Cd= ePkg/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/Cd= ePkg/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=92t forced= to keep in mind a lot of additional info (e.g. RShiftU64) 4. provide all intrisics to allow the compiler to be a =93C compiler=94 (e.g. char buffer[256] =3D { 1 };) What is CdePkg and Torito C Library? * CdePkg and Torito C Library are a one man show / after work party, th= at 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 Develop= ment 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 sou= rce code from GNU, BSD, Watcom * completeness: full blown C90 + C95 support, as lowest common denomina= tor * tailored for UEFI: small code size, for UEFI-POST-driver uses a C-Lib= rary-Driver, that contains core/worker functions for realloc() =3D=3D mall= oc() and free(), entire printf()-family, entire scanf()-family. UEFI-POST-driver just uses small wrapper functions to run the C-Library-Dri= ver code. * stable, exact, chipset independent TSC based clock() with CLOCKS_PER_= SEC =3D=3D 1000 * complete set of the Microsoft C-compiler intrinsic functions * ROM-able! Runs with stack but w/o any static storage duration in .dat= a segment, e.g. for rand(), strtok(), tmpfile() This is required for early PEI before memory sizing, when PEI-images run di= rectly out of flash * Microsoft (bug) compatible (as far as possible) * use original Microsoft header files for UEFI Shell Apps created in= VS2019 * allow expensive debugging tasks of ANSI C .EFI applications in Vis= ual Studio in its Windows NT counter part * to save my lifetime writing a documentation https://github.com/tia= nocore/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 fea= ture-complete and accepted by the UEFI community. As long as it is for Microsoft VS2019 only. CdePkg README.md is here: h= ttps://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-stagi= ng/blob/CdePkg/CdeValidationPkg/README.md CdeValidationPkg HOWTO is here: https://github.com/tianocore/edk2-staging/b= lob/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 Vlv2TbltDevice= Pkg\PlatformPkgX64.dsc 7. update MinnowBoard with Build/Vlv2TbltDevicePkgX64\DEBUG_VS2015x86\FV= \VLV.fd Best regards, Kilian Kegel --_000_VI1PR0502MB396836FC591E97269BC99E13EB460VI1PR0502MB3968_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

Hi UEFI community,<= /o:p>

 =

I=92d 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 CdePk= g is to provide an ANSI C Interface for UEFI POST drivers,

that enables BIOS engine= ers to (more) easily port standard C programs or libraries

(e.g. the openSSL librar= y, already done) to POST drivers.

 =

Furthermore the ANSI = C Interface is disseminated widely, also it=92s bugs and pitfalls are known very we= ll

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 availa= ble today in Tianocore UEFI.<= /p>

 =

Now 31 new ANSI C functi= ons is= alnum(),isalpha(),iscntrl(),isdigit(),isgraph(),islower(),isprint(),ispunct= (),isspace(),isupper(),isxdigit(),tolower(),toupper() from CTYPE.H<= /b>

and iswalnum(),iswa= lpha(),iswblank(),iswcntrl(),iswdigit(),iswgraph(),iswlower(),iswprint(),is= wpunct(),iswspace(),

iswupper(),iswxdigit(),iswctype(),wctype(),towlower(),towuppe= r(),towctrans(),wctrans() from WCTYPE.H <= /b>

are introduced for PE= I and DXE.

 

Currently there are 11= examples implemented, demonstrating all in all  107 functions defined by ANSI C:

  1. <= span style=3D"color:windowtext">argvc: https://github.com/tianocore= /edk2-staging/blob/CdePkg/CdeValidationPkg/HOSTED_ENV/argcv/main.c#L57<= b>

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

  1. <= span style=3D"color:windowtext">systeminterfacePEI: https://github.com/t= ianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfac= ePEI/main.c#L57

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

  1. <= span style=3D"color:windowtext">systeminterfaceDXE: https://github.com/t= ianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfac= eDXE/main.c#L57

demonstration, how SystemTable<= /span> and = ImageHandle are passed into = main()

 

ANSI C LIBRAR= Y functions:

  1. time.h clock(): https://github.com/tianocore/edk2-sta= ging/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() <= /span>function.

NOTE: in emu= lation mode the TSC nominal frequency is supposed to be 1GHz

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

  1. time.h  difftime(): https://docs.microsoft.com/en-us/cpp/c-runtime-= library/reference/difftime-difftime32-difftime64?view=3Dvs-2019<= o:p>

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

time.h = tim= e(): ht= tps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32-= time64?view=3Dvs-2019

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

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

time.h  g= mtime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/gmtime-g= mtime32-gmtime64?view=3Dvs-2019=

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

time.h  s= trftime(): https://doc= s.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-str= ftime-l-wcsftime-l?view=3Dvs-2019

NOTE: All TI= ME.H functions support UTC only.

All functions are= tested in one single driver PEI/DXE: https://github.com/tianocor= e/edk2-staging/blob/CdePkg/CdeValidationPkg/TIME_H/timehfunctions/main.c#L5= 2

  1. STRING.H mem= cpy():https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memcpy-w= memcpy?view=3Dvs-2019

STRING.H m= emmove():https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/mem= move-wmemmove?view=3Dvs-2019=

STRING.H strcp= y(): https= ://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcpy-wcscpy-m= bscpy?view=3Dvs-2019

STRING.H s= trncpy(): https://docs.microsoft.com/en-us/cpp/c-r= untime-library/reference/strncpy-strncpy-l-wcsncpy-wcsncpy-l-mbsncpy-mbsncp= y-l?view=3Dvs-2019=

STRING.H s= trcat(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcat-w= cscat-mbscat?view=3Dvs-2019

STRING.H s= trncat(): https://docs.microsoft.com/en-us/cpp/c-r= untime-library/reference/strncat-strncat-l-wcsncat-wcsncat-l-mbsncat-mbsnca= t-l?view=3Dvs-2019=

STRING.H m= emcmp(): http= s://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memcmp-wmemcmp= ?view=3Dvs-2019

STRING.H s= trcmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcmp-w= cscmp-mbscmp?view=3Dvs-2019

STRING.H s= trncmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/ref= erence/strncmp-wcsncmp-mbsncmp-mbsncmp-l?view=3Dvs-2019

STRING.H m= emchr(): http= s://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memchr-wmemchr= ?view=3Dvs-2019

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

STRING.H s= trcspn(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/ref= erence/strcspn-wcscspn-mbscspn-mbscspn-l?view=3Dvs-2019

STRING.H s= trpbrk(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/ref= erence/strpbrk-wcspbrk-mbspbrk-mbspbrk-l?view=3Dvs-2019

STRING.H s= trrchr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/ref= erence/strrchr-wcsrchr-mbsrchr-mbsrchr-l?view=3Dvs-2019

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

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

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

STRING.H m= emset(): http= s://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memset-wmemset= ?view=3Dvs-2019

STRING.H s= trerror(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/ref= erence/strerror-strerror-wcserror-wcserror?view=3Dvs-2019

STRING.H s= trlen(): https://docs.microsoft.com/en-us/cpp/c-runti= me-library/reference/strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l?view= =3Dvs-2019

NOTE: All ST= RING.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/tian= ocore/edk2-staging/blob/CdePkg/CdeValidationPkg/STRING_H/stringhfunctions/m= ain.c#L52

  1. WCHAR.H wpri= ntf(): https://docs.mic= rosoft.com/en-us/cpp/c-runtime-library/reference/printf-printf-l-wprintf-wp= rintf-l?view=3Dvs-2019

WCHAR.H swprintf(): https://docs.mi= crosoft.com/en-us/cpp/c-runtime-library/reference/sprintf-sprintf-l-swprint= f-swprintf-l-swprintf-l?view=3Dvs-2019

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

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

WCHAR.H wcsncpy(): = https://do= cs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncpy-strncpy-l-wc= sncpy-wcsncpy-l-mbsncpy-mbsncpy-l?view=3Dvs-2019

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

WCHAR.H wcsncat(): = https://do= cs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncat-strncat-l-wc= sncat-wcsncat-l-mbsncat-mbsncat-l?view=3Dvs-2019

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

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

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

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

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

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

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

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

WCHAR.H wcstok(): https://docs.mic= rosoft.com/en-us/cpp/c-runtime-library/reference/strtok-strtok-l-wcstok-wcs= tok-l-mbstok-mbstok-l?view=3Dvs-2019

WCHAR.H wcslen(): https://docs.m= icrosoft.com/en-us/cpp/c-runtime-library/reference/strlen-wcslen-mbslen-mbs= len-l-mbstrlen-mbstrlen-l?view=3Dvs-2019

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

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

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

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

NOTE: 21 WCH= AR.H functions are available in PEI and DXE. 29 functions are not yet imple= mented, that are file and multi byte functions

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

  1. STDIO.H tmpn= am(): https://docs.micros= oft.com/en-us/cpp/c-runtime-library/reference/tempnam-wtempnam-tmpnam-wtmpn= am?view=3Dvs-2019

STDIO.H= pr= intf(): https://docs.microsof= t.com/en-us/cpp/c-runtime-library/reference/printf-printf-l-wprintf-wprintf= -l?view=3Dvs-2019

STDIO.H= sn= printf(): https:= //docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprint= f-snprintf-l-snwprintf-snwprintf-l?view=3Dvs-2019

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

STDIO.H= vs= nprintf(): h= ttps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsnprintf-v= snprintf-vsnprintf-l-vsnwprintf-vsnwprintf-l?view=3Dvs-2019<= /span>

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

STDIO.H= ss= canf(): https://docs.microsof= t.com/en-us/cpp/c-runtime-library/reference/sscanf-sscanf-l-swscanf-swscanf= -l?view=3Dvs-2019

STDIO.H= vp= rintf(): https://docs.micros= oft.com/en-us/cpp/c-runtime-library/reference/vprintf-vprintf-l-vwprintf-vw= printf-l?view=3Dvs-2019

STDIO.H= vs= printf(): htt= ps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsprintf-vspr= intf-l-vswprintf-vswprintf-l-vswprintf-l?view=3Dvs-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: snprin= tf(), vsnprintf() and vsscanf() are C99 and implemented due to their useful= ness for security related software

NOTE: printf= () and vprintf() write to ConOut that is actually not visible in PEI and DX= E, 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=3Dvs-2019

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

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

STDLIB.H strtoul(): https://docs.micro= soft.com/en-us/cpp/c-runtime-library/reference/strtoul-strtoul-l-wcstoul-wc= stoul-l?view=3Dvs-2019

STDLIB.H rand(): https://docs.microsoft.com/en-us/cpp/c-runtime-li= brary/reference/rand?view=3Dvs-2019

STDLIB.H srand(): https://docs.microsoft.com/en-us/cpp/c-runtime-l= ibrary/reference/srand?view=3Dvs-2019

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

STDLIB.H free(): https://docs.microsoft.com/en-us/cpp/c-runtime-li= brary/reference/free?view=3Dvs-2019

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

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

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

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

STDLIB.H qsort(): https://docs.microsoft.com/en-us/cpp/c-runtime-l= ibrary/reference/qsort?view=3Dvs-2019

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

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

STDLIB.H div(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/div?view=3Dvs-2019

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

NOTE: missin= g from STDLIB.H: abort(), strtod(), atof(), getenv(), system(), bsearch()

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

  1. NEW CTYPE.H = isalnum(): https://docs.microso= ft.com/en-us/cpp/c-runtime-library/reference/isalnum-iswalnum-isalnum-l-isw= alnum-l?view=3Dvs-2019

NEW CTYPE.H : https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isalpha-iswalpha-is= alpha-l-iswalpha-l?view=3Dvs-2019<= /span>

NEW CTYPE.H : https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/iscntrl-iswcntrl-is= cntrl-l-iswcntrl-l?view=3Dvs-2019<= /span>

NEW CTYPE.H : https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isdigit-iswdigit-is= digit-l-iswdigit-l?view=3Dvs-2019<= /span>

NEW CTYPE.H : https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isgraph-iswgraph-is= graph-l-iswgraph-l?view=3Dvs-2019<= /span>

NEW CTYPE.H : https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/islower-iswlower-is= lower-l-iswlower-l?view=3Dvs-2019<= /span>

NEW CTYPE.H : https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isprint-iswprint-is= print-l-iswprint-l?view=3Dvs-2019<= /span>

NEW CTYPE.H : https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/ispunct-iswpunct-is= punct-l-iswpunct-l?view=3Dvs-2019<= /span>

NEW CTYPE.H : https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isspace-iswspace-is= space-l-iswspace-l?view=3Dvs-2019<= /span>

NEW CTYPE.H : https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isupper-isupper-l-i= swupper-iswupper-l?view=3Dvs-2019<= /span>

NEW CTYPE.H : https= ://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isxdigit-iswxdi= git-isxdigit-l-iswxdigit-l?view=3Dvs-2019

NEW CTYPE.H : h= ttps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tolower-tol= ower-towlower-tolower-l-towlower-l?view=3Dvs-2019

NEW CTYPE.H : h= ttps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/toupper-tou= pper-towupper-toupper-l-towupper-l?view=3Dvs-2019

NOTE: C loca= le support only

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

  1. NEW WCTYPE.H iswalnum(): https://docs.mic= rosoft.com/en-us/cpp/c-runtime-library/reference/isalnum-iswalnum-isalnum-l= -iswalnum-l?view=3Dvs-2019

NEW WCTYPE.H i= swalpha(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isalpha-iswalpha-is= alpha-l-iswalpha-l?view=3Dvs-2019<= /span>

NEW WCTYPE.H i= swblank(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isblank-iswblank-is= blank-l-iswblank-l?view=3Dvs-2019<= /span>

NEW WCTYPE.H i= swcntrl(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/iscntrl-iswcntrl-is= cntrl-l-iswcntrl-l?view=3Dvs-2019<= /span>

NEW WCTYPE.H i= swdigit(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isdigit-iswdigit-is= digit-l-iswdigit-l?view=3Dvs-2019<= /span>

NEW WCTYPE.H i= swgraph(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isgraph-iswgraph-is= graph-l-iswgraph-l?view=3Dvs-2019<= /span>

NEW WCTYPE.H i= swlower(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/islower-iswlower-is= lower-l-iswlower-l?view=3Dvs-2019<= /span>

NEW WCTYPE.H i= swprint(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isprint-iswprint-is= print-l-iswprint-l?view=3Dvs-2019<= /span>

NEW WCTYPE.H i= swpunct(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/ispunct-iswpunct-is= punct-l-iswpunct-l?view=3Dvs-2019<= /span>

NEW WCTYPE.H i= swspace(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isspace-iswspace-is= space-l-iswspace-l?view=3Dvs-2019<= /span>

NEW WCTYPE.H i= swupper(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isupper-isupper-l-i= swupper-iswupper-l?view=3Dvs-2019<= /span>

NEW WCTYPE.H i= swxdigit(): https= ://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/isxdigit-iswxdi= git-isxdigit-l-iswxdigit-l?view=3Dvs-2019

NEW WCTYPE.H i= swctype(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/isctype-iswctype-is= ctype-l-iswctype-l?view=3Dvs-2019<= /span>

NEW WCTYPE.H w= ctype(): https://docs.microsoft.com/en-us/cpp/c-r= untime-library/reference/wctype?view=3Dvs-2019

NEW WCTYPE.H t= owlower(): h= ttps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tolower-tol= ower-towlower-tolower-l-towlower-l?view=3Dvs-2019

NEW WCTYPE.H t= owupper(): h= ttps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/toupper-tou= pper-towupper-toupper-l-towupper-l?view=3Dvs-2019

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

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

NOTE: C loca= le support only

All functions are= tested in one single driver PEI/DXE:  https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidati= onPkg/WCTYPE_H/wctypehfunctions/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<= /a>; Richardson, Brian
Subject: [edk2-devel] [staging/branch]: CdePkg - C Development Envir= onment Package

 

Hi UEFI community,<= /o:p>

 =

I=92d 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.<= /p>

 

The UEFI Shell library = (=93Torito C Library=94) has been production-ready for more than one year.<= o:p>

The POST version of the= library (=93CdeLib=94) is not yet fully tested.

 

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

 

Currently there are 3 examples implemented:

  1. <= span style=3D"color:windowtext">argvc: https://github.com/tianocore= /edk2-staging/blob/CdePkg/CdeValidationPkg/HOSTED_ENV/argcv/main.c#L57<= b>

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

  1. <= span style=3D"color:windowtext">systeminterfacePEI: https://github.com/t= ianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfac= ePEI/main.c#L57

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

  1. <= span style=3D"color:windowtext">systeminterfaceDXE: https://github.com/t= ianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfac= eDXE/main.c#L57

demonstration, how SystemTable<= /span> and = ImageHandle are passed into = main()

 

Upcoming next demonstra= tion will be the = clock() function end of this week

 

The idea is to bring th= e ANSI C Library interface into POST drivers.

This will:

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

(e.g. char bu= ffer[256] =3D { 1 };)=

 

What is CdePkg and Tori= to C Library?

  • CdeP= kg 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 th= e successor of Torito C, based on the same source code
  • CdePkg C = Development Environment is similar to  MdePkg Module Development Envir= onment

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

 

What are the design goa= ls?

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

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

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

  • stab= le, exact, chipset independent TSC based clock() = with CLOCKS_PER_SEC =3D=3D 1000
  • complete set of the Mi= crosoft C-compiler intrinsic functions
  • ROM-able! Runs with stack but w/o any static stor= age duration in .data segment, e.g. for ra= nd(), strtok(), tmpfile()

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

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

 =

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

As long as it is fo= r Microsoft VS2019 only.

 

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

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

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/READ= ME.md

 

HOWTO:

  1. clon= e the edk2-staging repository
  2. checkout CdePkg=
  3. run LAUNCH.BAT
  4. run build -p EmulatorPkg\Emula= torPkg.dsc -t VS2015x86 -a IA32<= /code>
  5. run DBGEMU.BAT to start emulation (EmulatorPkg)
  6. run build -a IA32 -a X64 -n 5 -t VS2015x86 -b DEBU= G -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc<= /o:p>
  7. update MinnowBoard with<= b> Build/Vlv2TbltDevicePkgX64\DEBUG_VS2015x86\FV\VLV.fd

&nbs= p;

Best regards= ,

Kilian Kegel=

 

 

 

 

 

 

--_000_VI1PR0502MB396836FC591E97269BC99E13EB460VI1PR0502MB3968_--