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