From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (EUR03-VE1-obe.outbound.protection.outlook.com [40.92.72.79]) by mx.groups.io with SMTP id smtpd.web11.11628.1574774978796366952 for ; Tue, 26 Nov 2019 05:29:39 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=tkgimcwj; spf=pass (domain: outlook.com, ip: 40.92.72.79, mailfrom: kilian_kegel@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k8iHb2AvXtHp2G7yf9x3n31RtHtWMSSfOnWL6k36zp7eWrvTNCzdj0VxsVqvaisx+dR9YBVA0Fd6v24NGQTxfGTCztZG3YvsLw6/b9PeFUGPmDxMKhb/bX87vXF4uJpDM8WdPAoBkbHE5qmbpiuIoaIz5UYkiDVrlwfp8pdhfP5epfUJvWxiyf+X/6XbjFB0Hpm5hrYJYI32tQgRrpFjyU3m+4xnJkWl0ExQ1vhU7NNMXFALtFh6lJL6uNI+xyZ43kU3YvVmoWlWd710WkFUqJ6cuNLhl6w08AkiF2nHuKuT2qJd/YCdzy4EsiXojHmf9ok4jQ8VbveAp9gDHT4AGg== 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=AZaFIKnN2+ZbRpGBtq1uk1VQbzXUMeVs5DbGYkWufxs=; b=gOJtfkYAdAjM9CbJVp/g5LOsdJ2XXhxfmtqcwAVQl4/xOwCIKHWyGKJqRfoLeyDcDpVz0W2pT7z3htdiPVBvpwkRkHReHqQUVDt8kk2GSUPizPGT5OuFD9MkRwmdEzsCLqnLDlCU/lOXOsElfJNtVeKBS/1dLJRq0/eWv5/LaDWSJqOsJ/CJDoSgSv3YPaQm7NDLtj2cONnOFDg6lcfgH/NS1tiuLePj164fVr5TloU9Q+cFiHTprds+CejlxWBOvefZd0F/5jyvisCi0QdbpCG6tQ7EOZ0mZJQhsh1M9gWGm7b5bR9yOmWiHiCmRdZ0Xqf7lYiaurHl/eWq9gCxFw== 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=AZaFIKnN2+ZbRpGBtq1uk1VQbzXUMeVs5DbGYkWufxs=; b=tkgimcwjmaQUVJYFq+hbehZ63ZI4/s741ZQ9PuTkdM1+B4ldUvuWuCw+Uw9GAe8qB/liQImUTB+NGaOFIZKPu/+t9Qp6CkX4XxoDKxmu8B373iQIPI9ruLpSx0m/hEJpvF10aM5l+67skcJMt/hqA9/FA+uNEfStymZUfU9RukmBDkqw0EhVcQiYhOwJd3NgDcuIeYPpfoI1xJylMiva7Mcf1Ue2DCa6VPBslqczbA/WK0rP3wX5tqBSFUrBfKz9r1WytAp3avsyUwXW4K7/zzuG+RvjVkspWCR/JwVFPl4nFGO2zN2oFk0sNHXqXKWqf/8ImgIOG8V++rtuzblfmA== Received: from AM5EUR03FT061.eop-EUR03.prod.protection.outlook.com (10.152.16.57) by AM5EUR03HT045.eop-EUR03.prod.protection.outlook.com (10.152.17.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17; Tue, 26 Nov 2019 13:29:35 +0000 Received: from VI1PR0502MB3968.eurprd05.prod.outlook.com (10.152.16.59) by AM5EUR03FT061.mail.protection.outlook.com (10.152.16.247) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17 via Frontend Transport; Tue, 26 Nov 2019 13:29:35 +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.2474.023; Tue, 26 Nov 2019 13:29:35 +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 STDIO.H functions - tmpnam() printf() snprintf() sprintf() vsnprintf() vsscanf() sscanf() vprintf() vsprintf() Thread-Topic: [edk2-devel] [staging/branch]: CdePkg - added unit test for STDIO.H functions - tmpnam() printf() snprintf() sprintf() vsnprintf() vsscanf() sscanf() vprintf() vsprintf() Thread-Index: AQHVpFF9JP/6AsSnmEG4liXej248XQ== Date: Tue, 26 Nov 2019 13:29:35 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:3C6304D1934B0CFB9B4585F944F109D874382044B456A9ADA4D84544823B0CEE;UpperCasedChecksum:1BBEA6EDD7E30EEFD3916B9CDCC9FCFAF3FD03012D2908F8EEFEEB03E423E2FC;SizeAsReceived:7179;Count:43 x-tmn: [Ion4TU8AhjCL5hiaZjXXHSDI9dsGNeJR] x-ms-publictraffictype: Email x-incomingheadercount: 43 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: f695bc6e-4c19-4311-bf1d-08d77274adde x-ms-traffictypediagnostic: AM5EUR03HT045: x-ms-exchange-purlcount: 61 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nn3ByUJgq0no/P+g+LBq7HKDPsm0GvrGIz3XCIFXMAm8s263EVd/w+ZHIsOFakHavRP2SSBbYAubPjabzLGi9kL0e22pYgjYnEyJdViTs5pR9g9qbyq9tsHWIh28GeTRjyGrLnGHsL3NwJwBtistwUNGBofqoZVcOQ59s8KJoww8O4PwaNHKbCKqWF4U5CaTGhrunHX43BLnyI5jlZ+awHrsNMtgC1CzQlQMVorkQEY= 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: f695bc6e-4c19-4311-bf1d-08d77274adde X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Nov 2019 13:29:35.4493 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR03HT045 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_VI1PR0502MB396889B3EB68B5FAC69ED59CEB450VI1PR0502MB3968_" --_000_VI1PR0502MB396889B3EB68B5FAC69ED59CEB450VI1PR0502MB3968_ 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-sta= ging. https://github.com/tianocore/edk2-staging/tree/CdePkg#cdepkg The goal of the CdePkg is to provide an ANSI C Interface for UEFI POST dri= vers, that enables BIOS engineers to (more) easily port standard C programs or l= ibraries (e.g. the openSSL library, already done) to POST drivers. Furthermore the ANSI C Interface is disseminated widely, also it=92s 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 9 new ANSI C functions tmpnam(), printf(), snprintf(), sprintf(), vsnp= rintf(), vsscanf(), sscanf(), vprintf(), vsprintf() are introduced for PEI and DXE. Currently there are 8 examples implemented: 1. argvc: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeVali= dationPkg/HOSTED_ENV/argcv/main.c#L57 argc/argv handling according to https://msdn.microsoft.com/en-us/library/a= 1y7w461.aspx 1. systeminterfacePEI: https://github.com/tianocore/edk2-staging/blob/C= dePkg/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/C= dePkg/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/CdePk= g/CdeValidationPkg/TIME_H/clock/main.c#L1 for PEI and DXE phase. It provides TSC based, millisecond precise, exact a= nd 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?vie= w=3Dvs-2019 1. time.h difftime(): https://docs.microsoft.com/en-us/cpp/c-runtime-l= ibrary/reference/difftime-difftime32-difftime64?view=3Dvs-2019 time.h mktime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/mktime-mktime32-mktime64?view=3Dvs-2019<%20https:/docs.microsoft.c= om/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/refe= rence/time-time32-time64?view=3Dvs-2019<%20https:/docs.microsoft.com/en-us/= cpp/c-runtime-library/reference/time-time32-time64?view=3Dvs-2019> time.h asctime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/asctime-wasctime?view=3Dvs-2019 time.h ctime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/re= ference/ctime-ctime32-ctime64-wctime-wctime32-wctime64?view=3Dvs-2019 time.h gmtime(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/gmtime-gmtime32-gmtime64?view=3Dvs-2019 time.h localtime(): https://docs.microsoft.com/en-us/cpp/c-runtime-librar= y/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/= tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/TIME_H/timehfunctions/m= ain.c#L52 1. STRING.H memcpy():https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/memcpy-wmemcpy?view=3Dvs-2019 STRING.H memmove():https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/memmove-wmemmove?view=3Dvs-2019 STRING.H strcpy(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/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-= 2019 STRING.H strcat(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/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-= 2019 STRING.H memcmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/memcmp-wmemcmp?view=3Dvs-2019 STRING.H strcmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/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/= reference/memchr-wmemchr?view=3Dvs-2019 STRING.H strchr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/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/= reference/strspn-wcsspn-mbsspn-mbsspn-l?view=3Dvs-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=3Dvs-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=3Dvs-2019 STRING.H memset(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/memset-wmemset?view=3Dvs-2019 STRING.H strerror(): https://docs.microsoft.com/en-us/cpp/c-runtime-librar= y/reference/strerror-strerror-wcserror-wcserror?view=3Dvs-2019 STRING.H strlen(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l?view=3Dvs-2019 NOTE: All STRING.H functions are completely available in PEI and DXE, exce= pt strcoll() and strxftm() All functions are tested in one single driver PEI/DXE: https://github.com/= tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/STRING_H/stringhfunctio= ns/main.c#L52 1. WCHAR.H wprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-li= brary/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-librar= y/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/r= eference/strcpy-wcscpy-mbscpy?view=3Dvs-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=3Dvs-2= 019 WCHAR.H wcscat(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strcat-wcscat-mbscat?view=3Dvs-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=3Dvs-2= 019 WCHAR.H wcscmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/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/cpp/c-runtime-library/r= eference/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?view=3Dvs-2019 WCHAR.H wcsspn(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strspn-wcsspn-mbsspn-mbsspn-l?view=3Dvs-2019 WCHAR.H wcsstr(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/strstr-wcsstr-mbsstr-mbsstr-l?view=3Dvs-2019 WCHAR.H wcstok(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/r= eference/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/r= eference/strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l?view=3Dvs-2019 WCHAR.H wmemcmp(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= reference/memcmp-wmemcmp?view=3Dvs-2019 WCHAR.H wmemcpy(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/= 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-library/= reference/memset-wmemset?view=3Dvs-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. NEW STDIO.H tmpnam(): https://docs.microsoft.com/en-us/cpp/c-runtime= -library/reference/tempnam-wtempnam-tmpnam-wtmpnam?view=3Dvs-2019 NEW STDIO.H printf(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/printf-printf-l-wprintf-wprintf-l?view=3Dvs-2019 NEW STDIO.H snprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=3Dvs= -2019 NEW STDIO.H sprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-libr= ary/reference/sprintf-sprintf-l-swprintf-swprintf-l-swprintf-l?view=3Dvs-20= 19 NEW STDIO.H vsnprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-li= brary/reference/vsnprintf-vsnprintf-vsnprintf-l-vsnwprintf-vsnwprintf-l?vie= w=3Dvs-2019 NEW STDIO.H vsscanf(): https://docs.microsoft.com/en-us/cpp/c-runtime-libr= ary/reference/vsscanf-vswscanf?view=3Dvs-2019 NEW STDIO.H sscanf(): https://docs.microsoft.com/en-us/cpp/c-runtime-libra= ry/reference/sscanf-sscanf-l-swscanf-swscanf-l?view=3Dvs-2019 NEW STDIO.H vprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-libr= ary/reference/vprintf-vprintf-l-vwprintf-vwprintf-l?view=3Dvs-2019 NEW STDIO.H vsprintf(): https://docs.microsoft.com/en-us/cpp/c-runtime-lib= rary/reference/vsprintf-vsprintf-l-vswprintf-vswprintf-l-vswprintf-l?view= =3Dvs-2019 NOTE: 9 STDIO.H functions are available in PEI and DXE. 36 functions are n= ot 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 Best Regards, Kilian From: Kilian Kegel Sent: Wednesday, October 23, 2019 10:03 PM To: devel@edk2.groups.io Cc: Kinney, Michael D; Richardson, Bria= n 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 = POST. The UEFI Shell library (=93Torito C Library=94) has been production-ready = for 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/CdeVali= dationPkg/HOSTED_ENV/argcv/main.c#L57 argc/argv handling according to https://msdn.microsoft.com/en-us/library/a= 1y7w461.aspx 1. systeminterfacePEI: https://github.com/tianocore/edk2-staging/blob/C= dePkg/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/C= dePkg/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 force= d 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, t= hat 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 Develo= pment 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 so= urce code from GNU, BSD, Watcom * completeness: full blown C90 + C95 support, as lowest common denomin= ator * tailored for UEFI: small code size, for UEFI-POST-driver uses a C-Li= brary-Driver, that contains core/worker functions for realloc() =3D=3D mal= loc() and free(), entire printf()-family, entire scanf()-family. UEFI-POST-driver just uses small wrapper functions to run the C-Library-Dr= iver 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 .da= ta segment, e.g. for rand(), strtok(), tmpfile() This is required for early PEI before memory sizing, when PEI-images run d= irectly out of flash * Microsoft (bug) compatible (as far as possible) * use original Microsoft header files for UEFI Shell Apps created i= n VS2019 * allow expensive debugging tasks of ANSI C .EFI applications in Vi= sual Studio in its Windows NT counter part * to save my lifetime writing a documentation https://github.com/ti= anocore/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 fe= ature-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/CdePk= g/README.md#howto CdeValidationPkg README.md is here: https://github.com/tianocore/edk2-stag= ing/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 Vlv2TbltDevic= ePkg\PlatformPkgX64.dsc 7. update MinnowBoard with Build/Vlv2TbltDevicePkgX64\DEBUG_VS2015x86\F= V\VLV.fd Best regards, Kilian Kegel --_000_VI1PR0502MB396889B3EB68B5FAC69ED59CEB450VI1PR0502MB3968_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

Hi UEFI community,=

 

I=92d like to inform yo= u about an update in the CdePkg branch of  edk2-staging.

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

 

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

that enables BIOS engin= eers to (more) easily port standard C programs or libraries

(e.g. the openSSL libra= ry, already done) to POST drivers.

 

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

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

compared to the proprietary interface that is avail= able today in Tianocore UEFI.=

 

Now 9 new ANSI C functi= ons t= mpnam(), printf(), snprintf(), sprintf(), vsnprintf(), vsscanf(), sscanf(),= vprintf(), vsprintf()

are introduced for P= EI and DXE.

 

Currently there are 8= examples implemented:

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

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

  1. = systeminterfacePEI: https://github.com/= tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfa= cePEI/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/systeminterfa= ceDXE/main.c#L57

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

 

ANSI C LIBRA= RY functions:

  1. time.h clock(): https://github.com/tianocore/edk2-st= aging/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 em= ulation mode the TSC nominal frequency is supposed to be 1GHz

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

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

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

time.h ti= me(): h= ttps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32= -time64?view=3Dvs-2019

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

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

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

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

time.h  = strftime(): https://do= cs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-st= rftime-l-wcsftime-l?view=3Dvs-2019

NOTE: All T= IME.H functions support UTC only.

All functions ar= e tested in one single driver PEI/DXE: https://github.com/tianoco= re/edk2-staging/blob/CdePkg/CdeValidationPkg/TIME_H/timehfunctions/main.c#L= 52

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

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

STRING.H strc= py(): http= s://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/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-mbsnc= py-l?view=3Dvs-2019

STRING.H = strcat(): https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/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-mbsnc= at-l?view=3Dvs-2019

STRING.H = memcmp(): htt= ps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memcmp-wmemcm= p?view=3Dvs-2019

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

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

STRING.H = memchr(): htt= ps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memchr-wmemch= r?view=3Dvs-2019

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

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

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

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

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

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

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

STRING.H = memset(): htt= ps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/memset-wmemse= t?view=3Dvs-2019

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

STRING.H = strlen(): https://docs.microsoft.com/en-us/cpp/c-runt= ime-library/reference/strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l?vie= w=3Dvs-2019

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

All functions ar= e tested in one single driver PEI/DXE: https://github.com/tia= nocore/edk2-staging/blob/CdePkg/CdeValidationPkg/STRING_H/stringhfunctions/= main.c#L52

  1. WCHAR.H wpr= intf(): https://docs.mi= crosoft.com/en-us/cpp/c-runtime-library/reference/printf-printf-l-wprintf-w= printf-l?view=3Dvs-2019

WCHAR.H swprintf(): https://docs.m= icrosoft.com/en-us/cpp/c-runtime-library/reference/sprintf-sprintf-l-swprin= tf-swprintf-l-swprintf-l?view=3Dvs-2019

WCHAR.H vswprintf(): https://d= ocs.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-run= time-library/reference/strcpy-wcscpy-mbscpy?view=3Dvs-2019

WCHAR.H wcsncpy(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncpy-strncpy-l-w= csncpy-wcsncpy-l-mbsncpy-mbsncpy-l?view=3Dvs-2019

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

WCHAR.H wcsncat(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncat-strncat-l-w= csncat-wcsncat-l-mbsncat-mbsncat-l?view=3Dvs-2019

WCHAR.H wcscmp(): https://docs.microsoft.com/en-us/cpp/c-run= time-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/= cpp/c-runtime-library/reference/strchr-wcschr-mbschr-mbschr-l?view=3Dvs-201= 9WCHAR.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?vi= ew=3Dvs-2019

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

WCHAR.H wcsstr(): https://docs.microsoft.com/en-us/= cpp/c-runtime-library/reference/strstr-wcsstr-mbsstr-mbsstr-l?view=3Dvs-201= 9WCHAR.H wcstok(): https://docs.mi= crosoft.com/en-us/cpp/c-runtime-library/reference/strtok-strtok-l-wcstok-wc= stok-l-mbstok-mbstok-l?view=3Dvs-2019

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

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

WCHAR.H wmemcpy(): https://docs.microsoft.com/en-us/cpp/c-runtime-l= ibrary/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-l= ibrary/reference/memset-wmemset?view=3Dvs-2019

NOTE: 21 WC= HAR.H functions are available in PEI and DXE. 29 functions are not yet impl= emented, that are file and multi byte functions

All functions ar= e tested in one single driver PEI/DXE: https://github.com/tiano= core/edk2-staging/blob/CdePkg/CdeValidationPkg/WCHAR_H/wcharhfunctions/main= .c

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

NEW STDIO.H p= rintf(): https://docs.microsoft.com/en-us= /cpp/c-runtime-library/reference/printf-printf-l-wprintf-wprintf-l?view=3Dv= s-2019

NEW STDIO.H s= nprintf(): https://docs.micr= osoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-= l-snwprintf-snwprintf-l?view=3Dvs-2019

NEW STDIO.H s= printf(): https://docs.micros= oft.com/en-us/cpp/c-runtime-library/reference/sprintf-sprintf-l-swprintf-sw= printf-l-swprintf-l?view=3Dvs-2019

NEW STDIO.H v= snprintf(): https://d= ocs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsnprintf-vsnprintf= -vsnprintf-l-vsnwprintf-vsnwprintf-l?view=3Dvs-2019=

NEW STDIO.H v= sscanf(): https://docs.microsoft.com/en-us/cpp/c-runtime-libr= ary/reference/vsscanf-vswscanf?view=3Dvs-2019

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

NEW STDIO.H v= printf(): https://docs.microsoft.com/en-= us/cpp/c-runtime-library/reference/vprintf-vprintf-l-vwprintf-vwprintf-l?vi= ew=3Dvs-2019

NEW STDIO.H v= sprintf(): https://docs.m= icrosoft.com/en-us/cpp/c-runtime-library/reference/vsprintf-vsprintf-l-vswp= rintf-vswprintf-l-vswprintf-l?view=3Dvs-2019

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

NOTE: snpri= ntf(), vsnprintf() and vsscanf() are C99 and implemented due to their usefu= lness for security related software

NOTE: print= f() and vprintf() write to ConOut that is actually not visible in PEI and D= XE, but in the Emulator.

All functions ar= e tested in one single driver PEI/DXE: https://github.com/tianocore= /edk2-staging/blob/CdePkg/CdeValidationPkg/STDIO_H/stdiohfunctions/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 Envi= ronment Package

 

Hi UEFI community,=

 

I=92d like to introduce= the CdePkg to edk2-staging.

 

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

 

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

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

 

I will be demonstratin= g my verification procedure in the upcoming weeks on EDK2 STAGING  h= ttps://github.com/tianocore/edk2-staging/tree/CdePkg

 

Currently there are 3 examples implemented:

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

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

  1. = systeminterfacePEI: https://github.com/= tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfa= cePEI/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/systeminterfa= ceDXE/main.c#L57

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

 

Upcoming next demonstr= ation will be the clock() function end of this week

 

The idea is to bring t= he ANSI C Library interface into POST drivers.

This will:<= /span>

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

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

 

What is CdePkg and Tor= ito C Library?

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

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

 

What are the design go= als?

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

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

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

  • sta= ble, exact, chipset independent TSC based clock()= with CLOCKS_PER_SEC =3D=3D 1000
  • complete set of the M= icrosoft C-compiler intrinsic functions
  • ROM-able! Runs with stack but w/o any static sto= rage duration in .data segment, e.g. for r= and(), strtok(), tmpfile()

This is require= d for early PEI before memory sizing, when PEI-images run directly out of f= lash

  • 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 Stud= io in its Windows NT counter part
    3. to save my lifetime writing a documentation https://github.com/tianocore/edk2-staging/tree/CdePkg/implemented.md#valid= ation-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 f= or Microsoft VS2019 only.

 

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

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

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

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

 

HOWTO:

  1. clo= ne the edk2-staging repository
  2. checkout CdePkg
  3. run LAUNCH.BAT
  4. run build -p EmulatorPkg\Emul= atorPkg.dsc -t VS2015x86 -a IA32=
  5. run DBGEMU.BAT to start emulation (EmulatorPkg)
  6. <= li class=3D"xmsonormal" style=3D"mso-list:l1 level1 lfo5">run build -a IA32 -a X64 -n 5 -t VS2015x86 -b DEB= UG -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc=
  7. update MinnowBoard with= Build/Vlv2TbltDevicePkgX64\DEBUG_VS2015x86\FV\VLV.fd

&nb= sp;

Best regard= s,

Kilian Kege= l

 

 

 

 

 

 

--_000_VI1PR0502MB396889B3EB68B5FAC69ED59CEB450VI1PR0502MB3968_--