Copyright (c) 2017-2025, Kilian Kegel. All rights reserved.
SPDX-License-Identifier: GNU General Public License v3.0
- fix
abort()
processesatexit()
registered functions and closes files before exit. - fix
memset()
to do solely 8Bit memory machine operations. - add Microsoft C Library functions:
- fix minor symbol naming error
- INTERN: minor correction
- add dedicated DEBUG/RELEASE support for CdePkg.
In preparation for the upcoming EDK2-EMU project the entire CdePkg and CdePkg-based components will be debugable on source code level in the EDK2-Emulator.
- fixed: removed disassembled math function wasn't replaced by extracted intrinsic
math function from Microsoft LIBCMT.LIB:
ftol3.obj
ullshr.obj
ullrem.obj
ulldvrm.obj
ulldiv.obj
llshr.obj
llshl.obj
llrem.obj
llmul.obj
lldvrm.obj
lldiv.obj
original Microsoft functions are now available in the toro C Library for 32Bit.
- NEW: Introduce preliminary alpha version of
MATH.H
functions
NOTE: Use functions below fails with special parameters.
It is recommended not to use these functions in productive code.
- introduce intrinsic math function (
_allXYZ()
,_aullXYZ()
and__ltod3()
) extraction from Microsoft **LIBCMT.LIB
- remove disassembled
__allXYZ()
and__aullXYZ()
fromtoroCLibrary
- remove disassembled
- fixed
stat()
running on WINDOWS reports wrong time stamp - fixed
stat()
running on UEFI reports from erronous time stamp by exacly one month - fixed
stat()
running on UEFI to support MSDOS drive name (A:, B:, C: ...) - fixed
system()
running on UEFI with output redirection emits additional garbage characters
- improve C++ support for
CDE.H
- enable mixed C/C++ applications based toro C Library using
CDE.H
- enable mixed C/C++ applications based toro C Library using
- fixe SMM issues:
- fix
CdePkg
-based SMM drivers hangs on startup. - fix
CdeServicesSmm.c
failed to build
NOTE: The improvement above doesn't change ANSI-C related behaviour of previous library versions
- fix
- fixed EDK2
DEBUG
trace macro won't crash anymore with UEFI specific (non-ANSI-C) format specifiers: %g, %t and %r
NOTE: The improvement above doesn't change ANSI-C related behaviour of previous library versions
- include static code analysis configuration
toroCLibrary.ruleset
- fix minor static code analysis warnings
NOTE: The improvement above doesn't change ANSI-C related behaviour of previous library versions
- add timeout detection for disabled COM1/UART at I/O 3F8h used for debug traces.
NOTE: Disabled I/O devices usually do not respond to I/O cycles.
Internally this is done by ignoring the chipselect for that particular I/O address range, e.g. 3F8h .. 3FFh for COM1.
FFh is driven to the data bus when reading registers of those disabled devices.
On special implementations hardware designers chose a different approach to disabled devices:
- address decoding is kept enabled
- internal clock line is stopped or decoupled from internal circuitry
The disadvantage of this aproach is, that status registers are still visible but not updated anymore.
NOTE: The improvement above doesn't change ANSI-C related behaviour of previous library versions
- add semantic versioning + build enumeration
- optimize source code
- reduce number of suppressed warnings (4200;4324;4100 only)
- enable static code analysis (
toroCLibrary.ruleset
, suppress warning 28251 only )
NOTE: The improvement above doesn't change ANSI-C related behaviour of previous library versions
- update copyright date
NOTE: The improvement above doesn't change ANSI-C related behaviour of previous library versions
- add ACPI timer based synchronization for toro C Library Shell programs.
NOTE: On recent Intel platforms the previously used legacy timer's (i8254) input clock frequency is clocked down to an unspecified frequency with setup defaultEnable 8254 Clock Gate
. Additionally the I/O latency to access i8254 ports is increased with setup defaultLegacy IO Low Latency
that lowers i8254 based timing precision.
So i8254 gets unusable for UEFI Shell programs on new platforms. - improve synchronization error correction for i8254 based POST drivers (with
Enable 8254 Clock Gate := disable
,Legacy IO Low Latency := enable
)
- fixed: libxlsxwriter based UEFI and Windows applications create .XLSX that can't be opened with Microsoft Excel 2016. Office 365 online (https://www.microsoft365.com) and offline didn't fail.
- fix
_strefieerror()
to return error correct string when running in pre-memory PEI
- fix
CdePkg\Include\CDE.h
for debug trace purpose in conjunction with original Microsoft header files
- improve debug trace CDETRACE() configuration switches
#define CDEDBG STDOUT
– traces directed to stdout#define CDEDBG STDERR
– traces directed to stderr#define CDEDBG STDDBG
– traces directed to CDE debug channel, normally COM1, I/O 0x3F8 115200,8,n,1CDEDBG
undefined – UEFI Shell/post DRIVERS: STDDBG, Windows NT: STDOUT
-
add
CDE
(C Development Environment)-interface for native Tianocore UEFI SHELLUEFISHELLDRV
.
Enable Toro-C-Library–DXE
function set atCRT0()
and full Toro-C-Library–SHELL
function set with availability of theEfiShellProtocol
/EFI_SHELL_PROTOCOL_GUID
:
https://github.com/KilianKegel/Visual-TORO-C-LIBRARY-for-UEFI/tree/main/toroCLibrary/OSInterface/UEFISHELLDRVThis is the foundation of an ANSI-C-API-extended "CDE UEFI SHELL"
-
prepare
system()
ANSI-C-API call for MSDOS drive name support (A:, B:, C: ...) coming soon for Visual-UEFI-SHELL -
update
MdePkg
to version edk2-stable202308 -
improve
CDEABI
(C Development Environment Application Binary Interface)- force all
Core
and operating system interfaceosif
modules to uses exclusively ANSI-C-API onCDEABI
to avoid collision with EDK2StdLibC
and relatives
primarily remainingerrno()
,setjmp()
,longjmp()
,strlen()
,strcpy()
,strcmp()
,wcslen()
,wcscpy()
,wcscmp()
- force all
-
improve
freopen()
to set redirection flagO_CDEREDIR
to speed up character transission to file -
fix
fscanf()
: assignment suppression indicated by a "*": https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf#page=295 -
fix
raise()
-
INTERN:
- add:
size_t _cdeInt2EfiStatus(int intstatus)
- add:
int _cdeEfiStatus2Int(size_t Status)
- move selected file functions to
CdeAppIf
driver side.
This allows future/upcoming code size reduced shell application type. - preliminary: LINUX-OSIF buildable, ALPHA
- preliminary:
osifCdeUefiShellAppEntryPoint()
,osifCdeUefiShellAppCRT0Service()
for future/upcoming shell application type that doesn't include entireCdeAppIf
machine code to each .EFI application, but shareCdeAppIf
provided by a CDE UEFI SHELL. This allows code size reduced applications.
- add:
- add Standard C95 Library functions:
- add Microsoft C Library functions from
mbctype.h
: - fixed:
printf()
/wprintf()
-family handling of wide characters > value 255 - adjust internal
invalid_parameter_handler()
to suppress additional debug/file information - fixed:
wcsxfrm()
/strxfrm()
addinvalid_parameter_handler()
support as original Microsoft C Library
- fixed: in the pre-Memory-Discovered PEI (Pre Efi Initialization) POST x86-32
Standard C function
localeconv()
crashed the platform.
NOTE: All x86-64 operation modes (UEFI Shell, UEFI SMM, UEFI DXE, Windows NT) and post-Memory-Discovered PEI (Pre Efi Initialization) x86-32 was not affected by that bug.
-
add Memory Discovered (https://uefi.org/sites/default/files/resources/PI_Spec_1_6.pdf#page=111) handling for PEIM (Pre-EFI Initialization Module)
- restart memory management when switching from CAR (Cash As RAM) to permanent memory
- reassign
CDE_SERVICES
pointer when switching from CAR (Cash As RAM) to permanent memory
-
support multi-invocation of
CdePkg
-based PEIM-
NOTE: Each
CdePkg
-based PEIM needs a small, read-/writeable, dedicated static duration to provide Standard C Library compliance (e.g. to holdatexit()
-registered function pointers, the internalstrtok()
pointer, therand()
next, the jump buffer, the I/O buffer forstdin
,stdout
andstderr
...).Internally this is provided in the HOB storage area and holds a
CDE_APP_IF
protocol registered with the driver specificgEfiCallerIdGuid
. HOB storage is available early in POST in PEI (Pre-EFI Initialization).Once a PEIM is started multiple times, only the first instance static duration will be reinitialized with current
EFI_PEI_FILE_HANDLE
,EFI_PEI_SERVICES
and the currentCDE_SERVICES
pointer.This proceeding prevents
LocatePpi()
to return an invalid pointer to the first instance, while a second instance is currently active.
-
-
improve
CDEABI
(C Development Environment Application Binary Interface), used as collision avoidance with EDK2StdLibC
and relatives
NOTE: In real-world UEFI implementations various components provide reduced Standard C Interface just fitting the requirements of that particular package (CryptoPkg
,RedfishPkg
).
To avoid symbol double definitions at link time or link order failures ,CDEABI
:- provides Standard C Functions in their
__declspec(dllimport)
incarnation only - except for Microsoft compiler intrinsics
__cdecl memset()
and__cdecl memcmp()
that are paired with the its__declsspec(dllimport)
counterpart in the same COMDAT (same .OBJ module)
- provides Standard C Functions in their
- fixed
strtok()
,wcstok()
-
introduce
CDEABI
(C Development Environment Application Binary Interface), an additional application binary interface ABI to ease coexistance ofCdePkg
based BIOS drivers with incomplete tianocore EDK2C Library
fragmentsNOTE:
CDEABI
uses the Microsoft DLL interface__declspec(dllimport)
for EDK2-built drivers . Technically this uses indirect function calls on machine code level. -
promote
CDETRACE()
, remove former, alternate trace method (CDEMOFINE()
) completely -
internally remove unused diagnostic interface
- fixed
strftime()
parameter:%I
,%m
,%x
- add Microsoft/POSIX C Library functions:
_isatty()
- imitate funny/buggy Microsoft behaviour for
fopen()
withfmode
parameterw+
ora
:
function terminates successfully witherrno
set to 22,Invalid argument
- imitate funny/buggy Microsoft behaviour for
_fileno()
with invalid filepointer:
MSFT:_fileno(-1)
just crashes by an invalid memory access
This behaviour is imitated by anexit(3)
invocation - fixed application crash at termination when a redirected I/O stream
STDERR
is reopened withreopen()
- improve existing invalidate parameter handling; enable file name string, function name string, line number string and expression string
at RELEASE runtime
NOTE: Microsoft enables this feature only when using DEBUG version of LIBCMT.LIB. - internal: add toro C Library specific library extentions
wchar_t* _wcsefierror(EFI_STATUS Status)
, according to Standard Cchar* strerror(int errnum)
char* _strefierror(EFI_STATUS Status)
, according to Standard Cchar* strerror(int errnum)
- add O_TEMPORARY support to Microsoft/POSIX _open()
- fixed "fall time bug" (autumn). Broken time calculation on two digit month number (Oct, Nov, Dec).
- simplify interaction of various VISUAL-xyz components, unitize directory structure
and import/export interface for those solutions
- output folder for Configuration Type: static Library is commonly $(SolutionPath)\lib to share one single library folder for all imported subprojects
- adjust include path to be $(ProjectDir) relative
- add Standard C90 Library functions:
wcstoul()
wcstol()
- add Standard C99 Library functions:
strtoull()
strtoll()
strtoimax()
strtoumax()
wcstoull()
wcstoll()
wcstoimax()
wcstoumax()
- add Microsoft/POSIX C Library functions:
_ultow()
_ultoa()
_ui64tow()
_ui64toa()
_ltow()
_ltoa()
_itow()
_itoa()
_i64tow()
_i64toa()
- implement full
__chkstk()
for Windows 32Bit: https://docs.microsoft.com/en-us/windows/win32/devnotes/-win32-chkstk - fixed stdout/stderr redirection
>
and>>
didn't work anymore (since20220501
) - fixed
"a"
/O_APPEND
append file open attribute didn't work anymore (since20220501
) - fixed
ftell()
/fgetpos()
reports wrong offset after writing to"a"
/O_APPEND
opened files
- fixed:
free()
and C++ operatordelete()
crash to freeNULL
pointer
- add C++ minimum support
void* operator new(size_t size)
void* operator new[](size_t size)
void operator delete[](void* ptr)
void operator delete(void* ptr, unsigned __int64 size)
- add Microsoft/POSIX C Library functions:
_open()
_close()
_read()
_write()
_fdopen()
_fileno()
_wfopen()
_fseeki64()
_ftelli64()
- fixed
errno
values for file position functions with negative offsets (fsetpos()
,fseek()
) - fixed UEFI BUG: gap of non-initialized disk space
File positioning bug, if data written behind EOF, data range between old EOF and new data contains medium data / garbage, instead of 0 - simplify
CDETRACE()
implemantation, improve portability of thatCdePkg
specific debug macro - add
_strefierror()
: rename Toro-C-Library UEFI-specific functionstrefierror()
to ANSI C naming convention compatible_strefierror()
- implement full
__chkstk()
for Windows 64Bit: https://docs.microsoft.com/en-us/windows/win32/devnotes/-win32-chkstk - partially implementation of the %G
fprintf()
-- format specifier - fixed
fread()
end-of-file indicator not set correctly when EOF is reached within a buffer instead of reading of 0 bytes from the mass storage device - changed exit code of the
abort()
function from 3 to 0xC0000409 - fixed reassigned filepointer to
stdout
/stderr
(by runningfreopen()
) are not flushed at exit CdePkg
--SMM Driver: Erroneous message shown at startup:FATAL ERROR : CdeServices SMM not available
- update header files with recently added functions
- change from solution relative to project relative build, adjust pathes
- update copyright
- add Standard C Library functions:
strcoll()
strxfrm()
fgetwc()
fputwc()
fputws()
fwide()
fwprintf()
fwscanf()
getwc()
getwchar()
putwc()
putwchar()
swscanf()
ungetwc()
vfwscanf()
vswscanf()
wcscoll()
wcsxfrm()
btowc()
- fix "BINARY MODE" for wide printf()/scanf() family functions
- imitate funny Microsoft behaviour when replacing and pushing back -
ungetc()
- a character by CTRL-Z to a stream (in that case the stream is not terminated) - fix fscanf() family return value for "event of an early matching failure" http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf#page=299
- introduce
CDETRACE()
debug/trace macro that is parameter checked at build time - improve
wmain()
support; now selected at build time by choosing the CRT0 entry point name_cdeCRT0UefiShellW()
_cdeCRT0WinNTW()
NOTE: The*env
pointer is not passed towmain()
- fixed: UEFI Shell overwrites the last line of text of a previously terminated application with its prompt
- add: fgetws()
- add
wmain()
support ATTENTION: The presence ofmain()
is not detected at build time anymore, but at runtime.
- initial release of the toro C Library source code
- this is 4 years after providing Torito C Library in binary format:
https://github.com/KilianKegel/toro-C-Library#20171105r78
- this is 4 years after providing Torito C Library in binary format: