summaryrefslogtreecommitdiffstats
path: root/StdLib/LibC/CRT
diff options
context:
space:
mode:
authordarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-28 02:34:10 +0000
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-28 02:34:10 +0000
commit53e1e5c647b73e45569ed6e8b8a0a5b276aa685e (patch)
treeffb715b3aa7f6299b7e370e2b8a3f50b3df903c5 /StdLib/LibC/CRT
parentb00771f50a1f9d72852de544cff5cbfd951e71ac (diff)
downloadedk2-53e1e5c647b73e45569ed6e8b8a0a5b276aa685e.tar.gz
edk2-53e1e5c647b73e45569ed6e8b8a0a5b276aa685e.tar.bz2
edk2-53e1e5c647b73e45569ed6e8b8a0a5b276aa685e.zip
Add device abstraction code for the UEFI Console and UEFI Shell-based file systems.
Make argv use narrow characters instead of wide characters. Add setenv functionality. Add poll() system call. Change signal names into macros – required for standards compliance. The enums were renamed and moved to sys/signal.h and the new macros reference the enums. Added SIGBREAK, which is required for Python. Modify stdio functions to fail cleanly when called with a NULL File Pointer argument. Added <sys/cdefs.h> that just includes <sys/EfiCdefs.h>. By adding this wrapper, we improve compatibility with *nix files which assume <sys/cdefs> exists. Add <netdb.h> Added macros for bcopy(), bcmp() and strsep(). Modify the clock() function so that it does not hang when running under an emulation environment such as NT32. Move TM structure specific macros from the private tzfile.h into <time.h> Add strncasecmp function. Add strptime function. Add gettimeofday function. Add getcwd function. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11908 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'StdLib/LibC/CRT')
-rw-r--r--StdLib/LibC/CRT/Gcc.c201
1 files changed, 100 insertions, 101 deletions
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 <Uefi.h>
-#include <Library/UefiLib.h>
#include <Library/DebugLib.h>
#include <sys/EfiCdefs.h>
@@ -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;
+}