From 53e1e5c647b73e45569ed6e8b8a0a5b276aa685e Mon Sep 17 00:00:00 2001 From: darylm503 Date: Tue, 28 Jun 2011 02:34:10 +0000 Subject: =?UTF-8?q?Add=20device=20abstraction=20code=20for=20the=20UEFI=20?= =?UTF-8?q?Console=20and=20UEFI=20Shell-based=20file=20systems.=20Make=20a?= =?UTF-8?q?rgv=20use=20narrow=20characters=20instead=20of=20wide=20charact?= =?UTF-8?q?ers.=20Add=20setenv=20functionality.=20Add=20poll()=20system=20?= =?UTF-8?q?call.=20Change=20signal=20names=20into=20macros=20=E2=80=93=20r?= =?UTF-8?q?equired=20for=20standards=20compliance.=20=20The=20enums=20were?= =?UTF-8?q?=20renamed=20and=20moved=20to=20sys/signal.h=20and=20the=20new?= =?UTF-8?q?=20macros=20reference=20the=20enums.=20Added=20SIGBREAK,=20whic?= =?UTF-8?q?h=20is=20required=20for=20Python.=20Modify=20stdio=20functions?= =?UTF-8?q?=20to=20fail=20cleanly=20when=20called=20with=20a=20NULL=20File?= =?UTF-8?q?=20Pointer=20argument.=20Added=20=20that=20just=20?= =?UTF-8?q?includes=20.=20=20By=20adding=20this=20wrapper,?= =?UTF-8?q?=20we=20improve=20compatibility=20with=20*nix=20files=20which?= =?UTF-8?q?=20assume=20=20exists.=20Add=20=20Added=20m?= =?UTF-8?q?acros=20for=20bcopy(),=20bcmp()=20and=20strsep().=20Modify=20th?= =?UTF-8?q?e=20clock()=20function=20so=20that=20it=20does=20not=20hang=20w?= =?UTF-8?q?hen=20running=20under=20an=20emulation=20environment=20such=20a?= =?UTF-8?q?s=20NT32.=20Move=20TM=20structure=20specific=20macros=20from=20?= =?UTF-8?q?the=20private=20tzfile.h=20into=20=20Add=20strncasecmp?= =?UTF-8?q?=20function.=20Add=20strptime=20function.=20Add=20gettimeofday?= =?UTF-8?q?=20function.=20Add=20getcwd=20function.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11908 6f19259b-4bc3-4df7-8a09-765794883524 --- StdLib/LibC/CRT/Gcc.c | 201 +++++++++++++++++++++++++------------------------- 1 file changed, 100 insertions(+), 101 deletions(-) (limited to 'StdLib/LibC/CRT') diff --git a/StdLib/LibC/CRT/Gcc.c b/StdLib/LibC/CRT/Gcc.c index 01fbe79dc9..cbf4ec273f 100644 --- a/StdLib/LibC/CRT/Gcc.c +++ b/StdLib/LibC/CRT/Gcc.c @@ -14,7 +14,6 @@ **/ #include -#include #include #include @@ -22,175 +21,175 @@ // Shift Datum left by Count bits. // =========================================================================== -//int __ashlsi3(int Datum, int Count) -//{ -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// return (int) LShiftU64 ((UINT64)Datum, (UINTN)Count); -//} +int __ashlsi3(int Datum, int Count) +{ + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (int) LShiftU64 ((UINT64)Datum, (UINTN)Count); +} -INT64 __ashldi3(INT64 Datum, int Count) +long __ashldi3(long Datum, int Count) { - DebugPrint(DEBUG_INFO, "%a:\n", __func__); - return LShiftU64 (Datum, (UINTN)Count); + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (long) LShiftU64 ((UINT64)Datum, (UINTN)Count); } -//long long __ashlti3(long long Datum, int Count) -//{ -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// return (long long) LShiftU64 ((UINT64)Datum, (UINTN)Count); -//} +long long __ashlti3(long long Datum, int Count) +{ + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (long long) LShiftU64 ((UINT64)Datum, (UINTN)Count); +} // Arithmetically shift Datum right by Count bits. // =========================================================================== -//int __ashrsi3(int Datum, int Count) -//{ -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// return (int) ARShiftU64 ((UINT64) Datum, (UINTN)Count); -//} +int __ashrsi3(int Datum, int Count) +{ + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (int) ARShiftU64 ((UINT64) Datum, (UINTN)Count); +} -INT64 __ashrdi3(INT64 Datum, int Count) +long __ashrdi3(long Datum, int Count) { - DebugPrint(DEBUG_INFO, "%a:\n", __func__); - return ARShiftU64 ( Datum, (UINTN)Count); + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (long) ARShiftU64 ((UINT64) Datum, (UINTN)Count); } -//long long __ashrti3(long long Datum, int Count) -//{ -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// return (long long) ARShiftU64 ((UINT64) Datum, (UINTN)Count); -//} +long long __ashrti3(long long Datum, int Count) +{ + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (long long) ARShiftU64 ((UINT64) Datum, (UINTN)Count); +} // Return the quotient of the signed division of Dividend and Divisor // =========================================================================== -//int __divsi3(int Dividend, int Divisor) -//{ -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// return (int) DivS64x64Remainder ((INT64) Dividend, (INT64) Divisor, NULL); -//} +int __divsi3(int Dividend, int Divisor) +{ + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (int) DivS64x64Remainder ((INT64) Dividend, (INT64) Divisor, NULL); +} INT64 __divdi3(INT64 Dividend, INT64 Divisor) { INT64 Quotient; Quotient = DivS64x64Remainder ((INT64) Dividend, (INT64) Divisor, NULL); - DebugPrint(DEBUG_INFO, "%a: %Ld / %Ld = %Ld\n", __func__, Dividend, Divisor, Quotient); + DEBUG((DEBUG_INFO, "%a: %Ld / %Ld = %Ld\n", __func__, Dividend, Divisor, Quotient)); return Quotient; } -//long long __divti3(long long Dividend, long long Divisor) -//{ -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// return (long long) DivS64x64Remainder ((INT64) Dividend, (INT64) Divisor, NULL); -//} +long long __divti3(long long Dividend, long long Divisor) +{ + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (long long) DivS64x64Remainder ((INT64) Dividend, (INT64) Divisor, NULL); +} // Logically shift Datum right by Count bits // =========================================================================== -//int __lshrsi3(int Datum, int Count) -//{ -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// return (int) RShiftU64 ((UINT64) Datum, (UINTN)Count); -//} +int __lshrsi3(int Datum, int Count) +{ + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (int) RShiftU64 ((UINT64) Datum, (UINTN)Count); +} -INT64 __lshrdi3(INT64 Datum, int Count) +long __lshrdi3(int Datum, int Count) { - DebugPrint(DEBUG_INFO, "%a:\n", __func__); - return RShiftU64 ( Datum, (UINTN)Count); + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (long) RShiftU64 ((UINT64) Datum, (UINTN)Count); } -//long long __lshrti3(int Datum, int Count) -//{ -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// return (long long) RShiftU64 ((UINT64) Datum, (UINTN)Count); -//} +long long __lshrti3(int Datum, int Count) +{ + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (long long) RShiftU64 ((UINT64) Datum, (UINTN)Count); +} // Return the remainder of the signed division of Dividend and Divisor // =========================================================================== -//int __modsi3(int Dividend, int Divisor) -//{ -// INT64 Remainder; +int __modsi3(int Dividend, int Divisor) +{ + INT64 Remainder; -// (void) DivS64x64Remainder ((INT64) Dividend, (INT64) Divisor, &Remainder); -// DebugPrint(DEBUG_INFO, "modsi3: %d %% %d = %d\n", Dividend, Divisor, (int)Remainder); + (void) DivS64x64Remainder ((INT64) Dividend, (INT64) Divisor, &Remainder); + DEBUG((DEBUG_INFO, "modsi3: %d %% %d = %d\n", Dividend, Divisor, (int)Remainder)); -// return (int) Remainder; -//} + return (int) Remainder; +} INT64 __moddi3(INT64 Dividend, INT64 Divisor) { INT64 Remainder; (void) DivS64x64Remainder ((INT64) Dividend, (INT64) Divisor, &Remainder); - DebugPrint(DEBUG_INFO, "moddi3: %Ld %% %Ld = %Ld\n", (INT64)Dividend, (INT64)Divisor, Remainder); + DEBUG((DEBUG_INFO, "moddi3: %Ld %% %Ld = %Ld\n", (INT64)Dividend, (INT64)Divisor, Remainder)); return Remainder; } -//long long __modti3(long long Dividend, long long Divisor) -//{ -// INT64 Remainder; +long long __modti3(long long Dividend, long long Divisor) +{ + INT64 Remainder; -// (void) DivS64x64Remainder ((INT64) Dividend, (INT64) Divisor, &Remainder); -// DebugPrint(DEBUG_INFO, "modti3: %Ld %% %Ld = %Ld\n", (INT64)Dividend, (INT64)Divisor, Remainder); + (void) DivS64x64Remainder ((INT64) Dividend, (INT64) Divisor, &Remainder); + DEBUG((DEBUG_INFO, "modti3: %Ld %% %Ld = %Ld\n", (INT64)Dividend, (INT64)Divisor, Remainder)); -// return (long long) Remainder; -//} + return (long long) Remainder; +} // These functions return the product of the Multiplicand and Multiplier. // =========================================================================== -//long long __multi3(long long Multiplicand, long long Multiplier) -//{ -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// return (long long) MultS64x64 ((INT64)Multiplicand, (INT64)Multiplier); -//} +long long __multi3(long long Multiplicand, long long Multiplier) +{ + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (long long) MultS64x64 ((INT64)Multiplicand, (INT64)Multiplier); +} // Return the quotient of the unsigned division of a and b. // =========================================================================== -//unsigned int __udivsi3(unsigned int Dividend, unsigned int Divisor) -//{ -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// return (int) DivU64x64Remainder ((UINT64) Dividend, (UINT64) Divisor, NULL); -//} +unsigned int __udivsi3(unsigned int Dividend, unsigned int Divisor) +{ + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (int) DivU64x64Remainder ((UINT64) Dividend, (UINT64) Divisor, NULL); +} -UINT64 __udivdi3(UINT64 Dividend, UINT64 Divisor) +unsigned long __udivdi3(unsigned long Dividend, unsigned long Divisor) { - DebugPrint(DEBUG_INFO, "%a:\n", __func__); - return DivU64x64Remainder ((UINT64) Dividend, (UINT64) Divisor, NULL); + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (long) DivU64x64Remainder ((UINT64) Dividend, (UINT64) Divisor, NULL); } -//unsigned long long __udivti3(unsigned long long Dividend, unsigned long long Divisor) -//{ -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// return (long long) DivU64x64Remainder ((UINT64) Dividend, (UINT64) Divisor, NULL); -//} +unsigned long long __udivti3(unsigned long long Dividend, unsigned long long Divisor) +{ + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + return (long long) DivU64x64Remainder ((UINT64) Dividend, (UINT64) Divisor, NULL); +} // =========================================================================== -//unsigned int __umodsi3(unsigned int Dividend, unsigned int Divisor) -//{ -// UINT64 Remainder; +unsigned int __umodsi3(unsigned int Dividend, unsigned int Divisor) +{ + UINT64 Remainder; -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// (void) DivU64x64Remainder ((UINT64) Dividend, (UINT64) Divisor, &Remainder); + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + (void) DivU64x64Remainder ((UINT64) Dividend, (UINT64) Divisor, &Remainder); -// return (unsigned int) Remainder; -//} + return (unsigned int) Remainder; +} -UINT64 __umoddi3(UINT64 Dividend, UINT64 Divisor) +unsigned long __umoddi3(unsigned long Dividend, unsigned long Divisor) { UINT64 Remainder; - DebugPrint(DEBUG_INFO, "%a:\n", __func__); + DEBUG((DEBUG_INFO, "%a:\n", __func__)); (void) DivU64x64Remainder ((UINT64) Dividend, (UINT64) Divisor, &Remainder); - return Remainder; + return (unsigned long) Remainder; } -//unsigned long long __umodti3(unsigned long long Dividend, unsigned long long Divisor) -//{ -// UINT64 Remainder; +unsigned long long __umodti3(unsigned long long Dividend, unsigned long long Divisor) +{ + UINT64 Remainder; -// DebugPrint(DEBUG_INFO, "%a:\n", __func__); -// (void) DivU64x64Remainder ((UINT64) Dividend, (UINT64) Divisor, &Remainder); + DEBUG((DEBUG_INFO, "%a:\n", __func__)); + (void) DivU64x64Remainder ((UINT64) Dividend, (UINT64) Divisor, &Remainder); -// return (unsigned long long) Remainder; -//} + return (unsigned long long) Remainder; +} -- cgit v1.2.3