xref: /netbsd-src/external/gpl3/binutils/dist/include/elf/kvx_elfids.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1 /* DO NOT EDIT!  -*- buffer-read-only: t -*-  vi:set ro: */
2 
3 /* KVX ELF IDs definitions.
4 
5    Copyright (C) 2009-2024 Free Software Foundation, Inc.
6    Contributed by Kalray SA.
7 
8    This file is part of GNU Binutils.
9 
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 3 of the license, or
13    (at your option) any later version.
14 
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19 
20    You should have received a copy of the GNU General Public License
21    along with this program; see the file COPYING3. If not,
22    see <http://www.gnu.org/licenses/>.  */
23 
24 /* This file holds definitions specific to the KV3 ELF IDs. */
25 
26 #ifndef _KVX_ELFIDS_H_
27 #define _KVX_ELFIDS_H_
28 
29 /* 	 16.15 	  8.7  4.3  0 */
30 /* +----------------------------+ */
31 /* |      CUT | CORE  |PIC |ABI | */
32 /* +----------------------------+ */
33 
34 
35 #define KVX_CUT_MASK 0x00ff0000
36 #define KVX_CORE_MASK 0x0000ff00
37 #define KVX_ABI_MASK 0x000000ff
38 #define KVX_MACH_MASK (KVX_CUT_MASK | KVX_CORE_MASK | KVX_ABI_MASK)
39 
40 /*
41  * Machine private data :
42  * - byte 0 = ABI specific (PIC, OS, ...)
43  *   - bit 0..3 = ABI ident
44  *   - bit 4    = 32/64 bits addressing
45  *   - bit 5    = PIC
46  * - byte 1 = Core info :
47  *   - bits 0..3 = Core Major Version
48  *   - bit  4..7 = Core Minor Version
49  */
50 
51 /* Core */
52 #define ELF_KVX_CORE_BIT_SHIFT  (8)
53 #define ELF_KVX_CORE_MASK       (0x7f<<ELF_KVX_CORE_BIT_SHIFT)
54 
55 #define ELF_KVX_CORE_MAJOR_MASK (0x0F << ELF_KVX_CORE_BIT_SHIFT)
56 #define ELF_KVX_CORE_MINOR_MASK (0xF0 << ELF_KVX_CORE_BIT_SHIFT)
57 #define ELF_KVX_CORE_MAJOR_SHIFT (0 + ELF_KVX_CORE_BIT_SHIFT)
58 #define ELF_KVX_CORE_MINOR_SHIFT (4 + ELF_KVX_CORE_BIT_SHIFT)
59 
60 #define ELF_KVX_CORE_KV3         (0x03 << ELF_KVX_CORE_BIT_SHIFT)
61 #define ELF_KVX_CORE_KV4         (0x04 << ELF_KVX_CORE_BIT_SHIFT)
62 
63 #define ELF_KVX_CORE_KV3_1      (ELF_KVX_CORE_KV3 | (1 << (ELF_KVX_CORE_MINOR_SHIFT)))
64 #define ELF_KVX_CORE_KV3_2      (ELF_KVX_CORE_KV3 | (2 << (ELF_KVX_CORE_MINOR_SHIFT)))
65 #define ELF_KVX_CORE_KV4_1      (ELF_KVX_CORE_KV4 | (1 << (ELF_KVX_CORE_MINOR_SHIFT)))
66 
67 #define ELF_KVX_IS_KV3(flags)   (((flags) & ELF_KVX_CORE_MAJOR_MASK) == (ELF_KVX_CORE_KV3))
68 #define ELF_KVX_IS_KV4(flags)   (((flags) & ELF_KVX_CORE_MAJOR_MASK) == (ELF_KVX_CORE_KV4))
69 #define ELF_KVX_CHECK_CORE(flags,m) (((flags) & ELF_KVX_CORE_MASK)==(m))
70 
71 #define ELF_KVX_ABI_MASK         (0xFF)
72 
73 #define ELF_KVX_ABI_IDENT_MASK   (0x7)
74 #define ELF_KVX_ABI_REGULAR      (0x1)
75 #define ELF_KVX_ABI_UNDEF        (0x0)
76 
77 #define ELF_KVX_ABI_64B_ADDR_BIT (0x08)
78 
79 #define ELF_KVX_ABI_PIC_BIT      (0x10)
80 
81 #endif /* _KVX_ELFIDS_H_ */
82