arch.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
  2. /*
  3. * Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
  4. */
  5. /* Below comes the architecture-specific code. For each architecture, we have
  6. * the syscall declarations and the _start code definition. This is the only
  7. * global part. On all architectures the kernel puts everything in the stack
  8. * before jumping to _start just above us, without any return address (_start
  9. * is not a function but an entry point). So at the stack pointer we find argc.
  10. * Then argv[] begins, and ends at the first NULL. Then we have envp which
  11. * starts and ends with a NULL as well. So envp=argv+argc+1.
  12. */
  13. #ifndef _NOLIBC_ARCH_H
  14. #define _NOLIBC_ARCH_H
  15. #if defined(__x86_64__)
  16. #include "arch-x86_64.h"
  17. #elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)
  18. #include "arch-i386.h"
  19. #elif defined(__ARM_EABI__)
  20. #include "arch-arm.h"
  21. #elif defined(__aarch64__)
  22. #include "arch-aarch64.h"
  23. #elif defined(__mips__)
  24. #include "arch-mips.h"
  25. #elif defined(__powerpc__)
  26. #include "arch-powerpc.h"
  27. #elif defined(__riscv)
  28. #include "arch-riscv.h"
  29. #elif defined(__s390x__)
  30. #include "arch-s390.h"
  31. #elif defined(__loongarch__)
  32. #include "arch-loongarch.h"
  33. #else
  34. #error Unsupported Architecture
  35. #endif
  36. #endif /* _NOLIBC_ARCH_H */