initplat.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copright (C) 2014 Linaro Ltd.
  3. * Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice and this list of conditions, without modification.
  10. * 2. The name of the author may not be used to endorse or promote products
  11. * derived from this software without specific prior written permission.
  12. *
  13. * Alternatively, this software may be distributed under the terms of the
  14. * GNU General Public License as published by the Free Software Foundation;
  15. * either version 2 of the License, or (at your option) any later version.
  16. */
  17. #include "lib.h"
  18. VOID
  19. InitializeLibPlatform (
  20. IN EFI_HANDLE ImageHandle EFI_UNUSED,
  21. IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED
  22. )
  23. {
  24. }
  25. #ifndef __SIZE_TYPE__
  26. #define __SIZE_TYPE__ UINTN
  27. #endif
  28. /*
  29. * Calls to these functions may be emitted implicitly by GCC even when
  30. * -ffreestanding is in effect.
  31. */
  32. void *memset(void *s, int c, __SIZE_TYPE__ n)
  33. {
  34. unsigned char *p = s;
  35. while (n--)
  36. *p++ = c;
  37. return s;
  38. }
  39. void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n)
  40. {
  41. unsigned char *p = dest;
  42. unsigned char const *q = src;
  43. while (n--)
  44. *p++ = *q++;
  45. return dest;
  46. }
  47. #ifdef __GNUC__
  48. void __div0(void)
  49. {
  50. // TODO handle divide by zero fault
  51. while (1);
  52. }
  53. #endif