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