xref: /linux/tools/include/nolibc/arch.h (revision 73f12c6da77a7c25cf0a8f1a3c282db2a1e2bd93)
1271661c1SWilly Tarreau /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
2271661c1SWilly Tarreau /*
3271661c1SWilly Tarreau  * Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
4271661c1SWilly Tarreau  */
5271661c1SWilly Tarreau 
6271661c1SWilly Tarreau /* Below comes the architecture-specific code. For each architecture, we have
7271661c1SWilly Tarreau  * the syscall declarations and the _start code definition. This is the only
8271661c1SWilly Tarreau  * global part. On all architectures the kernel puts everything in the stack
9271661c1SWilly Tarreau  * before jumping to _start just above us, without any return address (_start
10271661c1SWilly Tarreau  * is not a function but an entry pint). So at the stack pointer we find argc.
11271661c1SWilly Tarreau  * Then argv[] begins, and ends at the first NULL. Then we have envp which
12271661c1SWilly Tarreau  * starts and ends with a NULL as well. So envp=argv+argc+1.
13271661c1SWilly Tarreau  */
14271661c1SWilly Tarreau 
15271661c1SWilly Tarreau #ifndef _NOLIBC_ARCH_H
16271661c1SWilly Tarreau #define _NOLIBC_ARCH_H
17271661c1SWilly Tarreau 
18271661c1SWilly Tarreau #if defined(__x86_64__)
19271661c1SWilly Tarreau #include "arch-x86_64.h"
20271661c1SWilly Tarreau #elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)
21271661c1SWilly Tarreau #include "arch-i386.h"
22271661c1SWilly Tarreau #elif defined(__ARM_EABI__)
23271661c1SWilly Tarreau #include "arch-arm.h"
24271661c1SWilly Tarreau #elif defined(__aarch64__)
25271661c1SWilly Tarreau #include "arch-aarch64.h"
26271661c1SWilly Tarreau #elif defined(__mips__) && defined(_ABIO32)
27271661c1SWilly Tarreau #include "arch-mips.h"
28271661c1SWilly Tarreau #elif defined(__riscv)
29271661c1SWilly Tarreau #include "arch-riscv.h"
3018a5a09dSSven Schnelle #elif defined(__s390x__)
3118a5a09dSSven Schnelle #include "arch-s390.h"
32*73f12c6dSFeiyang Chen #elif defined(__loongarch__)
33*73f12c6dSFeiyang Chen #include "arch-loongarch.h"
34271661c1SWilly Tarreau #endif
35271661c1SWilly Tarreau 
36271661c1SWilly Tarreau #endif /* _NOLIBC_ARCH_H */
37