Home | History | Annotate | Line # | Download | only in include
      1  1.2  thorpej /* $NetBSD: alpha_instruction.h,v 1.2 2023/11/21 22:27:41 thorpej Exp $ */
      2  1.1  thorpej 
      3  1.1  thorpej /*
      4  1.1  thorpej  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
      5  1.1  thorpej  *
      6  1.1  thorpej  * Redistribution and use in source and binary forms, with or without
      7  1.1  thorpej  * modification, are permitted provided that the following conditions
      8  1.1  thorpej  * are met:
      9  1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     10  1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     11  1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     13  1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     14  1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     15  1.1  thorpej  *    must display the following acknowledgement:
     16  1.1  thorpej  *      This product includes software developed by Christopher G. Demetriou
     17  1.1  thorpej  *	for the NetBSD Project.
     18  1.1  thorpej  * 4. The name of the author may not be used to endorse or promote products
     19  1.1  thorpej  *    derived from this software without specific prior written permission
     20  1.1  thorpej  *
     21  1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.1  thorpej  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.1  thorpej  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.1  thorpej  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  1.1  thorpej  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  1.1  thorpej  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.1  thorpej  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.1  thorpej  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.1  thorpej  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  1.1  thorpej  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.1  thorpej  */
     32  1.1  thorpej 
     33  1.1  thorpej /*
     34  1.1  thorpej  * Mach Operating System
     35  1.1  thorpej  * Copyright (c) 1993,1992 Carnegie Mellon University
     36  1.1  thorpej  * All Rights Reserved.
     37  1.1  thorpej  *
     38  1.1  thorpej  * Permission to use, copy, modify and distribute this software and its
     39  1.1  thorpej  * documentation is hereby granted, provided that both the copyright
     40  1.1  thorpej  * notice and this permission notice appear in all copies of the
     41  1.1  thorpej  * software, derivative works or modified versions, and any portions
     42  1.1  thorpej  * thereof, and that both notices appear in supporting documentation.
     43  1.1  thorpej  *
     44  1.1  thorpej  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     45  1.1  thorpej  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
     46  1.1  thorpej  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     47  1.1  thorpej  *
     48  1.1  thorpej  * Carnegie Mellon requests users of this software to return to
     49  1.1  thorpej  *
     50  1.1  thorpej  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     51  1.1  thorpej  *  School of Computer Science
     52  1.1  thorpej  *  Carnegie Mellon University
     53  1.1  thorpej  *  Pittsburgh PA 15213-3890
     54  1.1  thorpej  *
     55  1.1  thorpej  * any improvements or extensions that they make and grant Carnegie Mellon
     56  1.1  thorpej  * the rights to redistribute these changes.
     57  1.1  thorpej  */
     58  1.1  thorpej 
     59  1.1  thorpej /*
     60  1.1  thorpej  *	File: alpha_instruction.h
     61  1.1  thorpej  * 	Author: Alessandro Forin, Carnegie Mellon University
     62  1.1  thorpej  *	Date:	11/91
     63  1.1  thorpej  *
     64  1.1  thorpej  *	Alpha Instruction set definition
     65  1.1  thorpej  *
     66  1.1  thorpej  *	Reference: "Alpha System Reference Manual", V4.0, April 1991
     67  1.1  thorpej  *
     68  1.1  thorpej  */
     69  1.1  thorpej 
     70  1.1  thorpej #ifndef	_ALPHA_INSTRUCTION_H_
     71  1.1  thorpej #define	_ALPHA_INSTRUCTION_H_ 1
     72  1.1  thorpej 
     73  1.1  thorpej #if	!defined(ASSEMBLER)
     74  1.1  thorpej 
     75  1.1  thorpej /*
     76  1.1  thorpej  *	All instructions are in one of five formats:
     77  1.1  thorpej  *		Memory, Branch, Operate, Floating-point Operate, PAL
     78  1.1  thorpej  *
     79  1.1  thorpej  *	The original Mach sources attempted to use 'smarter' names
     80  1.1  thorpej  *	for registers, which reflected source and destination.  These
     81  1.1  thorpej  *	definitions use the names from the Architecture Reference Manual,
     82  1.1  thorpej  *	both for clarity and because you can't differentiate between
     83  1.1  thorpej  *	'source' and 'destinations' for some types of instructions (loads
     84  1.1  thorpej  *	and stores; they'd be correct for one, but swapped for the other).
     85  1.1  thorpej  */
     86  1.1  thorpej 
     87  1.1  thorpej 
     88  1.1  thorpej typedef union {
     89  1.1  thorpej 	/*
     90  1.1  thorpej 	 *	All instructions are 32 bits wide
     91  1.1  thorpej 	 */
     92  1.1  thorpej 	unsigned int	bits;
     93  1.1  thorpej 
     94  1.1  thorpej 	/*
     95  1.1  thorpej 	 *	Generic instruction pseudo format; look at
     96  1.1  thorpej 	 *	opcode to see how to interpret the rest.
     97  1.1  thorpej 	 */
     98  1.1  thorpej 	struct {
     99  1.1  thorpej 		unsigned	bits:26,
    100  1.1  thorpej 				opcode:6;
    101  1.1  thorpej 	} generic_format;
    102  1.1  thorpej 
    103  1.1  thorpej 	/*
    104  1.1  thorpej 	 *	Memory instructions contain a 16 bit
    105  1.1  thorpej 	 *	signed immediate value and two register
    106  1.1  thorpej 	 *	specifiers
    107  1.1  thorpej 	 */
    108  1.1  thorpej 	struct {
    109  1.1  thorpej 		signed short	displacement;
    110  1.1  thorpej 		unsigned	rb : 5,
    111  1.1  thorpej 				ra : 5,
    112  1.1  thorpej 				opcode : 6;
    113  1.1  thorpej 	} mem_format;
    114  1.1  thorpej 
    115  1.1  thorpej 	/*
    116  1.1  thorpej 	 *	Branch instruction contain a 21 bit offset,
    117  1.1  thorpej 	 *	which is sign-extended, shifted and combined
    118  1.1  thorpej 	 *	with the PC to form a 64 bit destination address.
    119  1.1  thorpej 	 *
    120  1.1  thorpej 	 *	In computed jump instructions the opcode is further
    121  1.1  thorpej 	 *	specified in the offset field, the rest of it is
    122  1.1  thorpej 	 *	used as branch target hint.  The destination of the
    123  1.1  thorpej 	 *	jump is the source register.
    124  1.1  thorpej 	 */
    125  1.1  thorpej 	struct {
    126  1.1  thorpej 		signed int	displacement : 21;
    127  1.1  thorpej 		unsigned	ra : 5,
    128  1.1  thorpej 				opcode : 6;
    129  1.1  thorpej 	} branch_format;
    130  1.1  thorpej 
    131  1.1  thorpej 	struct {
    132  1.1  thorpej 		signed int	hint : 14;
    133  1.1  thorpej 		unsigned	action : 2,
    134  1.1  thorpej 				rb : 5,
    135  1.1  thorpej 				ra : 5,
    136  1.1  thorpej 				opcode : 6;
    137  1.1  thorpej 	} jump_format;
    138  1.1  thorpej 
    139  1.1  thorpej 
    140  1.1  thorpej 	/*
    141  1.1  thorpej 	 *	Operate instructions are of two types, with
    142  1.1  thorpej 	 *	a second source register or with a literal
    143  1.1  thorpej 	 *	specifier.  Bit 12 sez which is which.
    144  1.1  thorpej 	 */
    145  1.1  thorpej 	struct {
    146  1.1  thorpej 		unsigned	rc : 5,
    147  1.1  thorpej 				function : 7,
    148  1.1  thorpej 				is_lit : 1,
    149  1.1  thorpej 				sbz_or_litlo : 3,
    150  1.1  thorpej 				rb_or_lithi : 5,
    151  1.1  thorpej 				ra : 5,
    152  1.1  thorpej 				opcode : 6;
    153  1.1  thorpej 	} operate_generic_format;
    154  1.1  thorpej 
    155  1.1  thorpej 	struct {
    156  1.1  thorpej 		unsigned	rc : 5,
    157  1.1  thorpej 				function : 7,
    158  1.1  thorpej 				zero : 1,
    159  1.1  thorpej 				sbz : 3,
    160  1.1  thorpej 				rb : 5,
    161  1.1  thorpej 				ra : 5,
    162  1.1  thorpej 				opcode : 6;
    163  1.1  thorpej 	} operate_reg_format;
    164  1.1  thorpej 
    165  1.1  thorpej 	struct {
    166  1.1  thorpej 		unsigned	rc : 5,
    167  1.1  thorpej 				function : 7,
    168  1.1  thorpej 				one : 1,
    169  1.1  thorpej 				literal : 8,
    170  1.1  thorpej 				ra : 5,
    171  1.1  thorpej 				opcode : 6;
    172  1.1  thorpej 	} operate_lit_format;
    173  1.1  thorpej 
    174  1.1  thorpej 
    175  1.1  thorpej 	/*
    176  1.1  thorpej 	 *	Floating point operate instruction are quite
    177  1.1  thorpej 	 *	uniform in the encoding.  As for the semantics..
    178  1.1  thorpej 	 */
    179  1.1  thorpej 	struct {
    180  1.1  thorpej 		unsigned	fc : 5,
    181  1.1  thorpej 				function : 11,
    182  1.1  thorpej 				fb : 5,
    183  1.1  thorpej 				fa : 5,
    184  1.1  thorpej 				opcode : 6;
    185  1.1  thorpej 	} float_format;
    186  1.1  thorpej 
    187  1.1  thorpej 	struct {
    188  1.1  thorpej 		unsigned	fc : 5,
    189  1.1  thorpej 				opclass : 4,
    190  1.1  thorpej 				src : 2,
    191  1.1  thorpej 				rnd : 2,
    192  1.1  thorpej 				trp : 3,
    193  1.1  thorpej 				fb : 5,
    194  1.1  thorpej 				fa : 5,
    195  1.1  thorpej 				opcode : 6;
    196  1.1  thorpej 	} float_detail;
    197  1.1  thorpej 
    198  1.1  thorpej 	/*
    199  1.1  thorpej 	 *	PAL instructions just define the major opcode
    200  1.1  thorpej 	 */
    201  1.1  thorpej 
    202  1.1  thorpej 	struct {
    203  1.1  thorpej 		unsigned	function : 26,
    204  1.1  thorpej 				opcode : 6;
    205  1.1  thorpej 	} pal_format;
    206  1.1  thorpej 
    207  1.1  thorpej } alpha_instruction;
    208  1.1  thorpej 
    209  1.1  thorpej #endif /* !defined(ASSEMBLER) */
    210  1.1  thorpej 
    211  1.1  thorpej /*
    212  1.1  thorpej  *
    213  1.1  thorpej  *	Encoding of regular instructions  (Appendix C op cit)
    214  1.1  thorpej  *
    215  1.1  thorpej  */
    216  1.1  thorpej 
    217  1.1  thorpej 		/* OPCODE, bits 26..31 */
    218  1.1  thorpej 
    219  1.1  thorpej #define	op_pal		0x00		/* see PAL sub-table */
    220  1.1  thorpej 					/* 1..7 reserved */
    221  1.1  thorpej #define	op_lda		0x08
    222  1.1  thorpej #define	op_ldah		0x09
    223  1.1  thorpej #define	op_ldbu		0x0a
    224  1.1  thorpej #define	op_ldq_u	0x0b
    225  1.1  thorpej #define	op_ldwu		0x0c
    226  1.1  thorpej #define	op_stw		0x0d
    227  1.1  thorpej #define	op_stb		0x0e
    228  1.1  thorpej #define	op_stq_u	0x0f
    229  1.1  thorpej 
    230  1.1  thorpej #define	op_arit		0x10		/* see ARIT sub-table */
    231  1.1  thorpej #define	op_logical	0x11		/* see LOGICAL sub-table */
    232  1.1  thorpej #define	op_bit		0x12		/* see BIT sub-table */
    233  1.1  thorpej #define	op_mul		0x13		/* see MUL sub-table */
    234  1.1  thorpej #define op_fix_float	0x14		/* if ALPHA_AMASK_FIX */
    235  1.1  thorpej #define	op_vax_float	0x15		/* see FLOAT sub-table */
    236  1.1  thorpej #define	op_ieee_float	0x16		/* see FLOAT sub-table */
    237  1.1  thorpej #define	op_any_float	0x17		/* see FLOAT sub-table */
    238  1.1  thorpej 
    239  1.1  thorpej #define	op_special	0x18		/* see SPECIAL sub-table */
    240  1.1  thorpej #define	op_pal19	0x19		/* reserved for pal code */
    241  1.1  thorpej #define	op_j		0x1a		/* see JUMP sub-table */
    242  1.1  thorpej #define	op_pal1b	0x1b		/* reserved for pal code */
    243  1.1  thorpej #define	op_intmisc	0x1c		/* see INTMISC sub-table */
    244  1.1  thorpej #define	op_pal1d	0x1d		/* reserved for pal code */
    245  1.1  thorpej #define	op_pal1e	0x1e		/* reserved for pal code */
    246  1.1  thorpej #define	op_pal1f	0x1f		/* reserved for pal code */
    247  1.1  thorpej 
    248  1.1  thorpej #define	op_ldf		0x20
    249  1.1  thorpej #define	op_ldg		0x21
    250  1.1  thorpej #define	op_lds		0x22
    251  1.1  thorpej #define	op_ldt		0x23
    252  1.1  thorpej #define	op_stf		0x24
    253  1.1  thorpej #define	op_stg		0x25
    254  1.1  thorpej #define	op_sts		0x26
    255  1.1  thorpej #define	op_stt		0x27
    256  1.1  thorpej #define	op_ldl		0x28
    257  1.1  thorpej #define	op_ldq		0x29
    258  1.1  thorpej #define	op_ldl_l	0x2a
    259  1.1  thorpej #define	op_ldq_l	0x2b
    260  1.1  thorpej #define	op_stl		0x2c
    261  1.1  thorpej #define	op_stq		0x2d
    262  1.1  thorpej #define	op_stl_c	0x2e
    263  1.1  thorpej #define	op_stq_c	0x2f
    264  1.1  thorpej #define	op_br		0x30
    265  1.1  thorpej #define	op_fbeq		0x31
    266  1.1  thorpej #define	op_fblt		0x32
    267  1.1  thorpej #define	op_fble		0x33
    268  1.1  thorpej #define	op_bsr		0x34
    269  1.1  thorpej #define	op_fbne		0x35
    270  1.1  thorpej #define	op_fbge		0x36
    271  1.1  thorpej #define	op_fbgt		0x37
    272  1.1  thorpej #define	op_blbc		0x38
    273  1.1  thorpej #define	op_beq		0x39
    274  1.1  thorpej #define	op_blt		0x3a
    275  1.1  thorpej #define	op_ble		0x3b
    276  1.1  thorpej #define	op_blbs		0x3c
    277  1.1  thorpej #define	op_bne		0x3d
    278  1.1  thorpej #define	op_bge		0x3e
    279  1.1  thorpej #define op_bgt		0x3f
    280  1.1  thorpej 
    281  1.1  thorpej 
    282  1.1  thorpej 		/* PAL, "function" opcodes (bits 0..25) */
    283  1.1  thorpej /*
    284  1.1  thorpej  * What we will implement is TBD.  These are the unprivileged ones
    285  1.1  thorpej  * that we probably have to support for compat reasons.
    286  1.1  thorpej  */
    287  1.1  thorpej 
    288  1.1  thorpej /* See <machine/pal.h> */
    289  1.1  thorpej 
    290  1.1  thorpej 		/* ARIT, "function" opcodes (bits 5..11)  */
    291  1.1  thorpej 
    292  1.1  thorpej #define	op_addl		0x00
    293  1.1  thorpej #define	op_s4addl	0x02
    294  1.1  thorpej #define	op_subl		0x09
    295  1.1  thorpej #define	op_s4subl	0x0b
    296  1.1  thorpej #define	op_cmpbge	0x0f
    297  1.1  thorpej #define	op_s8addl	0x12
    298  1.1  thorpej #define	op_s8subl	0x1b
    299  1.1  thorpej #define	op_cmpult	0x1d
    300  1.1  thorpej #define	op_addq		0x20
    301  1.1  thorpej #define	op_s4addq	0x22
    302  1.1  thorpej #define	op_subq		0x29
    303  1.1  thorpej #define	op_s4subq	0x2b
    304  1.1  thorpej #define	op_cmpeq	0x2d
    305  1.1  thorpej #define	op_s8addq	0x32
    306  1.1  thorpej #define	op_s8subq	0x3b
    307  1.1  thorpej #define	op_cmpule	0x3d
    308  1.1  thorpej #define	op_addl_v	0x40
    309  1.1  thorpej #define	op_subl_v	0x49
    310  1.1  thorpej #define	op_cmplt	0x4d
    311  1.1  thorpej #define	op_addq_v	0x60
    312  1.1  thorpej #define	op_subq_v	0x69
    313  1.1  thorpej #define	op_cmple	0x6d
    314  1.1  thorpej 
    315  1.1  thorpej 
    316  1.1  thorpej 		/* LOGICAL, "function" opcodes (bits 5..11)  */
    317  1.1  thorpej 
    318  1.1  thorpej #define	op_and		0x00
    319  1.1  thorpej #define	op_andnot	0x08	/* bic */
    320  1.1  thorpej #define	op_cmovlbs	0x14
    321  1.1  thorpej #define	op_cmovlbc	0x16
    322  1.1  thorpej #define	op_or		0x20	/* bis */
    323  1.1  thorpej #define	op_cmoveq	0x24
    324  1.1  thorpej #define	op_cmovne	0x26
    325  1.1  thorpej #define	op_ornot	0x28
    326  1.1  thorpej #define	op_xor		0x40
    327  1.1  thorpej #define	op_cmovlt	0x44
    328  1.1  thorpej #define	op_cmovge	0x46
    329  1.1  thorpej #define	op_xornot	0x48	/* eqv */
    330  1.1  thorpej #define	op_amask	0x61
    331  1.1  thorpej #define	op_cmovle	0x64
    332  1.1  thorpej #define	op_cmovgt	0x66
    333  1.1  thorpej #define	op_implver	0x6c
    334  1.1  thorpej 
    335  1.1  thorpej 		/* BIT, "function" opcodes (bits 5..11)  */
    336  1.1  thorpej 
    337  1.1  thorpej #define	op_mskbl	0x02
    338  1.1  thorpej #define	op_extbl	0x06
    339  1.1  thorpej #define	op_insbl	0x0b
    340  1.1  thorpej #define	op_mskwl	0x12
    341  1.1  thorpej #define	op_extwl	0x16
    342  1.1  thorpej #define	op_inswl	0x1b
    343  1.1  thorpej #define	op_mskll	0x22
    344  1.1  thorpej #define	op_extll	0x26
    345  1.1  thorpej #define	op_insll	0x2b
    346  1.1  thorpej #define	op_zap		0x30
    347  1.1  thorpej #define	op_zapnot	0x31
    348  1.1  thorpej #define	op_mskql	0x32
    349  1.1  thorpej #define	op_srl		0x34
    350  1.1  thorpej #define	op_extql	0x36
    351  1.1  thorpej #define	op_sll		0x39
    352  1.1  thorpej #define	op_insql	0x3b
    353  1.1  thorpej #define	op_sra		0x3c
    354  1.1  thorpej #define	op_mskwh	0x52
    355  1.1  thorpej #define	op_inswh	0x57
    356  1.1  thorpej #define	op_extwh	0x5a
    357  1.1  thorpej #define	op_msklh	0x62
    358  1.1  thorpej #define	op_inslh	0x67
    359  1.1  thorpej #define	op_extlh	0x6a
    360  1.1  thorpej #define	op_mskqh	0x72
    361  1.1  thorpej #define	op_insqh	0x77
    362  1.1  thorpej #define	op_extqh	0x7a
    363  1.1  thorpej 
    364  1.1  thorpej 		/* MUL, "function" opcodes (bits 5..11)  */
    365  1.1  thorpej 
    366  1.1  thorpej #define	op_mull		0x00
    367  1.1  thorpej #define	op_mulq_v	0x60
    368  1.1  thorpej #define	op_mull_v	0x40
    369  1.1  thorpej #define	op_umulh	0x30
    370  1.1  thorpej #define	op_mulq		0x20
    371  1.1  thorpej 
    372  1.1  thorpej 
    373  1.1  thorpej 		/* SPECIAL, "displacement" opcodes (bits 0..15)  */
    374  1.1  thorpej 
    375  1.1  thorpej #define	op_trapb	0x0000
    376  1.1  thorpej #define	op_excb		0x0400
    377  1.1  thorpej #define	op_mb		0x4000
    378  1.1  thorpej #define	op_wmb		0x4400
    379  1.1  thorpej #define	op_fetch	0x8000
    380  1.1  thorpej #define	op_fetch_m	0xa000
    381  1.1  thorpej #define	op_rpcc		0xc000
    382  1.1  thorpej #define op_rc		0xe000
    383  1.1  thorpej #define	op_ecb		0xe800
    384  1.1  thorpej #define	op_rs		0xf000
    385  1.1  thorpej #define	op_wh64		0xf800
    386  1.1  thorpej 
    387  1.1  thorpej 		/* JUMP, "action" opcodes (bits 14..15) */
    388  1.1  thorpej 
    389  1.1  thorpej #define	op_jmp		0x0
    390  1.1  thorpej #define	op_jsr		0x1
    391  1.1  thorpej #define	op_ret		0x2
    392  1.1  thorpej #define	op_jcr		0x3
    393  1.1  thorpej 
    394  1.1  thorpej 		/* INTMISC, "function" opcodes (operate format) */
    395  1.1  thorpej 
    396  1.1  thorpej #define	op_sextb	0x00
    397  1.1  thorpej #define	op_sextw	0x01
    398  1.1  thorpej #define	op_ctpop	0x30
    399  1.1  thorpej #define	op_perr		0x31
    400  1.1  thorpej #define	op_ctlz		0x32
    401  1.1  thorpej #define	op_cttz		0x33
    402  1.1  thorpej #define	op_unpkbw	0x34
    403  1.1  thorpej #define	op_unpkbl	0x35
    404  1.1  thorpej #define	op_pkwb		0x36
    405  1.1  thorpej #define	op_pklb		0x37
    406  1.1  thorpej #define	op_minsb8	0x38
    407  1.1  thorpej #define	op_minsw4	0x39
    408  1.1  thorpej #define	op_minub8	0x3a
    409  1.1  thorpej #define	op_minuw4	0x3b
    410  1.1  thorpej #define	op_maxub8	0x3c
    411  1.1  thorpej #define	op_maxuw4	0x3d
    412  1.1  thorpej #define	op_maxsb8	0x3e
    413  1.1  thorpej #define	op_maxsw4	0x3f
    414  1.1  thorpej #define	op_ftoit	0x70
    415  1.1  thorpej #define	op_ftois	0x78
    416  1.1  thorpej 
    417  1.1  thorpej /*
    418  1.1  thorpej  *
    419  1.1  thorpej  *	Encoding of floating point instructions (pagg. C-5..6 op cit)
    420  1.1  thorpej  *
    421  1.1  thorpej  *	Load and store operations use opcodes op_ldf..op_stt
    422  1.1  thorpej  */
    423  1.1  thorpej 
    424  1.1  thorpej 		/* src encoding from function, 9..10 */
    425  1.1  thorpej #define	op_src_sf	0
    426  1.1  thorpej #define	op_src_xd	1
    427  1.1  thorpej #define	op_src_tg	2
    428  1.1  thorpej #define	op_src_qq	3
    429  1.1  thorpej 
    430  1.1  thorpej 		/* any FLOAT, "function" opcodes (bits 5..11)  */
    431  1.1  thorpej 
    432  1.1  thorpej #define	op_cvtlq	0x010
    433  1.1  thorpej #define	op_cpys		0x020
    434  1.1  thorpej #define	op_cpysn	0x021
    435  1.1  thorpej #define	op_cpyse	0x022
    436  1.1  thorpej #define	op_mt_fpcr	0x024
    437  1.1  thorpej #define	op_mf_fpcr	0x025
    438  1.1  thorpej #define	op_fcmoveq	0x02a
    439  1.1  thorpej #define	op_fcmovne	0x02b
    440  1.1  thorpej #define	op_fcmovlt	0x02c
    441  1.1  thorpej #define	op_fcmovge	0x02d
    442  1.1  thorpej #define	op_fcmovle	0x02e
    443  1.1  thorpej #define	op_fcmovgt	0x02f
    444  1.1  thorpej #define	op_cvtql	0x030
    445  1.1  thorpej #define	op_cvtql_v	0x130
    446  1.1  thorpej #define	op_cvtql_sv	0x530
    447  1.1  thorpej 
    448  1.1  thorpej 		/* FIX FLOAT, "function" opcodes (bits 5..11)  */
    449  1.1  thorpej 
    450  1.1  thorpej #define	op_itofs	0x004
    451  1.1  thorpej #define	op_itoff	0x014
    452  1.1  thorpej #define	op_itoft	0x024
    453  1.1  thorpej 
    454  1.1  thorpej 		/* ieee FLOAT, "function" opcodes (bits 5..11)  */
    455  1.1  thorpej 
    456  1.1  thorpej #define	op_adds_c	0x000
    457  1.1  thorpej #define	op_subs_c	0x001
    458  1.1  thorpej #define	op_muls_c	0x002
    459  1.1  thorpej #define	op_divs_c	0x003
    460  1.1  thorpej #define	op_addt_c	0x020
    461  1.1  thorpej #define	op_subt_c	0x021
    462  1.1  thorpej #define	op_mult_c	0x022
    463  1.1  thorpej #define	op_divt_c	0x023
    464  1.1  thorpej #define	op_cvtts_c	0x02c
    465  1.1  thorpej #define	op_cvttq_c	0x02f
    466  1.1  thorpej #define	op_cvtqs_c	0x03c
    467  1.1  thorpej #define	op_cvtqt_c	0x03e
    468  1.1  thorpej #define	op_adds_m	0x040
    469  1.1  thorpej #define	op_subs_m	0x041
    470  1.1  thorpej #define	op_muls_m	0x042
    471  1.1  thorpej #define	op_divs_m	0x043
    472  1.1  thorpej #define	op_addt_m	0x060
    473  1.1  thorpej #define	op_subt_m	0x061
    474  1.1  thorpej #define	op_mult_m	0x062
    475  1.1  thorpej #define	op_divt_m	0x063
    476  1.1  thorpej #define	op_cvtts_m	0x06c
    477  1.1  thorpej #define	op_cvtqs_m	0x07c
    478  1.1  thorpej #define	op_cvtqt_m	0x07e
    479  1.1  thorpej #define	op_adds		0x080
    480  1.1  thorpej #define	op_subs		0x081
    481  1.1  thorpej #define	op_muls		0x082
    482  1.1  thorpej #define	op_divs		0x083
    483  1.1  thorpej #define	op_addt		0x0a0
    484  1.1  thorpej #define	op_subt		0x0a1
    485  1.1  thorpej #define	op_mult		0x0a2
    486  1.1  thorpej #define	op_divt		0x0a3
    487  1.1  thorpej #define	op_cmptun	0x0a4
    488  1.1  thorpej #define	op_cmpteq	0x0a5
    489  1.1  thorpej #define	op_cmptlt	0x0a6
    490  1.1  thorpej #define	op_cmptle	0x0a7
    491  1.1  thorpej #define	op_cvtts	0x0ac
    492  1.1  thorpej #define	op_cvttq	0x0af
    493  1.1  thorpej #define	op_cvtqs	0x0bc
    494  1.1  thorpej #define	op_cvtqt	0x0be
    495  1.1  thorpej #define	op_adds_d	0x0c0
    496  1.1  thorpej #define	op_subs_d	0x0c1
    497  1.1  thorpej #define	op_muls_d	0x0c2
    498  1.1  thorpej #define	op_divs_d	0x0c3
    499  1.1  thorpej #define	op_addt_d	0x0e0
    500  1.1  thorpej #define	op_subt_d	0x0e1
    501  1.1  thorpej #define	op_mult_d	0x0e2
    502  1.1  thorpej #define	op_divt_d	0x0e3
    503  1.1  thorpej #define	op_cvtts_d	0x0ec
    504  1.1  thorpej #define	op_cvtqs_d	0x0fc
    505  1.1  thorpej #define	op_cvtqt_d	0x0fe
    506  1.1  thorpej #define	op_adds_uc	0x100
    507  1.1  thorpej #define	op_subs_uc	0x101
    508  1.1  thorpej #define	op_muls_uc	0x102
    509  1.1  thorpej #define	op_divs_uc	0x103
    510  1.1  thorpej #define	op_addt_uc	0x120
    511  1.1  thorpej #define	op_subt_uc	0x121
    512  1.1  thorpej #define	op_mult_uc	0x122
    513  1.1  thorpej #define	op_divt_uc	0x123
    514  1.1  thorpej #define	op_cvtts_uc	0x12c
    515  1.1  thorpej #define	op_cvttq_vc	0x12f
    516  1.1  thorpej #define	op_adds_um	0x140
    517  1.1  thorpej #define	op_subs_um	0x141
    518  1.1  thorpej #define	op_muls_um	0x142
    519  1.1  thorpej #define	op_divs_um	0x143
    520  1.1  thorpej #define	op_addt_um	0x160
    521  1.1  thorpej #define	op_subt_um	0x161
    522  1.1  thorpej #define	op_mult_um	0x162
    523  1.1  thorpej #define	op_divt_um	0x163
    524  1.1  thorpej #define	op_cvtts_um	0x16c
    525  1.1  thorpej #define	op_adds_u	0x180
    526  1.1  thorpej #define	op_subs_u	0x181
    527  1.1  thorpej #define	op_muls_u	0x182
    528  1.1  thorpej #define	op_divs_u	0x183
    529  1.1  thorpej #define	op_addt_u	0x1a0
    530  1.1  thorpej #define	op_subt_u	0x1a1
    531  1.1  thorpej #define	op_mult_u	0x1a2
    532  1.1  thorpej #define	op_divt_u	0x1a3
    533  1.1  thorpej #define	op_cvtts_u	0x1ac
    534  1.1  thorpej #define	op_cvttq_v	0x1af
    535  1.1  thorpej #define	op_adds_ud	0x1c0
    536  1.1  thorpej #define	op_subs_ud	0x1c1
    537  1.1  thorpej #define	op_muls_ud	0x1c2
    538  1.1  thorpej #define	op_divs_ud	0x1c3
    539  1.1  thorpej #define	op_addt_ud	0x1e0
    540  1.1  thorpej #define	op_subt_ud	0x1e1
    541  1.1  thorpej #define	op_mult_ud	0x1e2
    542  1.1  thorpej #define	op_divt_ud	0x1e3
    543  1.1  thorpej #define	op_cvtts_ud	0x1ec
    544  1.1  thorpej #define op_cvtst	0x2ac
    545  1.1  thorpej #define	op_adds_suc	0x500
    546  1.1  thorpej #define	op_subs_suc	0x501
    547  1.1  thorpej #define	op_muls_suc	0x502
    548  1.1  thorpej #define	op_divs_suc	0x503
    549  1.1  thorpej #define	op_addt_suc	0x520
    550  1.1  thorpej #define	op_subt_suc	0x521
    551  1.1  thorpej #define	op_mult_suc	0x522
    552  1.1  thorpej #define	op_divt_suc	0x523
    553  1.1  thorpej #define	op_cvtts_suc	0x52c
    554  1.1  thorpej #define	op_cvttq_svc	0x52f
    555  1.1  thorpej #define	op_adds_sum	0x540
    556  1.1  thorpej #define	op_subs_sum	0x541
    557  1.1  thorpej #define	op_muls_sum	0x542
    558  1.1  thorpej #define	op_divs_sum	0x543
    559  1.1  thorpej #define	op_addt_sum	0x560
    560  1.1  thorpej #define	op_subt_sum	0x561
    561  1.1  thorpej #define	op_mult_sum	0x562
    562  1.1  thorpej #define	op_divt_sum	0x563
    563  1.1  thorpej #define	op_cvtts_sum	0x56c
    564  1.1  thorpej #define	op_adds_su	0x580
    565  1.1  thorpej #define	op_subs_su	0x581
    566  1.1  thorpej #define	op_muls_su	0x582
    567  1.1  thorpej #define	op_divs_su	0x583
    568  1.1  thorpej #define	op_addt_su	0x5a0
    569  1.1  thorpej #define	op_subt_su	0x5a1
    570  1.1  thorpej #define	op_mult_su	0x5a2
    571  1.1  thorpej #define	op_divt_su	0x5a3
    572  1.1  thorpej #define	op_cmptun_su	0x5a4
    573  1.1  thorpej #define	op_cmpteq_su	0x5a5
    574  1.1  thorpej #define	op_cmptlt_su	0x5a6
    575  1.1  thorpej #define	op_cmptle_su	0x5a7
    576  1.1  thorpej #define	op_cvtts_su	0x5ac
    577  1.1  thorpej #define	op_cvttq_sv	0x5af
    578  1.1  thorpej #define	op_adds_sud	0x5c0
    579  1.1  thorpej #define	op_subs_sud	0x5c1
    580  1.1  thorpej #define	op_muls_sud	0x5c2
    581  1.1  thorpej #define	op_divs_sud	0x5c3
    582  1.1  thorpej #define	op_addt_sud	0x5e0
    583  1.1  thorpej #define	op_subt_sud	0x5e1
    584  1.1  thorpej #define	op_mult_sud	0x5e2
    585  1.1  thorpej #define	op_divt_sud	0x5e3
    586  1.1  thorpej #define	op_cvtts_sud	0x5ec
    587  1.1  thorpej #define	op_cvtst_u	0x6ac
    588  1.1  thorpej #define	op_adds_suic	0x700
    589  1.1  thorpej #define	op_subs_suic	0x701
    590  1.1  thorpej #define	op_muls_suic	0x702
    591  1.1  thorpej #define	op_divs_suic	0x703
    592  1.1  thorpej #define	op_addt_suic	0x720
    593  1.1  thorpej #define	op_subt_suic	0x721
    594  1.1  thorpej #define	op_mult_suic	0x722
    595  1.1  thorpej #define	op_divt_suic	0x723
    596  1.1  thorpej #define	op_cvtts_suic	0x72c
    597  1.1  thorpej #define	op_cvttq_svic	0x72f
    598  1.1  thorpej #define	op_cvtqs_suic	0x73c
    599  1.1  thorpej #define	op_cvtqt_suic	0x73e
    600  1.1  thorpej #define	op_adds_suim	0x740
    601  1.1  thorpej #define	op_subs_suim	0x741
    602  1.1  thorpej #define	op_muls_suim	0x742
    603  1.1  thorpej #define	op_divs_suim	0x743
    604  1.1  thorpej #define	op_addt_suim	0x760
    605  1.1  thorpej #define	op_subt_suim	0x761
    606  1.1  thorpej #define	op_mult_suim	0x762
    607  1.1  thorpej #define	op_divt_suim	0x763
    608  1.1  thorpej #define	op_cvtts_suim	0x76c
    609  1.1  thorpej #define	op_cvtqs_suim	0x77c
    610  1.1  thorpej #define	op_cvtqt_suim	0x77e
    611  1.1  thorpej #define	op_adds_sui	0x780
    612  1.1  thorpej #define	op_subs_sui	0x781
    613  1.1  thorpej #define	op_muls_sui	0x782
    614  1.1  thorpej #define	op_divs_sui	0x783
    615  1.1  thorpej #define	op_addt_sui	0x7a0
    616  1.1  thorpej #define	op_subt_sui	0x7a1
    617  1.1  thorpej #define	op_mult_sui	0x7a2
    618  1.1  thorpej #define	op_divt_sui	0x7a3
    619  1.1  thorpej #define	op_cvtts_sui	0x7ac
    620  1.1  thorpej #define	op_cvttq_svi	0x7af
    621  1.1  thorpej #define	op_cvtqs_sui	0x7bc
    622  1.1  thorpej #define	op_cvtqt_sui	0x7be
    623  1.1  thorpej #define	op_adds_suid	0x7c0
    624  1.1  thorpej #define	op_subs_suid	0x7c1
    625  1.1  thorpej #define	op_muls_suid	0x7c2
    626  1.1  thorpej #define	op_divs_suid	0x7c3
    627  1.1  thorpej #define	op_addt_suid	0x7e0
    628  1.1  thorpej #define	op_subt_suid	0x7e1
    629  1.1  thorpej #define	op_mult_suid	0x7e2
    630  1.1  thorpej #define	op_divt_suid	0x7e3
    631  1.1  thorpej #define	op_cvtts_suid	0x7ec
    632  1.1  thorpej #define	op_cvtqs_suid	0x7fc
    633  1.1  thorpej #define	op_cvtqt_suid	0x7fe
    634  1.1  thorpej 
    635  1.1  thorpej 
    636  1.1  thorpej 		/* vax FLOAT, "function" opcodes (bits 5..11)  */
    637  1.1  thorpej 
    638  1.1  thorpej #define	op_addf_c	0x000
    639  1.1  thorpej #define	op_subf_c	0x001
    640  1.1  thorpej #define	op_mulf_c	0x002
    641  1.1  thorpej #define	op_divf_c	0x003
    642  1.1  thorpej #define	op_cvtdg_c	0x01e
    643  1.1  thorpej #define	op_addg_c	0x020
    644  1.1  thorpej #define	op_subg_c	0x021
    645  1.1  thorpej #define	op_mulg_c	0x022
    646  1.1  thorpej #define	op_divg_c	0x023
    647  1.1  thorpej #define	op_cvtgf_c	0x02c
    648  1.1  thorpej #define	op_cvtgd_c	0x02d
    649  1.1  thorpej #define	op_cvtgqg_c	0x02f
    650  1.1  thorpej #define	op_cvtqf_c	0x03c
    651  1.1  thorpej #define	op_cvtqg_c	0x03e
    652  1.1  thorpej #define	op_addf		0x080
    653  1.1  thorpej #define	op_subf		0x081
    654  1.1  thorpej #define	op_mulf		0x082
    655  1.1  thorpej #define	op_divf		0x083
    656  1.1  thorpej #define	op_cvtdg	0x09e
    657  1.1  thorpej #define	op_addg		0x0a0
    658  1.1  thorpej #define	op_subg		0x0a1
    659  1.1  thorpej #define	op_mulg		0x0a2
    660  1.1  thorpej #define	op_divg		0x0a3
    661  1.1  thorpej #define	op_cmpgeq	0x0a5
    662  1.1  thorpej #define	op_cmpglt	0x0a6
    663  1.1  thorpej #define	op_cmpgle	0x0a7
    664  1.1  thorpej #define	op_cvtgf	0x0ac
    665  1.1  thorpej #define	op_cvtgd	0x0ad
    666  1.1  thorpej #define	op_cvtgq	0x0af
    667  1.1  thorpej #define	op_cvtqf	0x0bc
    668  1.1  thorpej #define	op_cvtqg	0x0be
    669  1.1  thorpej #define	op_addf_uc	0x100
    670  1.1  thorpej #define	op_subf_uc	0x101
    671  1.1  thorpej #define	op_mulf_uc	0x102
    672  1.1  thorpej #define	op_divf_uc	0x103
    673  1.1  thorpej #define	op_cvtdg_uc	0x11e
    674  1.1  thorpej #define	op_addg_uc	0x120
    675  1.1  thorpej #define	op_subg_uc	0x121
    676  1.1  thorpej #define	op_mulg_uc	0x122
    677  1.1  thorpej #define	op_divg_uc	0x123
    678  1.1  thorpej #define	op_cvtgf_uc	0x12c
    679  1.1  thorpej #define	op_cvtgd_uc	0x12d
    680  1.1  thorpej #define	op_cvtgqg_vc	0x12f
    681  1.1  thorpej #define	op_addf_u	0x180
    682  1.1  thorpej #define	op_subf_u	0x181
    683  1.1  thorpej #define	op_mulf_u	0x182
    684  1.1  thorpej #define	op_divf_u	0x183
    685  1.1  thorpej #define	op_cvtdg_u	0x19e
    686  1.1  thorpej #define	op_addg_u	0x1a0
    687  1.1  thorpej #define	op_subg_u	0x1a1
    688  1.1  thorpej #define	op_mulg_u	0x1a2
    689  1.1  thorpej #define	op_divg_u	0x1a3
    690  1.1  thorpej #define	op_cvtgf_u	0x1ac
    691  1.1  thorpej #define	op_cvtgd_u	0x1ad
    692  1.1  thorpej #define	op_cvtgqg_v	0x1af
    693  1.1  thorpej #define	op_addf_sc	0x400
    694  1.1  thorpej #define	op_subf_sc	0x401
    695  1.1  thorpej #define	op_mulf_sc	0x402
    696  1.1  thorpej #define	op_divf_sc	0x403
    697  1.1  thorpej #define	op_cvtdg_sc	0x41e
    698  1.1  thorpej #define	op_addg_sc	0x420
    699  1.1  thorpej #define	op_subg_sc	0x421
    700  1.1  thorpej #define	op_mulg_sc	0x422
    701  1.1  thorpej #define	op_divg_sc	0x423
    702  1.1  thorpej #define	op_cvtgf_sc	0x42c
    703  1.1  thorpej #define	op_cvtgd_sc	0x42d
    704  1.1  thorpej #define	op_cvtgqg_sc	0x42f
    705  1.1  thorpej #define	op_cvtqf_sc	0x43c
    706  1.1  thorpej #define	op_cvtqg_sc	0x43e
    707  1.1  thorpej #define	op_addf_s	0x480
    708  1.1  thorpej #define	op_subf_s	0x481
    709  1.1  thorpej #define	op_mulf_s	0x482
    710  1.1  thorpej #define	op_divf_s	0x483
    711  1.1  thorpej #define	op_cvtdg_s	0x49e
    712  1.1  thorpej #define	op_addg_s	0x4a0
    713  1.1  thorpej #define	op_subg_s	0x4a1
    714  1.1  thorpej #define	op_mulg_s	0x4a2
    715  1.1  thorpej #define	op_divg_s	0x4a3
    716  1.1  thorpej #define	op_cmpgeq_s	0x4a5
    717  1.1  thorpej #define	op_cmpglt_s	0x4a6
    718  1.1  thorpej #define	op_cmpgle_s	0x4a7
    719  1.1  thorpej #define	op_cvtgf_s	0x4ac
    720  1.1  thorpej #define	op_cvtgd_s	0x4ad
    721  1.1  thorpej #define	op_cvtgqg_s	0x4af
    722  1.1  thorpej #define	op_cvtqf_s	0x4bc
    723  1.1  thorpej #define	op_cvtqg_s	0x4be
    724  1.1  thorpej #define	op_addf_suc	0x500
    725  1.1  thorpej #define	op_subf_suc	0x501
    726  1.1  thorpej #define	op_mulf_suc	0x502
    727  1.1  thorpej #define	op_divf_suc	0x503
    728  1.1  thorpej #define	op_cvtdg_suc	0x51e
    729  1.1  thorpej #define	op_addg_suc	0x520
    730  1.1  thorpej #define	op_subg_suc	0x521
    731  1.1  thorpej #define	op_mulg_suc	0x522
    732  1.1  thorpej #define	op_divg_suc	0x523
    733  1.1  thorpej #define	op_cvtgf_suc	0x52c
    734  1.1  thorpej #define	op_cvtgd_suc	0x52d
    735  1.1  thorpej #define	op_cvtgqg_svc	0x52f
    736  1.1  thorpej #define	op_addf_su	0x580
    737  1.1  thorpej #define	op_subf_su	0x581
    738  1.1  thorpej #define	op_mulf_su	0x582
    739  1.1  thorpej #define	op_divf_su	0x583
    740  1.1  thorpej #define	op_cvtdg_su	0x59e
    741  1.1  thorpej #define	op_addg_su	0x5a0
    742  1.1  thorpej #define	op_subg_su	0x5a1
    743  1.1  thorpej #define	op_mulg_su	0x5a2
    744  1.1  thorpej #define	op_divg_su	0x5a3
    745  1.1  thorpej #define	op_cvtgf_su	0x5ac
    746  1.1  thorpej #define	op_cvtgd_su	0x5ad
    747  1.1  thorpej #define	op_cvtgqg_sv	0x5af
    748  1.1  thorpej 
    749  1.1  thorpej struct alpha_print_instruction_context {
    750  1.1  thorpej 	unsigned long pc;	/* address of insn */
    751  1.1  thorpej 	alpha_instruction insn;	/* instruction bits */
    752  1.1  thorpej 	char	*buf;		/* output buffer (if not DDB) */
    753  1.1  thorpej 	size_t	bufsize;	/* size of output buffer */
    754  1.1  thorpej 	size_t	cursor;		/* current next output location */
    755  1.1  thorpej };
    756  1.1  thorpej 
    757  1.2  thorpej #ifdef _KERNEL
    758  1.1  thorpej int	alpha_print_instruction(struct alpha_print_instruction_context *);
    759  1.1  thorpej #endif /* _KERNEL */
    760  1.1  thorpej 
    761  1.1  thorpej #endif	/* _ALPHA_INSTRUCTION_H_ */
    762