diff --git a/mach/powerpc/as/mach1.c b/mach/powerpc/as/mach1.c index 8cf9ca282..c1651fcfe 100644 --- a/mach/powerpc/as/mach1.c +++ b/mach/powerpc/as/mach1.c @@ -5,5 +5,5 @@ #include -extern quad emit_ha(struct expr_t* expr, bool is_signed); +extern quad emit_hi(struct expr_t* expr, bool is_signed); extern quad emit_lo(struct expr_t* expr); diff --git a/mach/powerpc/as/mach2.c b/mach/powerpc/as/mach2.c index f64d148cd..3ecaf10cf 100644 --- a/mach/powerpc/as/mach2.c +++ b/mach/powerpc/as/mach2.c @@ -85,7 +85,7 @@ %token OP_LI32 %token OP_POWERPC_FIXUP -%token OP_HA OP_HAS OP_LO +%token OP_HI OP_HA OP_LO /* Other token types */ diff --git a/mach/powerpc/as/mach3.c b/mach/powerpc/as/mach3.c index 74415aa9f..724ba7312 100644 --- a/mach/powerpc/as/mach3.c +++ b/mach/powerpc/as/mach3.c @@ -102,8 +102,8 @@ 0, OP_LA, 0, "la", 0, OP_LA, 0, "li", 0, OP_RS_RA_RA_C, 31<<26 | 444<<1, "mr", -0, OP_HA, 0, "ha16", -0, OP_HAS, 0, "has16", +0, OP_HI, 0, "hi16", +0, OP_HA, 0, "ha16", 0, OP_LO, 0, "lo16", /* Branch processor instructions (page 20) */ diff --git a/mach/powerpc/as/mach4.c b/mach/powerpc/as/mach4.c index bb6f5163b..1ad180de4 100644 --- a/mach/powerpc/as/mach4.c +++ b/mach/powerpc/as/mach4.c @@ -75,8 +75,8 @@ e16 serror("16-bit value out of range"); $$ = (uint16_t) $1; } - | OP_HA ASC_LPAR expr ASC_RPAR { $$ = emit_ha(&$3, false); } - | OP_HAS ASC_LPAR expr ASC_RPAR { $$ = emit_ha(&$3, true); } + | OP_HI ASC_LPAR expr ASC_RPAR { $$ = emit_hi(&$3, false); } + | OP_HA ASC_LPAR expr ASC_RPAR { $$ = emit_hi(&$3, true); } | OP_LO ASC_LPAR expr ASC_RPAR { $$ = emit_lo(&$3); } ; diff --git a/mach/powerpc/as/mach5.c b/mach/powerpc/as/mach5.c index a8e4cd043..e3e23f272 100644 --- a/mach/powerpc/as/mach5.c +++ b/mach/powerpc/as/mach5.c @@ -1,5 +1,5 @@ -quad emit_ha(struct expr_t* expr, bool is_signed) +quad emit_hi(struct expr_t* expr, bool is_signed) { /* If this is a symbol reference, discard the symbol and keep only the * offset part. */ diff --git a/mach/powerpc/ncg/table b/mach/powerpc/ncg/table index d37bed8f0..d3d2fcbf4 100644 --- a/mach/powerpc/ncg/table +++ b/mach/powerpc/ncg/table @@ -175,8 +175,8 @@ TOKENS /* Primitives */ LABEL = { ADDR adr; } 4 adr. + LABEL_OFFSET_HI = { ADDR adr; } 4 "hi16[" adr "]". LABEL_OFFSET_HA = { ADDR adr; } 4 "ha16[" adr "]". - LABEL_OFFSET_HAS = { ADDR adr; } 4 "has16[" adr "]". LABEL_OFFSET_LO = { ADDR adr; } 4 "lo16[" adr "]". LOCAL = { INT off; } 4. @@ -286,7 +286,7 @@ INSTRUCTIONS add GPR:wo, GPR:ro, GPR:ro. addX "add." GPR:wo, GPR:ro, GPR:ro. addi GPR:wo, GPR:ro, CONST:ro. - addis GPR:wo, GPR:ro, CONST+LABEL_OFFSET_HA+LABEL_OFFSET_HAS:ro. + addis GPR:wo, GPR:ro, CONST+LABEL_OFFSET_HI+LABEL_OFFSET_HA:ro. and GPR:wo, GPR:ro, GPR:ro. andc GPR:wo, GPR:ro, GPR:ro. andiX "andi." GPR:wo:cc, GPR:ro, CONST:ro. @@ -408,7 +408,7 @@ MOVES from LABEL to GPR gen COMMENT("move LABEL->GPR") - addis %2, R0, {LABEL_OFFSET_HA, %1.adr} + addis %2, R0, {LABEL_OFFSET_HI, %1.adr} ori %2, %2, {LABEL_OFFSET_LO, %1.adr} /* Sign extension */ @@ -1149,7 +1149,7 @@ PATTERNS with LABEL uses REG gen - addis %a, R0, {LABEL_OFFSET_HAS, %1.adr} + addis %a, R0, {LABEL_OFFSET_HA, %1.adr} lwz %a, {GPRINDIRECT_OFFSET_LO, %a, %1.adr} yields %a with GPR diff --git a/util/led/relocate.c b/util/led/relocate.c index 613a0afa7..7e2f9db10 100644 --- a/util/led/relocate.c +++ b/util/led/relocate.c @@ -297,6 +297,7 @@ static void put_powerpc_valu(char* addr, uint32_t value, uint16_t type) else if (((opcode1 & 0xfc1f0000) == 0x3c000000) && ((opcode2 & 0xfc000000) == 0x60000000)) { + /* addis / ori instruction pair */ uint16_t hi = value >> 16; uint16_t lo = value & 0xffff;