aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/include/arch/abi.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/tile/include/arch/abi.h')
-rw-r--r--arch/tile/include/arch/abi.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/arch/tile/include/arch/abi.h b/arch/tile/include/arch/abi.h
new file mode 100644
index 00000000000..7cdc47b3e02
--- /dev/null
+++ b/arch/tile/include/arch/abi.h
@@ -0,0 +1,93 @@
1// Copyright 2010 Tilera Corporation. All Rights Reserved.
2//
3// This program is free software; you can redistribute it and/or
4// modify it under the terms of the GNU General Public License
5// as published by the Free Software Foundation, version 2.
6//
7// This program is distributed in the hope that it will be useful, but
8// WITHOUT ANY WARRANTY; without even the implied warranty of
9// MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
10// NON INFRINGEMENT. See the GNU General Public License for
11// more details.
12
13//! @file
14//!
15//! ABI-related register definitions helpful when writing assembly code.
16//!
17
18#ifndef __ARCH_ABI_H__
19#define __ARCH_ABI_H__
20
21#include <arch/chip.h>
22
23// Registers 0 - 55 are "normal", but some perform special roles.
24
25#define TREG_FP 52 /**< Frame pointer. */
26#define TREG_TP 53 /**< Thread pointer. */
27#define TREG_SP 54 /**< Stack pointer. */
28#define TREG_LR 55 /**< Link to calling function PC. */
29
30/** Index of last normal general-purpose register. */
31#define TREG_LAST_GPR 55
32
33// Registers 56 - 62 are "special" network registers.
34
35#define TREG_SN 56 /**< Static network access. */
36#define TREG_IDN0 57 /**< IDN demux 0 access. */
37#define TREG_IDN1 58 /**< IDN demux 1 access. */
38#define TREG_UDN0 59 /**< UDN demux 0 access. */
39#define TREG_UDN1 60 /**< UDN demux 1 access. */
40#define TREG_UDN2 61 /**< UDN demux 2 access. */
41#define TREG_UDN3 62 /**< UDN demux 3 access. */
42
43// Register 63 is the "special" zero register.
44
45#define TREG_ZERO 63 /**< "Zero" register; always reads as "0". */
46
47
48/** By convention, this register is used to hold the syscall number. */
49#define TREG_SYSCALL_NR 10
50
51/** Name of register that holds the syscall number, for use in assembly. */
52#define TREG_SYSCALL_NR_NAME r10
53
54
55//! The ABI requires callers to allocate a caller state save area of
56//! this many bytes at the bottom of each stack frame.
57//!
58#ifdef __tile__
59#define C_ABI_SAVE_AREA_SIZE (2 * __SIZEOF_POINTER__)
60#endif
61
62//! The operand to an 'info' opcode directing the backtracer to not
63//! try to find the calling frame.
64//!
65#define INFO_OP_CANNOT_BACKTRACE 2
66
67#ifndef __ASSEMBLER__
68#if CHIP_WORD_SIZE() > 32
69
70//! Unsigned type that can hold a register.
71typedef unsigned long long uint_reg_t;
72
73//! Signed type that can hold a register.
74typedef long long int_reg_t;
75
76//! String prefix to use for printf().
77#define INT_REG_FMT "ll"
78
79#elif !defined(__LP64__) /* avoid confusion with LP64 cross-build tools */
80
81//! Unsigned type that can hold a register.
82typedef unsigned long uint_reg_t;
83
84//! Signed type that can hold a register.
85typedef long int_reg_t;
86
87//! String prefix to use for printf().
88#define INT_REG_FMT "l"
89
90#endif
91#endif /* __ASSEMBLER__ */
92
93#endif // !__ARCH_ABI_H__