xref: /linux/tools/include/nolibc/arch.h (revision 06d07429858317ded2db7986113a9e0129cd599b)
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
10659ee30fSThomas Weißschuh  * is not a function but an entry point). 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"
26*aa68a5a8SThomas Weißschuh #elif defined(__mips__)
27271661c1SWilly Tarreau #include "arch-mips.h"
280cb0675eSZhangjin Wu #elif defined(__powerpc__)
290cb0675eSZhangjin Wu #include "arch-powerpc.h"
30271661c1SWilly Tarreau #elif defined(__riscv)
31271661c1SWilly Tarreau #include "arch-riscv.h"
3218a5a09dSSven Schnelle #elif defined(__s390x__)
3318a5a09dSSven Schnelle #include "arch-s390.h"
3473f12c6dSFeiyang Chen #elif defined(__loongarch__)
3573f12c6dSFeiyang Chen #include "arch-loongarch.h"
3648946c5aSThomas Weißschuh #else
3748946c5aSThomas Weißschuh #error Unsupported Architecture
38271661c1SWilly Tarreau #endif
39271661c1SWilly Tarreau 
40271661c1SWilly Tarreau #endif /* _NOLIBC_ARCH_H */
41