aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/tile/include/uapi/arch/abi.h
blob: c55a3d4326444c955756d02366a289b4771e2708 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
 * Copyright 2010 Tilera Corporation. All Rights Reserved.
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License
 *   as published by the Free Software Foundation, version 2.
 *
 *   This program is distributed in the hope that it will be useful, but
 *   WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
 *   NON INFRINGEMENT.  See the GNU General Public License for
 *   more details.
 */

/**
 * @file
 *
 * ABI-related register definitions.
 */

#ifndef __ARCH_ABI_H__

#if !defined __need_int_reg_t && !defined __DOXYGEN__
# define __ARCH_ABI_H__
# include <arch/chip.h>
#endif

/* Provide the basic machine types. */
#ifndef __INT_REG_BITS

/** Number of bits in a register. */
#if defined __tilegx__
# define __INT_REG_BITS 64
#elif defined __tilepro__
# define __INT_REG_BITS 32
#elif !defined __need_int_reg_t
# include <arch/chip.h>
# define __INT_REG_BITS CHIP_WORD_SIZE()
#else
# error Unrecognized architecture with __need_int_reg_t
#endif

#if __INT_REG_BITS == 64

#ifndef __ASSEMBLER__
/** Unsigned type that can hold a register. */
typedef unsigned long long __uint_reg_t;

/** Signed type that can hold a register. */
typedef long long __int_reg_t;
#endif

/** String prefix to use for printf(). */
#define __INT_REG_FMT "ll"

#else

#ifndef __ASSEMBLER__
/** Unsigned type that can hold a register. */
typedef unsigned long __uint_reg_t;

/** Signed type that can hold a register. */
typedef long __int_reg_t;
#endif

/** String prefix to use for printf(). */
#define __INT_REG_FMT "l"

#endif
#endif /* __INT_REG_BITS */


#ifndef __need_int_reg_t


#ifndef __ASSEMBLER__
/** Unsigned type that can hold a register. */
typedef __uint_reg_t uint_reg_t;

/** Signed type that can hold a register. */
typedef __int_reg_t int_reg_t;
#endif

/** String prefix to use for printf(). */
#define INT_REG_FMT __INT_REG_FMT

/** Number of bits in a register. */
#define INT_REG_BITS __INT_REG_BITS


/* Registers 0 - 55 are "normal", but some perform special roles. */

#define TREG_FP       52   /**< Frame pointer. */
#define TREG_TP       53   /**< Thread pointer. */
#define TREG_SP       54   /**< Stack pointer. */
#define TREG_LR       55   /**< Link to calling function PC. */

/** Index of last normal general-purpose register. */
#define TREG_LAST_GPR 55

/* Registers 56 - 62 are "special" network registers. */

#define TREG_SN       56   /**< Static network access. */
#define TREG_IDN0     57   /**< IDN demux 0 access. */
#define TREG_IDN1     58   /**< IDN demux 1 access. */
#define TREG_UDN0     59   /**< UDN demux 0 access. */
#define TREG_UDN1     60   /**< UDN demux 1 access. */
#define TREG_UDN2     61   /**< UDN demux 2 access. */
#define TREG_UDN3     62   /**< UDN demux 3 access. */

/* Register 63 is the "special" zero register. */

#define TREG_ZERO     63   /**< "Zero" register; always reads as "0". */


/** By convention, this register is used to hold the syscall number. */
#define TREG_SYSCALL_NR      10

/** Name of register that holds the syscall number, for use in assembly. */
#define TREG_SYSCALL_NR_NAME r10


/**
 * The ABI requires callers to allocate a caller state save area of
 * this many bytes at the bottom of each stack frame.
 */
#define C_ABI_SAVE_AREA_SIZE (2 * (INT_REG_BITS / 8))

/**
 * The operand to an 'info' opcode directing the backtracer to not
 * try to find the calling frame.
 */
#define INFO_OP_CANNOT_BACKTRACE 2


#endif /* !__need_int_reg_t */

/* Make sure we later can get all the definitions and declarations.  */
#undef __need_int_reg_t

#endif /* !__ARCH_ABI_H__ */