Skip to content

Commit 1144ef4

Browse files
author
noone
committed
Clean up some last discrepancies
1 parent 9341079 commit 1144ef4

File tree

4 files changed

+83
-4
lines changed

4 files changed

+83
-4
lines changed

arch/powerpc/decode/decode.c

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,8 +2139,14 @@ static InstructionId Decode0x13(uint32_t word32, uint32_t decodeFlags)
21392139
case 0x102:
21402140
return PPC_ID_CRANDC;
21412141

2142+
case 0x124:
2143+
if ((word32 & 0x03fff000) != 0)
2144+
return PPC_ID_INVALID;
2145+
2146+
return PPC_ID_RFEBB;
2147+
21422148
case 0x12c:
2143-
if ((word32 & 0x3fff800) != 0)
2149+
if ((word32 & 0x03fff800) != 0)
21442150
return PPC_ID_INVALID;
21452151

21462152
return PPC_ID_ISYNC;
@@ -2157,15 +2163,33 @@ static InstructionId Decode0x13(uint32_t word32, uint32_t decodeFlags)
21572163
case 0x202:
21582164
return PPC_ID_CRAND;
21592165

2166+
case 0x224:
2167+
if ((word32 & 0x03fff801) != 0)
2168+
return PPC_ID_INVALID;
2169+
2170+
return PPC_ID_HRFID;
2171+
21602172
case 0x242:
21612173
if (d == a && d == b)
21622174
return PPC_ID_CRSET;
21632175
else
21642176
return PPC_ID_CREQV;
21652177

2178+
case 0x2e4:
2179+
if ((word32 & 0x03fff801) != 0)
2180+
return PPC_ID_INVALID;
2181+
2182+
return PPC_ID_STOP;
2183+
21662184
case 0x342:
21672185
return PPC_ID_CRORC;
21682186

2187+
case 0x364:
2188+
if ((word32 & 0x03fff801) != 0)
2189+
return PPC_ID_INVALID;
2190+
2191+
return PPC_ID_NAP;
2192+
21692193
case 0x382:
21702194
if (a == b)
21712195
return PPC_ID_CRMOVE;
@@ -3407,7 +3431,7 @@ static InstructionId Decode0x1F(uint32_t word32, uint32_t decodeFlags)
34073431
return PPC_ID_VSX_STXSSPX;
34083432

34093433
case 0x51d:
3410-
if ((word32 & 0x03eff800) != 0)
3434+
if ((word32 & 0x01dff800) != 0)
34113435
return PPC_ID_INVALID;
34123436

34133437
return PPC_ID_TBEGIN;
@@ -3829,6 +3853,22 @@ static InstructionId Decode0x1F(uint32_t word32, uint32_t decodeFlags)
38293853
return true;
38303854
}
38313855

3856+
static InstructionId DecodeVsx0x39(uint32_t word32, uint32_t flags)
3857+
{
3858+
uint32_t subop = word32 & 0x3;
3859+
switch (subop)
3860+
{
3861+
case 2:
3862+
return PPC_ID_VSX_LXSD;
3863+
3864+
case 3:
3865+
return PPC_ID_VSX_LXSSP;
3866+
3867+
default:
3868+
return PPC_ID_INVALID;
3869+
}
3870+
}
3871+
38323872
static InstructionId Decode0x3B(uint32_t word32, uint32_t flags)
38333873
{
38343874
uint32_t a = GetA(word32);
@@ -5717,6 +5757,12 @@ static InstructionId Decode32(uint32_t word32, uint32_t decodeFlags)
57175757
case 0x37:
57185758
return PPC_ID_STFDU;
57195759

5760+
case 0x39:
5761+
if ((decodeFlags & DECODE_FLAGS_VSX) != 0)
5762+
return DecodeVsx0x39(word32, decodeFlags);
5763+
else
5764+
return PPC_ID_INVALID;
5765+
57205766
case 0x3a:
57215767
if ((decodeFlags & DECODE_FLAGS_PPC64) == 0)
57225768
return PPC_ID_INVALID;

arch/powerpc/decode/decode.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ extern "C" {
467467
PPC_ID_FSUBSx,
468468
PPC_ID_FTDIV,
469469
PPC_ID_FTSQRT,
470+
PPC_ID_HRFID,
470471
PPC_ID_ICBI,
471472
PPC_ID_ICBIEP,
472473
PPC_ID_ICBLC,
@@ -619,6 +620,7 @@ extern "C" {
619620
PPC_ID_MULLDx,
620621
PPC_ID_MULLI,
621622
PPC_ID_MULLWx,
623+
PPC_ID_NAP,
622624
PPC_ID_NANDx,
623625
PPC_ID_NEGx,
624626
PPC_ID_NOP,
@@ -634,6 +636,7 @@ extern "C" {
634636
PPC_ID_PTESYNC,
635637
PPC_ID_RFCI,
636638
PPC_ID_RFDI,
639+
PPC_ID_RFEBB,
637640
PPC_ID_RFI,
638641
PPC_ID_RFID,
639642
PPC_ID_RFMCI,
@@ -706,6 +709,7 @@ extern "C" {
706709
PPC_ID_STHUX,
707710
PPC_ID_STHX,
708711
PPC_ID_STMW,
712+
PPC_ID_STOP,
709713
PPC_ID_STSWI,
710714
PPC_ID_STSWX,
711715
PPC_ID_STW,
@@ -1089,11 +1093,13 @@ extern "C" {
10891093
PPC_ID_AV_VXOR,
10901094

10911095
// VSX instructions
1096+
PPC_ID_VSX_LXSD,
10921097
PPC_ID_VSX_LXSDX,
10931098
PPC_ID_VSX_LXSIBZX,
10941099
PPC_ID_VSX_LXSIHZX,
10951100
PPC_ID_VSX_LXSIWAX,
10961101
PPC_ID_VSX_LXSIWZX,
1102+
PPC_ID_VSX_LXSSP,
10971103
PPC_ID_VSX_LXSSPX,
10981104
PPC_ID_VSX_LXV,
10991105
PPC_ID_VSX_LXVB16X,

arch/powerpc/decode/mnemonic.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ const char* GetMnemonic(const Instruction* instruction)
708708
case PPC_ID_FSUBSx: return RcMnemonic(instruction, SubMnemFSUBSx);
709709
case PPC_ID_FTDIV: return "ftdiv";
710710
case PPC_ID_FTSQRT: return "ftsqrt";
711+
case PPC_ID_HRFID: return "hrfid";
711712
case PPC_ID_ICBI: return "icbi";
712713
case PPC_ID_ICBIEP: return "icbiep";
713714
case PPC_ID_ICBLC: return "icblc";
@@ -852,6 +853,7 @@ const char* GetMnemonic(const Instruction* instruction)
852853
case PPC_ID_MULLDx: return OeRcMnemonic(instruction, SubMnemMULLDx);
853854
case PPC_ID_MULLWx: return OeRcMnemonic(instruction, SubMnemMULLWx);
854855
case PPC_ID_NANDx: return RcMnemonic(instruction, SubMnemNANDx);
856+
case PPC_ID_NAP: return "nap";
855857
case PPC_ID_NEGx: return OeRcMnemonic(instruction, SubMnemNEGx);
856858
case PPC_ID_NOP: return "nop";
857859
case PPC_ID_NORx: return RcMnemonic(instruction, SubMnemNORx);
@@ -866,6 +868,7 @@ const char* GetMnemonic(const Instruction* instruction)
866868
case PPC_ID_PTESYNC: return "ptesync";
867869
case PPC_ID_RFCI: return "rfci";
868870
case PPC_ID_RFDI: return "rfdi";
871+
case PPC_ID_RFEBB: return "rfebb";
869872
case PPC_ID_RFI: return "rfi";
870873
case PPC_ID_RFID: return "rfid";
871874
case PPC_ID_RFMCI: return "rfmci";
@@ -938,6 +941,7 @@ const char* GetMnemonic(const Instruction* instruction)
938941
case PPC_ID_STHUX: return "sthux";
939942
case PPC_ID_STHX: return "sthx";
940943
case PPC_ID_STMW: return "stmw";
944+
case PPC_ID_STOP: return "stop";
941945
case PPC_ID_STSWI: return "stswi";
942946
case PPC_ID_STSWX: return "stswx";
943947
case PPC_ID_STW: return "stw";
@@ -1319,11 +1323,13 @@ const char* GetMnemonic(const Instruction* instruction)
13191323
case PPC_ID_AV_VUPKLSW: return "vupklsw";
13201324
case PPC_ID_AV_VXOR: return "vxor";
13211325

1326+
case PPC_ID_VSX_LXSD: return "lxsd";
13221327
case PPC_ID_VSX_LXSDX: return "lxsdx";
13231328
case PPC_ID_VSX_LXSIBZX: return "lxsibzx";
13241329
case PPC_ID_VSX_LXSIHZX: return "lxsihzx";
13251330
case PPC_ID_VSX_LXSIWAX: return "lxsiwax";
13261331
case PPC_ID_VSX_LXSIWZX: return "lxsiwzx";
1332+
case PPC_ID_VSX_LXSSP: return "lxssp";
13271333
case PPC_ID_VSX_LXSSPX: return "lxsspx";
13281334
case PPC_ID_VSX_LXV: return "lxv";
13291335
case PPC_ID_VSX_LXVB16X: return "lxvb16x";

arch/powerpc/decode/operands.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ static void PushVsxS(Instruction* instruction, uint32_t word32, VsxWidth width)
280280
VsxVr((sx << 5) | s));
281281
}
282282

283+
static void PushVsxHiS(Instruction* instruction, uint32_t word32)
284+
{
285+
PushRegister(instruction, PPC_OP_REG_VSX_RS, VsxVrHi(GetS(word32)));
286+
}
287+
283288
static void PushAltivecVA(Instruction* instruction, uint32_t word32)
284289
{
285290
uint32_t va = (word32 >> 16) & 0x1f;
@@ -318,17 +323,20 @@ void FillOperands32(Instruction* instruction, uint32_t word32, uint64_t address)
318323
case PPC_ID_ATTN:
319324
case PPC_ID_CP_ABORT:
320325
case PPC_ID_DCCCI:
326+
case PPC_ID_HRFID:
321327
case PPC_ID_ICCCI:
322328
case PPC_ID_ISYNC:
323329
case PPC_ID_LWSYNC:
324330
case PPC_ID_MSGSYNC:
331+
case PPC_ID_NAP:
325332
case PPC_ID_NOP:
326333
case PPC_ID_PTESYNC:
327334
case PPC_ID_RFCI:
328335
case PPC_ID_RFDI:
329336
case PPC_ID_RFI:
330337
case PPC_ID_RFID:
331338
case PPC_ID_RFMCI:
339+
case PPC_ID_STOP:
332340
case PPC_ID_SYNC:
333341
case PPC_ID_TLBIA:
334342
case PPC_ID_TLBSYNC:
@@ -1488,6 +1496,10 @@ void FillOperands32(Instruction* instruction, uint32_t word32, uint64_t address)
14881496
PushRB(instruction, word32);
14891497
break;
14901498

1499+
case PPC_ID_RFEBB:
1500+
PushUIMMValue(instruction, (word32 >> 11) & 0x1);
1501+
break;
1502+
14911503
case PPC_ID_RLWIMIx:
14921504
case PPC_ID_RLWINMx:
14931505
PushRA(instruction, word32);
@@ -2389,6 +2401,16 @@ void FillOperands32(Instruction* instruction, uint32_t word32, uint64_t address)
23892401
PushUIMMValue(instruction, (word32 >> 16) & 0xf);
23902402
break;
23912403

2404+
case PPC_ID_VSX_LXSD:
2405+
case PPC_ID_VSX_LXSSP:
2406+
{
2407+
PushVsxHiD(instruction, word32);
2408+
2409+
int32_t ds = (int32_t)((int16_t)(word32 & 0xfffc));
2410+
PushMem(instruction, PPC_OP_MEM_RA, Gpr(GetA(word32)), ds);
2411+
break;
2412+
}
2413+
23922414
case PPC_ID_VSX_LXV:
23932415
{
23942416
uint32_t dx = (word32 >> 3) & 0x1;
@@ -2420,8 +2442,7 @@ void FillOperands32(Instruction* instruction, uint32_t word32, uint64_t address)
24202442
case PPC_ID_VSX_STXSD:
24212443
case PPC_ID_VSX_STXSSP:
24222444
{
2423-
uint32_t xs = GetS(word32) + 32;
2424-
PushRegister(instruction, PPC_OP_REG_VSX_RS, VsxVr(xs));
2445+
PushVsxHiS(instruction, word32);
24252446

24262447
int32_t ds = (int32_t)((int16_t)(word32 & 0xfffc));
24272448
PushMem(instruction, PPC_OP_MEM_RA, Gpr(GetA(word32)), ds);

0 commit comments

Comments
 (0)