GNU Linux-libre 4.14.266-gnu1
[releases.git] / arch / tile / include / uapi / arch / abi.h
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * Copyright 2010 Tilera Corporation. All Rights Reserved.
4  *
5  *   This program is free software; you can redistribute it and/or
6  *   modify it under the terms of the GNU General Public License
7  *   as published by the Free Software Foundation, version 2.
8  *
9  *   This program is distributed in the hope that it will be useful, but
10  *   WITHOUT ANY WARRANTY; without even the implied warranty of
11  *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12  *   NON INFRINGEMENT.  See the GNU General Public License for
13  *   more details.
14  */
15
16 /**
17  * @file
18  *
19  * ABI-related register definitions.
20  */
21
22 #ifndef __ARCH_ABI_H__
23
24 #ifndef __tile__   /* support uncommon use of arch headers in non-tile builds */
25 # include <arch/chip.h>
26 # define __INT_REG_BITS CHIP_WORD_SIZE()
27 #endif
28
29 #include <arch/intreg.h>
30
31 /* __need_int_reg_t is deprecated: just include <arch/intreg.h> */
32 #ifndef __need_int_reg_t
33
34 #define __ARCH_ABI_H__
35
36 #ifndef __ASSEMBLER__
37 /** Unsigned type that can hold a register. */
38 typedef __uint_reg_t uint_reg_t;
39
40 /** Signed type that can hold a register. */
41 typedef __int_reg_t int_reg_t;
42 #endif
43
44 /** String prefix to use for printf(). */
45 #define INT_REG_FMT __INT_REG_FMT
46
47 /** Number of bits in a register. */
48 #define INT_REG_BITS __INT_REG_BITS
49
50
51 /* Registers 0 - 55 are "normal", but some perform special roles. */
52
53 #define TREG_FP       52   /**< Frame pointer. */
54 #define TREG_TP       53   /**< Thread pointer. */
55 #define TREG_SP       54   /**< Stack pointer. */
56 #define TREG_LR       55   /**< Link to calling function PC. */
57
58 /** Index of last normal general-purpose register. */
59 #define TREG_LAST_GPR 55
60
61 /* Registers 56 - 62 are "special" network registers. */
62
63 #define TREG_SN       56   /**< Static network access. */
64 #define TREG_IDN0     57   /**< IDN demux 0 access. */
65 #define TREG_IDN1     58   /**< IDN demux 1 access. */
66 #define TREG_UDN0     59   /**< UDN demux 0 access. */
67 #define TREG_UDN1     60   /**< UDN demux 1 access. */
68 #define TREG_UDN2     61   /**< UDN demux 2 access. */
69 #define TREG_UDN3     62   /**< UDN demux 3 access. */
70
71 /* Register 63 is the "special" zero register. */
72
73 #define TREG_ZERO     63   /**< "Zero" register; always reads as "0". */
74
75
76 /** By convention, this register is used to hold the syscall number. */
77 #define TREG_SYSCALL_NR      10
78
79 /** Name of register that holds the syscall number, for use in assembly. */
80 #define TREG_SYSCALL_NR_NAME r10
81
82
83 /**
84  * The ABI requires callers to allocate a caller state save area of
85  * this many bytes at the bottom of each stack frame.
86  */
87 #define C_ABI_SAVE_AREA_SIZE (2 * (INT_REG_BITS / 8))
88
89 /**
90  * The operand to an 'info' opcode directing the backtracer to not
91  * try to find the calling frame.
92  */
93 #define INFO_OP_CANNOT_BACKTRACE 2
94
95
96 #endif /* !__need_int_reg_t */
97
98 /* Make sure we later can get all the definitions and declarations.  */
99 #undef __need_int_reg_t
100
101 #endif /* !__ARCH_ABI_H__ */