⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ppc_isa.h

📁 基于LWVCL开发的库
💻 H
📖 第 1 页 / 共 3 页
字号:
#ifndef _ppc_isa_h_#define _ppc_isa_h_#ifndef ppc_op_debug#define ppc_op_ctxt 0#define ppc_op_debug(x) 0#endiftypedef unsigned long ppc_code_t;enum {	PPC_R0,	PPC_R1,	PPC_R2,	PPC_R3,	PPC_R4,	PPC_R5,	PPC_R6,	PPC_R7,	PPC_R8,	PPC_R9,	PPC_R10,	PPC_R11,	PPC_R12,	PPC_R13,	PPC_R14,	PPC_R15,	PPC_R16,	PPC_R17,	PPC_R18,	PPC_R19,	PPC_R20,	PPC_R21,	PPC_R22,	PPC_R23,	PPC_R24,	PPC_R25,	PPC_R26,	PPC_R27,	PPC_R28,	PPC_R29,	PPC_R30,	PPC_R31,};enum {	PPC_FPR = 31,	PPC_FPR0,	PPC_FPR1,	PPC_FPR2,	PPC_FPR3,	PPC_FPR4,	PPC_FPR5,	PPC_FPR6,	PPC_FPR7,	PPC_FPR8,	PPC_FPR9,	PPC_FPR10,	PPC_FPR11,	PPC_FPR12,	PPC_FPR13,	PPC_FPR14,	PPC_FPR15,	PPC_FPR16,	PPC_FPR17,	PPC_FPR18,	PPC_FPR19,	PPC_FPR20,	PPC_FPR21,	PPC_FPR22,	PPC_FPR23,	PPC_FPR24,	PPC_FPR25,	PPC_FPR26,	PPC_FPR27,	PPC_FPR28,	PPC_FPR29,	PPC_FPR30,	PPC_FPR31,};#define PPC_RSP PPC_R1#define PPC_RTOC PPC_R2#define PPC_RARG0 PPC_R3#define PPC_RARG1 PPC_R4#define PPC_RARG2 PPC_R5#define PPC_RARG3 PPC_R6#define PPC_RARG4 PPC_R7#define PPC_RARG5 PPC_R8#define PPC_RARG6 PPC_R9#define PPC_RARG7 PPC_R10#define PPC_RCONST_POOL PPC_R31#define PPC_RFUNCTION_BASE PPC_R31#define PPC_RRET PPC_R3#define PPC_RRETHI PPC_R3#define PPC_RRETLO PPC_R4#define PPC_FPRARG0 PPC_FPR1#define PPC_FPRARG1 PPC_FPR2#define PPC_FPRARG2 PPC_FPR3#define PPC_FPRARG3 PPC_FPR4#define PPC_FPRARG4 PPC_FPR5#define PPC_FPRARG5 PPC_FPR6#define PPC_FPRARG6 PPC_FPR7#define PPC_FPRARG7 PPC_FPR8#define PPC_FPRARG8 PPC_FPR9#define PPC_FPRARG9 PPC_FPR10#define PPC_FPRARG10 PPC_FPR11#define PPC_FPRARG11 PPC_FPR12#define PPC_FPRARG12 PPC_FPR13#define PPC_FPRRET PPC_FPR1#define PPC_FPRRETHI PPC_FPR1#define PPC_FPRRETLO PPC_FPR2#define PPC_BD_OFFSET 2UL#define PPC_BD_MASK (0x3fffUL << PPC_BD_OFFSET)#define PPC_SET_BD(x) \	(((x) & 0x3fff) << PPC_BD_OFFSET)#define PPC_GET_BD(x) \	(((x) >> PPC_BD_OFFSET) & 0x3fff)#define PPC_BI_OFFSET 16UL#define PPC_BI_MASK (0x1fUL << PPC_BI_OFFSET)#define PPC_SET_BI(x) \	(((x) & 0x1f) << PPC_BI_OFFSET)#define PPC_GET_BI(x) \	(((x) >> PPC_BI_OFFSET) & 0x1f)#define PPC_BO_OFFSET 21UL#define PPC_BO_MASK (0x1fUL << PPC_BO_OFFSET)#define PPC_SET_BO(x) \	(((x) & 0x1f) << PPC_BO_OFFSET)#define PPC_GET_BO(x) \	(((x) >> PPC_BO_OFFSET) & 0x1f)#define PPC_CRBA_OFFSET 16UL#define PPC_CRBA_MASK (0x1fUL << PPC_CRBA_OFFSET)#define PPC_SET_CRBA(x) \	(((x) & 0x1f) << PPC_CRBA_OFFSET)#define PPC_GET_CRBA(x) \	(((x) >> PPC_CRBA_OFFSET) & 0x1f)#define PPC_CRBB_OFFSET 11UL#define PPC_CRBB_MASK (0x1fUL << PPC_CRBB_OFFSET)#define PPC_SET_CRBB(x) \	(((x) & 0x1f) << PPC_CRBB_OFFSET)#define PPC_GET_CRBB(x) \	(((x) >> PPC_CRBB_OFFSET) & 0x1f)#define PPC_CRBD_OFFSET 21UL#define PPC_CRBD_MASK (0x1fUL << PPC_CRBD_OFFSET)#define PPC_SET_CRBD(x) \	(((x) & 0x1f) << PPC_CRBD_OFFSET)#define PPC_GET_CRBD(x) \	(((x) >> PPC_CRBD_OFFSET) & 0x1f)#define PPC_CRFD_OFFSET 23UL#define PPC_CRFD_MASK (0x7UL << PPC_CRFD_OFFSET)#define PPC_SET_CRFD(x) \	(((x) & 0x7) << PPC_CRFD_OFFSET)#define PPC_GET_CRFD(x) \	(((x) >> PPC_CRFD_OFFSET) & 0x7)#define PPC_CRFS_OFFSET 18UL#define PPC_CRFS_MASK (0x7UL << PPC_CRFS_OFFSET)#define PPC_SET_CRFS(x) \	(((x) & 0x7) << PPC_CRFS_OFFSET)#define PPC_GET_CRFS(x) \	(((x) >> PPC_CRFS_OFFSET) & 0x7)#define PPC_CRM_OFFSET 12UL#define PPC_CRM_MASK (0xffUL << PPC_CRM_OFFSET)#define PPC_SET_CRM(x) \	(((x) & 0xff) << PPC_CRM_OFFSET)#define PPC_GET_CRM(x) \	(((x) >> PPC_CRM_OFFSET) & 0xff)#define PPC_D_OFFSET 0UL#define PPC_D_MASK (0xffffUL << PPC_D_OFFSET)#define PPC_SET_D(x) \	(((x) & 0xffff) << PPC_D_OFFSET)#define PPC_GET_D(x) \	(((x) >> PPC_D_OFFSET) & 0xffff)#define PPC_FM_OFFSET 17UL#define PPC_FM_MASK (0xffUL << PPC_FM_OFFSET)#define PPC_SET_FM(x) \	(((x) & 0xff) << PPC_FM_OFFSET)#define PPC_GET_FM(x) \	(((x) >> PPC_FM_OFFSET) & 0xff)#define PPC_FRA_OFFSET 16UL#define PPC_FRA_MASK (0x1fUL << PPC_FRA_OFFSET)#define PPC_SET_FRA(x) \	(((x) & 0x1f) << PPC_FRA_OFFSET)#define PPC_GET_FRA(x) \	(((x) >> PPC_FRA_OFFSET) & 0x1f)#define PPC_FRB_OFFSET 11UL#define PPC_FRB_MASK (0x1fUL << PPC_FRB_OFFSET)#define PPC_SET_FRB(x) \	(((x) & 0x1f) << PPC_FRB_OFFSET)#define PPC_GET_FRB(x) \	(((x) >> PPC_FRB_OFFSET) & 0x1f)#define PPC_FRC_OFFSET 6UL#define PPC_FRC_MASK (0x1fUL << PPC_FRC_OFFSET)#define PPC_SET_FRC(x) \	(((x) & 0x1f) << PPC_FRC_OFFSET)#define PPC_GET_FRC(x) \	(((x) >> PPC_FRC_OFFSET) & 0x1f)#define PPC_FRD_OFFSET 21UL#define PPC_FRD_MASK (0x1fUL << PPC_FRD_OFFSET)#define PPC_SET_FRD(x) \	(((x) & 0x1f) << PPC_FRD_OFFSET)#define PPC_GET_FRD(x) \	(((x) >> PPC_FRD_OFFSET) & 0x1f)#define PPC_FRS_OFFSET 21UL#define PPC_FRS_MASK (0x1fUL << PPC_FRS_OFFSET)#define PPC_SET_FRS(x) \	(((x) & 0x1f) << PPC_FRS_OFFSET)#define PPC_GET_FRS(x) \	(((x) >> PPC_FRS_OFFSET) & 0x1f)#define PPC_IMM_OFFSET 12UL#define PPC_IMM_MASK (0xfUL << PPC_IMM_OFFSET)#define PPC_SET_IMM(x) \	(((x) & 0xf) << PPC_IMM_OFFSET)#define PPC_GET_IMM(x) \	(((x) >> PPC_IMM_OFFSET) & 0xf)#define PPC_LI_OFFSET 2UL#define PPC_LI_MASK (0xffffffUL << PPC_LI_OFFSET)#define PPC_SET_LI(x) \	(((x) & 0xffffff) << PPC_LI_OFFSET)#define PPC_GET_LI(x) \	(((x) >> PPC_LI_OFFSET) & 0xffffff)#define PPC_MB_OFFSET 6UL#define PPC_MB_MASK (0x1fUL << PPC_MB_OFFSET)#define PPC_SET_MB(x) \	(((x) & 0x1f) << PPC_MB_OFFSET)#define PPC_GET_MB(x) \	(((x) >> PPC_MB_OFFSET) & 0x1f)#define PPC_ME_OFFSET 1UL#define PPC_ME_MASK (0x1fUL << PPC_ME_OFFSET)#define PPC_SET_ME(x) \	(((x) & 0x1f) << PPC_ME_OFFSET)#define PPC_GET_ME(x) \	(((x) >> PPC_ME_OFFSET) & 0x1f)#define PPC_NB_OFFSET 11UL#define PPC_NB_MASK (0x1fUL << PPC_NB_OFFSET)#define PPC_SET_NB(x) \	(((x) & 0x1f) << PPC_NB_OFFSET)#define PPC_GET_NB(x) \	(((x) >> PPC_NB_OFFSET) & 0x1f)#define PPC_OPCD_OFFSET 26UL#define PPC_OPCD_MASK (0x3fUL << PPC_OPCD_OFFSET)#define PPC_SET_OPCD(x) \	(((x) & 0x3f) << PPC_OPCD_OFFSET)#define PPC_GET_OPCD(x) \	(((x) >> PPC_OPCD_OFFSET) & 0x3f)#define PPC_RA_OFFSET 16UL#define PPC_RA_MASK (0x1fUL << PPC_RA_OFFSET)#define PPC_SET_RA(x) \	(((x) & 0x1f) << PPC_RA_OFFSET)#define PPC_GET_RA(x) \	(((x) >> PPC_RA_OFFSET) & 0x1f)#define PPC_RB_OFFSET 11UL#define PPC_RB_MASK (0x1fUL << PPC_RB_OFFSET)#define PPC_SET_RB(x) \	(((x) & 0x1f) << PPC_RB_OFFSET)#define PPC_GET_RB(x) \	(((x) >> PPC_RB_OFFSET) & 0x1f)#define PPC_RD_OFFSET 21UL#define PPC_RD_MASK (0x1fUL << PPC_RD_OFFSET)#define PPC_SET_RD(x) \	(((x) & 0x1f) << PPC_RD_OFFSET)#define PPC_GET_RD(x) \	(((x) >> PPC_RD_OFFSET) & 0x1f)#define PPC_RS_OFFSET 21UL#define PPC_RS_MASK (0x1fUL << PPC_RS_OFFSET)#define PPC_SET_RS(x) \	(((x) & 0x1f) << PPC_RS_OFFSET)#define PPC_GET_RS(x) \	(((x) >> PPC_RS_OFFSET) & 0x1f)#define PPC_SH_OFFSET 11UL#define PPC_SH_MASK (0x1fUL << PPC_SH_OFFSET)#define PPC_SET_SH(x) \	(((x) & 0x1f) << PPC_SH_OFFSET)#define PPC_GET_SH(x) \	(((x) >> PPC_SH_OFFSET) & 0x1f)#define PPC_SIMM_OFFSET 0UL#define PPC_SIMM_MASK (0xffffUL << PPC_SIMM_OFFSET)#define PPC_SET_SIMM(x) \	(((x) & 0xffff) << PPC_SIMM_OFFSET)#define PPC_GET_SIMM(x) \	(((x) >> PPC_SIMM_OFFSET) & 0xffff)#define PPC_SR_OFFSET 16UL#define PPC_SR_MASK (0xfUL << PPC_SR_OFFSET)#define PPC_SET_SR(x) \	(((x) & 0xf) << PPC_SR_OFFSET)#define PPC_GET_SR(x) \	(((x) >> PPC_SR_OFFSET) & 0xf)#define PPC_TO_OFFSET 21UL#define PPC_TO_MASK (0x1fUL << PPC_TO_OFFSET)#define PPC_SET_TO(x) \	(((x) & 0x1f) << PPC_TO_OFFSET)#define PPC_GET_TO(x) \	(((x) >> PPC_TO_OFFSET) & 0x1f)#define PPC_UIMM_OFFSET 0UL#define PPC_UIMM_MASK (0xffffUL << PPC_UIMM_OFFSET)#define PPC_SET_UIMM(x) \	(((x) & 0xffff) << PPC_UIMM_OFFSET)#define PPC_GET_UIMM(x) \	(((x) >> PPC_UIMM_OFFSET) & 0xffff)#define PPC_AA_OFFSET 1UL#define PPC_OPTION_AA (1L << 1)#define PPC_L_OFFSET 21UL#define PPC_OPTION_L (1L << 21)#define PPC_LK_OFFSET 0UL#define PPC_OPTION_LK (1L << 0)#define PPC_OE_OFFSET 10UL#define PPC_OPTION_OE (1L << 10)#define PPC_RC_OFFSET 0UL#define PPC_OPTION_RC (1L << 0)#define PPC_RES31_OFFSET 0UL#define PPC_OPTION_RES31 (1L << 0)#define PPC_BO_DECR_NE_FALSE(y) (0x0 | !!(y))#define PPC_BO_DECR_EQ_FALSE(y) (0x2 | !!(y))#define PPC_BO_FALSE(y) (0x4 | !!(y))#define PPC_BO_DECR_NE_TRUE(y) (0x8 | !!(y))#define PPC_BO_DECR_EQ_TRUE(y) (0xa | !!(y))#define PPC_BO_TRUE(y) (0xc | !!(y))#define PPC_BO_DECR_NE(y) (0x10 | !!(y))#define PPC_BO_DECR_EQ(y) (0x12 | !!(y))#define PPC_BO_ALWAYS 0x14#define PPC_BI_LT 0x0#define PPC_BI_GT 0x1#define PPC_BI_EQ 0x2#define PPC_BI_SO 0x3#define PPC_BI_CR_0 0x0#define PPC_BI_CR_1 0x4#define PPC_BI_CR_2 0x8#define PPC_CR_0 0x0#define PPC_CR_1 0x1#define PPC_CR_2 0x2#define PPC_CR_3 0x3#define PPC_CR_4 0x4#define PPC_CR_5 0x5#define PPC_CR_6 0x6#define PPC_CR_7 0x7#define PPC_SPR_XER 0x1#define PPC_SPR_LR 0x8#define PPC_SPR_CTR 0x9// rd = ra + rb#define ppc_op_add(rd, ra, rb) \	((void)ppc_op_debug((ppc_op_ctxt, "%s:add rd(%d) ra(%d) rb(%d) ", __FUNCTION__, rd, ra, rb)), \	 (PPC_SET_OPCD(31) | \	  PPC_SET_RD(rd) | \	  PPC_SET_RA(ra) | \	  PPC_SET_RB(rb) | \	  (266UL << 1)))#define ppc_op_addc(rd, ra, rb) \	((void)ppc_op_debug((ppc_op_ctxt, "%s:addc rd(%d) ra(%d) rb(%d) ", __FUNCTION__, rd, ra, rb)), \	 (PPC_SET_OPCD(31) | \	  PPC_SET_RD(rd) | \	  PPC_SET_RA(ra) | \	  PPC_SET_RB(rb) | \	  (10UL << 1)))#define ppc_op_adde(rd, ra, rb) \	((void)ppc_op_debug((ppc_op_ctxt, "%s:adde rd(%d) ra(%d) rb(%d) ", __FUNCTION__, rd, ra, rb)), \	 (PPC_SET_OPCD(31) | \	  PPC_SET_RD(rd) | \	  PPC_SET_RA(ra) | \	  PPC_SET_RB(rb) | \	  (138UL << 1)))#define ppc_op_addi(rd, ra, simm) \	((void)ppc_op_debug((ppc_op_ctxt, "%s:addi rd(%d) ra(%d) simm(%d) ", __FUNCTION__, rd, ra, simm)), \	 (PPC_SET_OPCD(14) | \	  PPC_SET_RD(rd) | \	  PPC_SET_RA(ra) | \	  PPC_SET_SIMM(simm)))#define ppc_op_addic(rd, ra, simm) \	((void)ppc_op_debug((ppc_op_ctxt, "%s:addic rd(%d) ra(%d) simm(%d) ", __FUNCTION__, rd, ra, simm)), \	 (PPC_SET_OPCD(12) | \	  PPC_SET_RD(rd) | \	  PPC_SET_RA(ra) | \	  PPC_SET_SIMM(simm)))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -