Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 1999 Intel Corporation
  3. Module Name:
  4. EfiRtLib.h
  5. Abstract:
  6. EFI Runtime library functions
  7. Revision History
  8. --*/
  9. #include "efi.h"
  10. #include "efilib.h"
  11. #include "EfiRtLib.h"
  12. #pragma RUNTIME_CODE(RtZeroMem)
  13. VOID
  14. RUNTIMEFUNCTION
  15. RtZeroMem (
  16. IN VOID *Buffer,
  17. IN UINTN Size
  18. )
  19. {
  20. INT8 *pt;
  21. pt = Buffer;
  22. while (Size--) {
  23. *(pt++) = 0;
  24. }
  25. }
  26. #pragma RUNTIME_CODE(RtSetMem)
  27. VOID
  28. RUNTIMEFUNCTION
  29. RtSetMem (
  30. IN VOID *Buffer,
  31. IN UINTN Size,
  32. IN UINT8 Value
  33. )
  34. {
  35. INT8 *pt;
  36. pt = Buffer;
  37. while (Size--) {
  38. *(pt++) = Value;
  39. }
  40. }
  41. #pragma RUNTIME_CODE(RtCopyMem)
  42. VOID
  43. RUNTIMEFUNCTION
  44. RtCopyMem (
  45. IN VOID *Dest,
  46. IN VOID *Src,
  47. IN UINTN len
  48. )
  49. {
  50. CHAR8 *d, *s;
  51. d = Dest;
  52. s = Src;
  53. while (len--) {
  54. *(d++) = *(s++);
  55. }
  56. }
  57. #pragma RUNTIME_CODE(RtCompareMem)
  58. INTN
  59. RUNTIMEFUNCTION
  60. RtCompareMem (
  61. IN VOID *Dest,
  62. IN VOID *Src,
  63. IN UINTN len
  64. )
  65. {
  66. CHAR8 *d, *s;
  67. d = Dest;
  68. s = Src;
  69. while (len--) {
  70. if (*d != *s) {
  71. return *d - *s;
  72. }
  73. d += 1;
  74. s += 1;
  75. }
  76. return 0;
  77. }
  78. #pragma RUNTIME_CODE(RtCompareGuid)
  79. INTN
  80. RUNTIMEFUNCTION
  81. RtCompareGuid (
  82. IN EFI_GUID *Guid1,
  83. IN EFI_GUID *Guid2
  84. )
  85. /*++
  86. Routine Description:
  87. Compares to GUIDs
  88. Arguments:
  89. Guid1 - guid to compare
  90. Guid2 - guid to compare
  91. Returns:
  92. = 0 if Guid1 == Guid2
  93. --*/
  94. {
  95. INT32 *g1, *g2, r;
  96. /*
  97. * Compare 32 bits at a time
  98. */
  99. g1 = (INT32 *) Guid1;
  100. g2 = (INT32 *) Guid2;
  101. r = g1[0] - g2[0];
  102. r |= g1[1] - g2[1];
  103. r |= g1[2] - g2[2];
  104. r |= g1[3] - g2[3];
  105. return r;
  106. }