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