1f13107a45926fa51c6eed7141192597077003d06carll#ifndef OPCODES_H 2f13107a45926fa51c6eed7141192597077003d06carll#define OPCODES_H 3f13107a45926fa51c6eed7141192597077003d06carll 4f13107a45926fa51c6eed7141192597077003d06carll/* (Along the lines of ../s390x/opcodes.h) Macro definitions to hand-assemble 5f13107a45926fa51c6eed7141192597077003d06carll * instructions known to cause problems with assemblers or across assembler 6f13107a45926fa51c6eed7141192597077003d06carll * versions. 7f13107a45926fa51c6eed7141192597077003d06carll * 8f13107a45926fa51c6eed7141192597077003d06carll * Notes: 9f13107a45926fa51c6eed7141192597077003d06carll * 10f13107a45926fa51c6eed7141192597077003d06carll * 0. Offsets used in encodings are in Valgrind (Right to Left) ordering. 11f13107a45926fa51c6eed7141192597077003d06carll * 1. Use register numbers, not register names in macro invocations. 12f13107a45926fa51c6eed7141192597077003d06carll * 2. Insert the definitions for a new instruction/instruction format in 13f13107a45926fa51c6eed7141192597077003d06carll * the order of the appearance of its definition in the Power ISA. 14f13107a45926fa51c6eed7141192597077003d06carll */ 15f13107a45926fa51c6eed7141192597077003d06carll 16f13107a45926fa51c6eed7141192597077003d06carll/* Instruction formats: 17f13107a45926fa51c6eed7141192597077003d06carll */ 18f13107a45926fa51c6eed7141192597077003d06carll 19f13107a45926fa51c6eed7141192597077003d06carll/* Power ISA Version 2.07 (May 3, 2013). pp. 15: X-FORM */ 20f13107a45926fa51c6eed7141192597077003d06carll#define X20_ASM_DIRECTIVE ".long" 21f13107a45926fa51c6eed7141192597077003d06carll#define X20_OPCODE_OFFSET "26" 22f13107a45926fa51c6eed7141192597077003d06carll#define X20_TH_OFFSET "21" 23f13107a45926fa51c6eed7141192597077003d06carll#define X20_RA_OFFSET "16" 24f13107a45926fa51c6eed7141192597077003d06carll#define X20_RB_OFFSET "11" 25f13107a45926fa51c6eed7141192597077003d06carll#define X20_XO_OFFSET "1" 26f13107a45926fa51c6eed7141192597077003d06carll#define X20_RES_OFFSET "0" 27f13107a45926fa51c6eed7141192597077003d06carll 28f13107a45926fa51c6eed7141192597077003d06carll#define X20_ASM(OPCODE, TH, RA, RB, XO, RES) \ 29f13107a45926fa51c6eed7141192597077003d06carll X20_ASM_DIRECTIVE " " \ 30f13107a45926fa51c6eed7141192597077003d06carll "(" #OPCODE "<<" X20_OPCODE_OFFSET ")" "+" \ 31f13107a45926fa51c6eed7141192597077003d06carll "(" #TH "<<" X20_TH_OFFSET ")" "+" \ 32f13107a45926fa51c6eed7141192597077003d06carll "(" #RA "<<" X20_RA_OFFSET ")" "+" \ 33f13107a45926fa51c6eed7141192597077003d06carll "(" #RB "<<" X20_RB_OFFSET ")" "+" \ 34f13107a45926fa51c6eed7141192597077003d06carll "(" #XO "<<" X20_XO_OFFSET ")" "+" \ 35f13107a45926fa51c6eed7141192597077003d06carll "(" #RES "<<" X20_RES_OFFSET ")" 36f13107a45926fa51c6eed7141192597077003d06carll 37f13107a45926fa51c6eed7141192597077003d06carll#define X20(OPCODE, TH, RA, RB, XO, RES) X20_ASM(OPCODE, TH, RA, RB, XO, RES) 38f13107a45926fa51c6eed7141192597077003d06carll 39f13107a45926fa51c6eed7141192597077003d06carll/* Instruction specifics: 40f13107a45926fa51c6eed7141192597077003d06carll */ 41f13107a45926fa51c6eed7141192597077003d06carll 42f13107a45926fa51c6eed7141192597077003d06carll/* Power ISA Version 2.07 (May 3, 2013). pp. 770: dcbt (Category: Server Syntax) */ 43f13107a45926fa51c6eed7141192597077003d06carll#define DCBT_OPCODE 31 44f13107a45926fa51c6eed7141192597077003d06carll#define DCBT_XO 278 45f13107a45926fa51c6eed7141192597077003d06carll#define DCBT_RES 0 46f13107a45926fa51c6eed7141192597077003d06carll#define DCBT_S(RA, RB, TH) X20(DCBT_OPCODE, TH, RA, RB, DCBT_XO, DCBT_RES) 47f13107a45926fa51c6eed7141192597077003d06carll#define ASM_DCBT(RA, RB, TH) __asm__ __volatile__ (DCBT_S(RA, RB, TH)) 48f13107a45926fa51c6eed7141192597077003d06carll 49f13107a45926fa51c6eed7141192597077003d06carll/* Power ISA Version 2.07 (May 3, 2013). pp. 771: dcbtst (Category: Server Syntax) */ 50f13107a45926fa51c6eed7141192597077003d06carll#define DCBTST_OPCODE 31 51f13107a45926fa51c6eed7141192597077003d06carll#define DCBTST_XO 246 52f13107a45926fa51c6eed7141192597077003d06carll#define DCBTST_RES 0 53f13107a45926fa51c6eed7141192597077003d06carll#define DCBTST_S(RA, RB, TH) X20(DCBTST_OPCODE, TH, RA, RB, DCBTST_XO, DCBTST_RES) 54f13107a45926fa51c6eed7141192597077003d06carll#define ASM_DCBTST(RA, RB, TH) __asm__ __volatile__ (DCBTST_S(RA, RB, TH)) 55f13107a45926fa51c6eed7141192597077003d06carll 56f13107a45926fa51c6eed7141192597077003d06carll#endif /* OPCODES_H */ 57