xref: /netbsd-src/external/gpl3/gdb.old/dist/include/opcode/pj.h (revision 8b657b0747480f8989760d71343d6dd33f8d4cf9)
1a5a4af3bSchristos /* Definitions for decoding the picoJava opcode table.
2*8b657b07Schristos    Copyright (C) 1999-2022 Free Software Foundation, Inc.
3a5a4af3bSchristos    Contributed by Steve Chamberlain of Transmeta (sac@pobox.com).
4a5a4af3bSchristos 
5a5a4af3bSchristos    This program is free software; you can redistribute it and/or modify
6a5a4af3bSchristos    it under the terms of the GNU General Public License as published by
7a5a4af3bSchristos    the Free Software Foundation; either version 3 of the License, or
8a5a4af3bSchristos    (at your option) any later version.
9a5a4af3bSchristos 
10a5a4af3bSchristos    This program is distributed in the hope that it will be useful,
11a5a4af3bSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
12a5a4af3bSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13a5a4af3bSchristos    GNU General Public License for more details.
14a5a4af3bSchristos 
15a5a4af3bSchristos    You should have received a copy of the GNU General Public License
16a5a4af3bSchristos    along with this program; if not, write to the Free Software
17a5a4af3bSchristos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
18a5a4af3bSchristos    MA 02110-1301, USA.  */
19a5a4af3bSchristos 
20a5a4af3bSchristos /* Names used to describe the type of instruction arguments, used by
21a5a4af3bSchristos    the assembler and disassembler.  Attributes are encoded in various fields. */
22a5a4af3bSchristos 
23a5a4af3bSchristos /*            reloc  size pcrel    uns */
24a5a4af3bSchristos #define O_N    0
25a5a4af3bSchristos #define O_16  (1<<4 | 2 | (0<<6) | (0<<3))
26a5a4af3bSchristos #define O_U16 (1<<4 | 2 | (0<<6) | (1<<3))
27a5a4af3bSchristos #define O_R16 (2<<4 | 2 | (1<<6) | (0<<3))
28a5a4af3bSchristos #define O_8   (3<<4 | 1 | (0<<6) | (0<<3))
29a5a4af3bSchristos #define O_U8  (3<<4 | 1 | (0<<6) | (1<<3))
30a5a4af3bSchristos #define O_R8  (4<<4 | 1 | (0<<6) | (0<<3))
31a5a4af3bSchristos #define O_R32 (5<<4 | 4 | (1<<6) | (0<<3))
32a5a4af3bSchristos #define O_32  (6<<4 | 4 | (0<<6) | (0<<3))
33a5a4af3bSchristos 
34a5a4af3bSchristos #define ASIZE(x)  ((x) & 0x7)
35a5a4af3bSchristos #define PCREL(x)  (!!((x) & (1<<6)))
36a5a4af3bSchristos #define UNS(x)    (!!((x) & (1<<3)))
37a5a4af3bSchristos 
38a5a4af3bSchristos 
39a5a4af3bSchristos typedef struct pj_opc_info_t
40a5a4af3bSchristos {
41a5a4af3bSchristos   short opcode;
42a5a4af3bSchristos   short opcode_next;
43a5a4af3bSchristos   char len;
44a5a4af3bSchristos   unsigned char arg[2];
45a5a4af3bSchristos   union {
46a5a4af3bSchristos     const char *name;
47a5a4af3bSchristos     void (*func) (struct pj_opc_info_t *, char *);
48a5a4af3bSchristos   } u;
49a5a4af3bSchristos } pj_opc_info_t;
50