]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - arch/tile/include/arch/abi.h
arch/tile: Fix a couple of issues with the COMPAT code for TILE-Gx.
[mirror_ubuntu-focal-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 */
32020eff 62#define C_ABI_SAVE_AREA_SIZE (2 * (CHIP_WORD_SIZE() / 8))
867e359b 63
0707ad30
CM
64/**
65 * The operand to an 'info' opcode directing the backtracer to not
66 * try to find the calling frame.
67 */
867e359b
CM
68#define INFO_OP_CANNOT_BACKTRACE 2
69
70#ifndef __ASSEMBLER__
71#if CHIP_WORD_SIZE() > 32
72
0707ad30 73/** Unsigned type that can hold a register. */
867e359b
CM
74typedef unsigned long long uint_reg_t;
75
0707ad30 76/** Signed type that can hold a register. */
867e359b
CM
77typedef long long int_reg_t;
78
0707ad30 79/** String prefix to use for printf(). */
867e359b
CM
80#define INT_REG_FMT "ll"
81
82#elif !defined(__LP64__) /* avoid confusion with LP64 cross-build tools */
83
0707ad30 84/** Unsigned type that can hold a register. */
867e359b
CM
85typedef unsigned long uint_reg_t;
86
0707ad30 87/** Signed type that can hold a register. */
867e359b
CM
88typedef long int_reg_t;
89
0707ad30 90/** String prefix to use for printf(). */
867e359b
CM
91#define INT_REG_FMT "l"
92
93#endif
94#endif /* __ASSEMBLER__ */
95
0707ad30 96#endif /* !__ARCH_ABI_H__ */