Subversion Repositories HelenOS

Rev

Rev 2726 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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