00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235 #define opcode_Tdi 2
00236 #define opcode_Twi 3
00237 #define opcode_Mulli 7
00238 #define opcode_Subfic 8
00239 #define opcode_Cmpli 10
00240 #define opcode_Cmpi 11
00241 #define opcode_Addic 12
00242 #define opcode_Addicc 13
00243 #define opcode_Addi 14
00244 #define opcode_Addis 15
00245 #define opcode_BcLA 16
00246 #define opcode_Sc 17
00247 #define opcode_BLA 18
00248 #define opcode_Mcrf 19
00249 #define opcode_BclrL 19
00250 #define opcode_Rfid 19
00251 #define opcode_Crnor 19
00252 #define opcode_Crandc 19
00253 #define opcode_Isync 19
00254 #define opcode_Crxor 19
00255 #define opcode_Crnand 19
00256 #define opcode_Crand 19
00257 #define opcode_Creqv 19
00258 #define opcode_Crorc 19
00259 #define opcode_Cror 19
00260 #define opcode_BcctrL 19
00261 #define opcode_RlwimiC 20
00262 #define opcode_RlwinmC 21
00263 #define opcode_RlwnmC 23
00264 #define opcode_Ori 24
00265 #define opcode_Oris 25
00266 #define opcode_Xori 26
00267 #define opcode_Xoris 27
00268 #define opcode_Andic 28
00269 #define opcode_Andisc 29
00270 #define opcode_RldiclC 30
00271 #define opcode_RldicrC 30
00272 #define opcode_RldicC 30
00273 #define opcode_RldimiC 30
00274 #define opcode_RldclC 30
00275 #define opcode_RldcrC 30
00276 #define opcode_Cmp 31
00277 #define opcode_Tw 31
00278 #define opcode_SubfcOC 31
00279 #define opcode_MulhduC 31
00280 #define opcode_AddcOC 31
00281 #define opcode_MulhwuC 31
00282 #define opcode_Mfcr 31
00283 #define opcode_Mfocrf 31
00284 #define opcode_Lwarx 31
00285 #define opcode_Ldx 31
00286 #define opcode_Lwzx 31
00287 #define opcode_SlwC 31
00288 #define opcode_CntlzwC 31
00289 #define opcode_SldC 31
00290 #define opcode_AndC 31
00291 #define opcode_Cmpl 31
00292 #define opcode_SubfOC 31
00293 #define opcode_Ldux 31
00294 #define opcode_Dcbst 31
00295 #define opcode_Lwzux 31
00296 #define opcode_CntlzdC 31
00297 #define opcode_AndcC 31
00298 #define opcode_Td 31
00299 #define opcode_MulhdC 31
00300 #define opcode_MulhwC 31
00301 #define opcode_Mfmsr 31
00302 #define opcode_Ldarx 31
00303 #define opcode_Dcbf 31
00304 #define opcode_Lbzx 31
00305 #define opcode_NegOC 31
00306 #define opcode_Lbzux 31
00307 #define opcode_NorC 31
00308 #define opcode_SubfeOC 31
00309 #define opcode_AddeOC 31
00310 #define opcode_Mtcrf 31
00311 #define opcode_Mtocrf 31
00312 #define opcode_Mtmsr 31
00313 #define opcode_Stdx 31
00314 #define opcode_Stwcxc 31
00315 #define opcode_Stwx 31
00316 #define opcode_Mtmsrd 31
00317 #define opcode_Stdux 31
00318 #define opcode_Stwux 31
00319 #define opcode_SubfzeOC 31
00320 #define opcode_AddzeOC 31
00321 #define opcode_Mtsr 31
00322 #define opcode_Stdcxc 31
00323 #define opcode_Stbx 31
00324 #define opcode_SubfmeOC 31
00325 #define opcode_MulldOC 31
00326 #define opcode_AddmeOC 31
00327 #define opcode_MullwOC 31
00328 #define opcode_Mtsrin 31
00329 #define opcode_Dcbtst 31
00330 #define opcode_Stbux 31
00331 #define opcode_AddOC 31
00332 #define opcode_Dcbt 31
00333 #define opcode_Lhzx 31
00334 #define opcode_EqvC 31
00335 #define opcode_Tlbie 31
00336 #define opcode_Eciwx 31
00337 #define opcode_Lhzux 31
00338 #define opcode_XorC 31
00339 #define opcode_Mfspr 31
00340 #define opcode_Lwax 31
00341 #define opcode_Lhax 31
00342 #define opcode_Tlbia 31
00343 #define opcode_Mftb 31
00344 #define opcode_Lwaux 31
00345 #define opcode_Lhaux 31
00346 #define opcode_Slbmte 31
00347 #define opcode_Sthx 31
00348 #define opcode_OrcC 31
00349 #define opcode_SradiC 31
00350 #define opcode_Slbie 31
00351 #define opcode_Ecowx 31
00352 #define opcode_Sthux 31
00353 #define opcode_OrC 31
00354 #define opcode_DivduOC 31
00355 #define opcode_DivwuOC 31
00356 #define opcode_Mtspr 31
00357 #define opcode_NandC 31
00358 #define opcode_DivdOC 31
00359 #define opcode_DivwOC 31
00360 #define opcode_Slbia 31
00361 #define opcode_Mcrxr 31
00362 #define opcode_Lswx 31
00363 #define opcode_Lwbrx 31
00364 #define opcode_Lfsx 31
00365 #define opcode_SrwC 31
00366 #define opcode_SrdC 31
00367 #define opcode_Tlbsync 31
00368 #define opcode_Lfsux 31
00369 #define opcode_Mfsr 31
00370 #define opcode_Lswi 31
00371 #define opcode_Sync 31
00372 #define opcode_Lfdx 31
00373 #define opcode_Lfdux 31
00374 #define opcode_Mfsrin 31
00375 #define opcode_Stswx 31
00376 #define opcode_Stwbrx 31
00377 #define opcode_Stfsx 31
00378 #define opcode_Stfsux 31
00379 #define opcode_Stswi 31
00380 #define opcode_Stfdx 31
00381 #define opcode_Stfdux 31
00382 #define opcode_Lhbrx 31
00383 #define opcode_SrawC 31
00384 #define opcode_SradC 31
00385 #define opcode_SrawiC 31
00386 #define opcode_Slbmfev 31
00387 #define opcode_Eieio 31
00388 #define opcode_Slbmfee 31
00389 #define opcode_Sthbrx 31
00390 #define opcode_ExtshC 31
00391 #define opcode_ExtsbC 31
00392 #define opcode_Icbi 31
00393 #define opcode_Stfiwx 31
00394 #define opcode_ExtswC 31
00395 #define opcode_Dcbz 31
00396 #define opcode_Lwz 32
00397 #define opcode_Lwzu 33
00398 #define opcode_Lbz 34
00399 #define opcode_Lbzu 35
00400 #define opcode_Stw 36
00401 #define opcode_Stwu 37
00402 #define opcode_Stb 38
00403 #define opcode_Stbu 39
00404 #define opcode_Lhz 40
00405 #define opcode_Lhzu 41
00406 #define opcode_Lha 42
00407 #define opcode_Lhau 43
00408 #define opcode_Sth 44
00409 #define opcode_Sthu 45
00410 #define opcode_Lmw 46
00411 #define opcode_Stmw 47
00412 #define opcode_Lfs 48
00413 #define opcode_Lfsu 49
00414 #define opcode_Lfd 50
00415 #define opcode_Lfdu 51
00416 #define opcode_Stfs 52
00417 #define opcode_Stfsu 53
00418 #define opcode_Stfd 54
00419 #define opcode_Stfdu 55
00420 #define opcode_Ld 58
00421 #define opcode_Ldu 58
00422 #define opcode_Lwa 58
00423 #define opcode_FdivsC 59
00424 #define opcode_FsubsC 59
00425 #define opcode_FaddsC 59
00426 #define opcode_FsqrtsC 59
00427 #define opcode_FresC 59
00428 #define opcode_FmulsC 59
00429 #define opcode_FmsubsC 59
00430 #define opcode_FmaddsC 59
00431 #define opcode_FnmsubsC 59
00432 #define opcode_FnmaddsC 59
00433 #define opcode_Std 62
00434 #define opcode_Stdu 62
00435 #define opcode_Fcmpu 63
00436 #define opcode_FrspC 63
00437 #define opcode_FctiwC 63
00438 #define opcode_FctiwzC 63
00439 #define opcode_FdivC 63
00440 #define opcode_FsubC 63
00441 #define opcode_FaddC 63
00442 #define opcode_FsqrtC 63
00443 #define opcode_FselC 63
00444 #define opcode_FmulC 63
00445 #define opcode_FrsqrteC 63
00446 #define opcode_FmsubC 63
00447 #define opcode_FmaddC 63
00448 #define opcode_FnmsubC 63
00449 #define opcode_FnmaddC 63
00450 #define opcode_Fcmpo 63
00451 #define opcode_Mtfsb1 63
00452 #define opcode_FnegC 63
00453 #define opcode_Mcrfs 63
00454 #define opcode_Mtfsb0 63
00455 #define opcode_FmrC 63
00456 #define opcode_MtfsfiC 63
00457 #define opcode_FnabsC 63
00458 #define opcode_FabsC 63
00459 #define opcode_MffsC 63
00460 #define opcode_MtfsfC 63
00461 #define opcode_FctidC 63
00462 #define opcode_FctidzC 63
00463 #define opcode_FcfidC 63
00464
00465
00466 #define xcode_Mcrf 0
00467 #define xcode_BclrL 16
00468 #define xcode_Rfid 18
00469 #define xcode_Crnor 33
00470 #define xcode_Crandc 129
00471 #define xcode_Isync 150
00472 #define xcode_Crxor 193
00473 #define xcode_Crnand 225
00474 #define xcode_Crand 257
00475 #define xcode_Creqv 289
00476 #define xcode_Crorc 417
00477 #define xcode_Cror 449
00478 #define xcode_BcctrL 528
00479 #define xcode_Ld 0
00480 #define xcode_Ldu 1
00481 #define xcode_Lwa 2
00482 #define xcode_FdivsC 18
00483 #define xcode_FsubsC 20
00484 #define xcode_FaddsC 21
00485 #define xcode_FsqrtsC 22
00486 #define xcode_FresC 24
00487 #define xcode_FmulsC 25
00488 #define xcode_FmsubsC 28
00489 #define xcode_FmaddsC 29
00490 #define xcode_FnmsubsC 30
00491 #define xcode_FnmaddsC 31
00492 #define xcode_Std 0
00493 #define xcode_Stdu 1
00494 #define xcode_Fcmpu 0
00495 #define xcode_FrspC 12
00496 #define xcode_FctiwC 14
00497 #define xcode_FctiwzC 15
00498 #define xcode_FdivC 18
00499 #define xcode_FsubC 20
00500 #define xcode_FaddC 21
00501 #define xcode_FsqrtC 22
00502 #define xcode_FselC 23
00503 #define xcode_FmulC 25
00504 #define xcode_FrsqrteC 26
00505 #define xcode_FmsubC 28
00506 #define xcode_FmaddC 29
00507 #define xcode_FnmsubC 30
00508 #define xcode_FnmaddC 31
00509 #define xcode_Fcmpo 32
00510 #define xcode_Mtfsb1 38
00511 #define xcode_FnegC 40
00512 #define xcode_Mcrfs 64
00513 #define xcode_Mtfsb0 70
00514 #define xcode_FmrC 72
00515 #define xcode_MtfsfiC 134
00516 #define xcode_FnabsC 136
00517 #define xcode_FabsC 264
00518 #define xcode_MffsC 583
00519 #define xcode_MtfsfC 711
00520 #define xcode_FctidC 814
00521 #define xcode_FctidzC 815
00522 #define xcode_FcfidC 846
00523 #define xcode_RldiclC 0
00524 #define xcode_RldicrC 1
00525 #define xcode_RldicC 2
00526 #define xcode_RldimiC 3
00527 #define xcode_RldclC 8
00528 #define xcode_RldcrC 9
00529 #define xcode_Cmp 0
00530 #define xcode_Tw 4
00531 #define xcode_SubfcOC 8
00532 #define xcode_MulhduC 9
00533 #define xcode_AddcOC 10
00534 #define xcode_MulhwuC 11
00535 #define xcode_Mfcr 19
00536 #define xcode_Mfocrf 19
00537 #define xcode_Lwarx 20
00538 #define xcode_Ldx 21
00539 #define xcode_Lwzx 23
00540 #define xcode_SlwC 24
00541 #define xcode_CntlzwC 26
00542 #define xcode_SldC 27
00543 #define xcode_AndC 28
00544 #define xcode_Cmpl 32
00545 #define xcode_SubfOC 40
00546 #define xcode_Ldux 53
00547 #define xcode_Dcbst 54
00548 #define xcode_Lwzux 55
00549 #define xcode_CntlzdC 58
00550 #define xcode_AndcC 60
00551 #define xcode_Td 68
00552 #define xcode_MulhdC 73
00553 #define xcode_MulhwC 75
00554 #define xcode_Mfmsr 83
00555 #define xcode_Ldarx 84
00556 #define xcode_Dcbf 86
00557 #define xcode_Lbzx 87
00558 #define xcode_NegOC 104
00559 #define xcode_Lbzux 119
00560 #define xcode_NorC 124
00561 #define xcode_SubfeOC 136
00562 #define xcode_AddeOC 138
00563 #define xcode_Mtcrf 144
00564 #define xcode_Mtocrf 144
00565 #define xcode_Mtmsr 146
00566 #define xcode_Stdx 149
00567 #define xcode_Stwcxc 150
00568 #define xcode_Stwx 151
00569 #define xcode_Mtmsrd 178
00570 #define xcode_Stdux 181
00571 #define xcode_Stwux 183
00572 #define xcode_SubfzeOC 200
00573 #define xcode_AddzeOC 202
00574 #define xcode_Mtsr 210
00575 #define xcode_Stdcxc 214
00576 #define xcode_Stbx 215
00577 #define xcode_SubfmeOC 232
00578 #define xcode_MulldOC 233
00579 #define xcode_AddmeOC 234
00580 #define xcode_MullwOC 235
00581 #define xcode_Mtsrin 242
00582 #define xcode_Dcbtst 246
00583 #define xcode_Stbux 247
00584 #define xcode_AddOC 266
00585 #define xcode_LscbxC 277
00586 #define xcode_Dcbt 278
00587 #define xcode_Lhzx 279
00588 #define xcode_EqvC 284
00589 #define xcode_Tlbie 306
00590 #define xcode_Eciwx 310
00591 #define xcode_Lhzux 311
00592 #define xcode_XorC 316
00593 #define xcode_Mfspr 339
00594 #define xcode_Lwax 341
00595 #define xcode_Lhax 343
00596 #define xcode_Tlbia 370
00597 #define xcode_Mftb 371
00598 #define xcode_Lwaux 373
00599 #define xcode_Lhaux 375
00600 #define xcode_Slbmte 402
00601 #define xcode_Sthx 407
00602 #define xcode_OrcC 412
00603 #define xcode_SradiC 413
00604 #define xcode_Slbie 434
00605 #define xcode_Ecowx 438
00606 #define xcode_Sthux 439
00607 #define xcode_OrC 444
00608 #define xcode_DivduOC 457
00609 #define xcode_DivwuOC 459
00610 #define xcode_Mtspr 467
00611 #define xcode_NandC 476
00612 #define xcode_DivdOC 489
00613 #define xcode_DivwOC 491
00614 #define xcode_Slbia 498
00615 #define xcode_Mcrxr 512
00616 #define xcode_Lswx 533
00617 #define xcode_Lwbrx 534
00618 #define xcode_Lfsx 535
00619 #define xcode_SrwC 536
00620 #define xcode_SrdC 539
00621 #define xcode_Tlbsync 566
00622 #define xcode_Lfsux 567
00623 #define xcode_Mfsr 595
00624 #define xcode_Lswi 597
00625 #define xcode_Sync 598
00626 #define xcode_Lfdx 599
00627 #define xcode_Lfdux 631
00628 #define xcode_Mfsrin 659
00629 #define xcode_Stswx 661
00630 #define xcode_Stwbrx 662
00631 #define xcode_Stfsx 663
00632 #define xcode_Stfsux 695
00633 #define xcode_Stswi 725
00634 #define xcode_Stfdx 727
00635 #define xcode_Stfdux 759
00636 #define xcode_Lhbrx 790
00637 #define xcode_SrawC 792
00638 #define xcode_SradC 794
00639 #define xcode_SrawiC 824
00640 #define xcode_Slbmfev 851
00641 #define xcode_Eieio 854
00642 #define xcode_Slbmfee 915
00643 #define xcode_Sthbrx 918
00644 #define xcode_ExtshC 922
00645 #define xcode_ExtsbC 954
00646 #define xcode_Icbi 982
00647 #define xcode_Stfiwx 983
00648 #define xcode_ExtswC 986
00649 #define xcode_Dcbz 1014
00650
00651
00652 #define BRANCH_ALWAYS(__ho) (((__ho) & 0x14) == 0x14)
00653 #define IS_B(__i) ((__i).opc.opc == opcode_BLA)
00654 #define IS_BC(__i) ((__i).opc.opc == opcode_BcLA)
00655 #define IS_BCLR(__i) (((__i).opc.opc == opcode_BclrL) && ((__i).xl.xo == xcode_BclrL))
00656 #define IS_BCCTR(__i) (((__i).opc.opc == opcode_BcctrL) && ((__i).xl.xo == xcode_BcctrL))
00657 #define IS_CMPLI(__i) ((__i).opc.opc == opcode_Cmpli)
00658 #define IS_LWZ(__i) ((__i).opc.opc == opcode_Lwz)
00659 #define IS_LD(__i) (((__i).opc.opc == opcode_Ld) && ((__i).ds.xo == xcode_Ld))
00660 #define IS_ADD(__i) (((__i).opc.opc == opcode_AddOC) && ((__i).xo.xo == xcode_AddOC))
00661 #define IS_LDX(__i) (((__i).opc.opc == opcode_Ldx) && ((__i).x.xo == xcode_Ldx))
00662 #define IS_LWZX(__i) (((__i).opc.opc == opcode_Lwzx) && ((__i).x.xo == xcode_Lwzx))
00663 #define IS_ADDI(__i) ((__i).opc.opc == opcode_Addi)
00664 #define IS_LSWI(__i) (((__i).opc.opc == opcode_Lswi) && ((__i).x.xo == xcode_Lswi))
00665 #define IS_STSWI(__i) (((__i).opc.opc == opcode_Stswi) && ((__i).x.xo == xcode_Stswi))
00666
00667 #define GET_BH(__i) (((__i).xl.bb) & 0x3)
00668 #define REG_TOC 2
00669 #define REG_SP 1
00670 #define INVALID_REGISTER 0xffffffff
00671 #define INVALID_XOP 0x400
00672
00673 #define MEMORY_MASK 0x1c
00674 #define MEMORY_MATCH 0x14
00675 #define FOP_AFORM_MASK 0x10
00676 #define FOP_AFORM_MATCH 0x10
00677 #define FOP_CONDREG_MASK 0x1e
00678 #define FOP_CONDREG_MATCH 0x06
00679
00680 #define NUM_OF_GPR_REGS 0x20
00681 #define NUM_OF_FPR_REGS 0x20
00682 #define LAST_VOLATILE_REG 0xd
00683
00684 #define REG_XER 0x020
00685 #define REG_LNK 0x100
00686 #define REG_CTR 0x120
00687
00688 #define SAFE_FRAME_LOC 64
00689
00690 #define COMPARE_LT 0
00691 #define COMPARE_GT 1
00692 #define COMPARE_EQ 2
00693 #define COMPARE_TRUE 1
00694 #define COMPARE_FALSE 0