2019-07-02 02:15:33 +00:00
|
|
|
//DingusPPC - Prototype 5bf2
|
2019-10-16 04:15:12 +00:00
|
|
|
//Written by divingkatae and maximum
|
|
|
|
//(c)2018-20 (theweirdo) spatium
|
2019-07-02 02:15:33 +00:00
|
|
|
//Please ask for permission
|
|
|
|
//if you want to distribute this.
|
|
|
|
//(divingkatae#1017 on Discord)
|
|
|
|
|
|
|
|
// The Power-specific opcodes for the processor - ppcopcodes.cpp
|
|
|
|
// Any shared opcodes are in ppcopcodes.cpp
|
|
|
|
|
2020-02-25 02:50:52 +00:00
|
|
|
#include <thirdparty/loguru.hpp>
|
2019-07-02 02:15:33 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <array>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdexcept>
|
2019-12-27 19:10:36 +00:00
|
|
|
#include "ppcemu.h"
|
2019-12-27 19:00:53 +00:00
|
|
|
#include "ppcmmu.h"
|
2019-07-02 02:15:33 +00:00
|
|
|
#include <cmath>
|
|
|
|
#include <limits>
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_abs() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsda();
|
2020-01-26 02:30:55 +00:00
|
|
|
if (ppc_result_a == 0x80000000) {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ppc_result_a;
|
|
|
|
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ppc_result_a & 0x7FFFFFFF;
|
|
|
|
}
|
|
|
|
ppc_store_result_regd();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_absdot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsda();
|
2020-01-26 02:30:55 +00:00
|
|
|
if (ppc_result_a == 0x80000000) {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ppc_result_a;
|
|
|
|
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ppc_result_a & 0x7FFFFFFF;
|
|
|
|
}
|
|
|
|
ppc_changecrf0(ppc_result_d);
|
|
|
|
ppc_store_result_regd();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_abso() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsda();
|
2020-01-26 02:30:55 +00:00
|
|
|
if (ppc_result_a == 0x80000000) {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ppc_result_a;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::XER] |= 0x40000000;
|
2019-07-02 02:15:33 +00:00
|
|
|
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ppc_result_a & 0x7FFFFFFF;
|
|
|
|
}
|
|
|
|
ppc_store_result_regd();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_absodot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsda();
|
2020-01-26 02:30:55 +00:00
|
|
|
if (ppc_result_a == 0x80000000) {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ppc_result_a;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::XER] |= 0x40000000;
|
2019-07-02 02:15:33 +00:00
|
|
|
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ppc_result_a & 0x7FFFFFFF;
|
|
|
|
}
|
|
|
|
ppc_changecrf0(ppc_result_d);
|
|
|
|
ppc_store_result_regd();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_clcs() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsda();
|
2020-01-26 02:30:55 +00:00
|
|
|
switch (reg_a) {
|
|
|
|
case 12:
|
|
|
|
case 13:
|
|
|
|
case 14:
|
|
|
|
case 15:
|
|
|
|
ppc_result_d = 65535;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ppc_result_d = 0;
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
ppc_store_result_regd();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_clcsdot() {
|
|
|
|
switch (reg_a) {
|
|
|
|
case 12:
|
|
|
|
case 13:
|
|
|
|
case 14:
|
|
|
|
case 15:
|
|
|
|
ppc_result_d = 65535;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ppc_result_d = 0;
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
ppc_changecrf0(ppc_result_d);
|
|
|
|
printf("Does RC do anything here? (TODO) \n");
|
|
|
|
ppc_store_result_regd();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_div() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsdab();
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_result_d = (ppc_result_a | ppc_state.ppc_spr[SPR::MQ]) / ppc_result_b;
|
|
|
|
ppc_state.ppc_spr[SPR::MQ] = (ppc_result_a | ppc_state.ppc_spr[SPR::MQ]) % ppc_result_b;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_store_result_regd();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_divdot() {
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_result_d = (ppc_result_a | ppc_state.ppc_spr[SPR::MQ]) / ppc_result_b;
|
|
|
|
ppc_state.ppc_spr[SPR::MQ] = (ppc_result_a | ppc_state.ppc_spr[SPR::MQ]) % ppc_result_b;
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_divo() {
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_result_d = (ppc_result_a | ppc_state.ppc_spr[SPR::MQ]) / ppc_result_b;
|
|
|
|
ppc_state.ppc_spr[SPR::MQ] = (ppc_result_a | ppc_state.ppc_spr[SPR::MQ]) % ppc_result_b;
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_divodot() {
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_result_d = (ppc_result_a | ppc_state.ppc_spr[SPR::MQ]) / ppc_result_b;
|
|
|
|
ppc_state.ppc_spr[SPR::MQ] = (ppc_result_a | ppc_state.ppc_spr[SPR::MQ]) % ppc_result_b;
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_divs() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsdab();
|
|
|
|
ppc_result_d = ppc_result_a / ppc_result_b;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = (ppc_result_a % ppc_result_b);
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_store_result_regd();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_divsdot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ppc_result_a / ppc_result_b;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = (ppc_result_a % ppc_result_b);
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_divso() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ppc_result_a / ppc_result_b;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = (ppc_result_a % ppc_result_b);
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_divsodot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ppc_result_a / ppc_result_b;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = (ppc_result_a % ppc_result_b);
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_doz() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsdab();
|
2020-01-26 02:30:55 +00:00
|
|
|
if (((int32_t)ppc_result_a) > ((int32_t)ppc_result_b)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = 0;
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ~ppc_result_a + ppc_result_b + 1;
|
|
|
|
}
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_dozdot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsdab();
|
2020-01-26 02:30:55 +00:00
|
|
|
if (((int32_t)ppc_result_a) > ((int32_t)ppc_result_b)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = 0;
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ~ppc_result_a + ppc_result_b + 1;
|
|
|
|
}
|
|
|
|
ppc_changecrf0(ppc_result_d);
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_dozo() {
|
|
|
|
if (((int32_t)ppc_result_a) > ((int32_t)ppc_result_b)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = 0;
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ~ppc_result_a + ppc_result_b + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_dozodot() {
|
|
|
|
if (((int32_t)ppc_result_a) > ((int32_t)ppc_result_b)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = 0;
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ~ppc_result_a + ppc_result_b + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_dozi() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsdab();
|
2020-01-26 02:30:55 +00:00
|
|
|
if (((int32_t)ppc_result_a) > simm) {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = 0;
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = ~ppc_result_a + simm + 1;
|
|
|
|
}
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_lscbx() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsdab();
|
|
|
|
uint32_t bytes_copied = 0;
|
|
|
|
bool match_found = false;
|
|
|
|
uint32_t shift_amount = 0;
|
2020-01-27 00:36:22 +00:00
|
|
|
uint8_t return_value;
|
2020-01-28 03:39:23 +00:00
|
|
|
uint8_t byte_compared = (uint8_t)((ppc_state.ppc_spr[SPR::XER] & 0xFF00) >> 8);
|
|
|
|
if ((ppc_state.ppc_spr[SPR::XER] & 0x7f) == 0) {
|
2019-07-02 02:15:33 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-01-28 03:39:23 +00:00
|
|
|
uint32_t bytes_to_load = (ppc_state.ppc_spr[SPR::XER] & 0x7f) + 1;
|
2020-01-26 02:30:55 +00:00
|
|
|
ppc_effective_address = (reg_a == 0) ? ppc_result_b : ppc_result_a + ppc_result_b;
|
|
|
|
do {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_effective_address++;
|
|
|
|
bytes_to_load--;
|
2020-01-26 02:30:55 +00:00
|
|
|
if (match_found == false) {
|
|
|
|
switch (shift_amount) {
|
|
|
|
case 0:
|
2020-01-27 00:36:22 +00:00
|
|
|
return_value = mem_grab_byte(ppc_effective_address);
|
|
|
|
ppc_result_d = (ppc_result_d & 0x00FFFFFF) | (return_value << 24);
|
2020-01-26 02:30:55 +00:00
|
|
|
ppc_store_result_regd();
|
|
|
|
break;
|
|
|
|
case 1:
|
2020-01-27 00:36:22 +00:00
|
|
|
return_value = mem_grab_byte(ppc_effective_address);
|
|
|
|
ppc_result_d = (ppc_result_d & 0xFF00FFFF) | (return_value << 16);
|
2020-01-26 02:30:55 +00:00
|
|
|
ppc_store_result_regd();
|
|
|
|
break;
|
|
|
|
case 2:
|
2020-01-27 00:36:22 +00:00
|
|
|
return_value = mem_grab_byte(ppc_effective_address);
|
|
|
|
ppc_result_d = (ppc_result_d & 0xFFFF00FF) | (return_value << 8);
|
2020-01-26 02:30:55 +00:00
|
|
|
ppc_store_result_regd();
|
|
|
|
break;
|
|
|
|
case 3:
|
2020-01-27 00:36:22 +00:00
|
|
|
return_value = mem_grab_byte(ppc_effective_address);
|
|
|
|
ppc_result_d = (ppc_result_d & 0xFFFFFF00) | return_value;
|
2020-01-26 02:30:55 +00:00
|
|
|
ppc_store_result_regd();
|
|
|
|
break;
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bytes_copied++;
|
|
|
|
}
|
2020-01-27 00:36:22 +00:00
|
|
|
if (return_value == byte_compared) {
|
2019-07-02 02:15:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
if (shift_amount == 3) {
|
2019-07-02 02:15:33 +00:00
|
|
|
shift_amount = 0;
|
|
|
|
reg_d = (reg_d + 1) & 0x1F;
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
shift_amount++;
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
} while (bytes_to_load > 0);
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::XER] = (ppc_state.ppc_spr[SPR::XER] & 0xFFFFFF80) | bytes_copied;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_store_result_regd();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_lscbxdot() {
|
|
|
|
printf("OOPS! Placeholder!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_maskg() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssab();
|
|
|
|
uint32_t mask_start = ppc_result_d & 31;
|
|
|
|
uint32_t mask_end = ppc_result_b & 31;
|
|
|
|
uint32_t insert_mask = 0;
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
if (mask_start < (mask_end + 1)) {
|
|
|
|
for (uint32_t i = mask_start; i < mask_end; i++) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (0x80000000 >> i);
|
|
|
|
}
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else if (mask_start == (mask_end + 1)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask = 0xFFFFFFFF;
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask = 0xFFFFFFFF;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = (mask_end + 1); i < (mask_start - 1); i++) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask &= (~(0x80000000 >> i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc_result_a = insert_mask;
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_maskgdot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssab();
|
|
|
|
uint32_t mask_start = ppc_result_d & 31;
|
|
|
|
uint32_t mask_end = ppc_result_b & 31;
|
|
|
|
uint32_t insert_mask = 0;
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
if (mask_start < (mask_end + 1)) {
|
|
|
|
for (uint32_t i = mask_start; i < mask_end; i++) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (0x80000000 >> i);
|
|
|
|
}
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else if (mask_start == (mask_end + 1)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask = 0xFFFFFFFF;
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask = 0xFFFFFFFF;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = (mask_end + 1); i < (mask_start - 1); i++) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask &= (~(0x80000000 >> i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc_result_a = insert_mask;
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_maskir() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssab();
|
|
|
|
uint32_t mask_insert = ppc_result_a;
|
|
|
|
uint32_t insert_rot = 0x80000000;
|
2020-01-26 02:30:55 +00:00
|
|
|
do {
|
|
|
|
if (ppc_result_b & insert_rot) {
|
2019-07-02 02:15:33 +00:00
|
|
|
mask_insert &= ~insert_rot;
|
|
|
|
mask_insert |= (ppc_result_d & insert_rot);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
insert_rot = insert_rot >> 1;
|
|
|
|
} while (insert_rot > 0);
|
2019-07-02 02:15:33 +00:00
|
|
|
|
|
|
|
ppc_result_a = (ppc_result_d & ppc_result_b);
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_maskirdot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssab();
|
|
|
|
uint32_t mask_insert = ppc_result_a;
|
|
|
|
uint32_t insert_rot = 0x80000000;
|
2020-01-26 02:30:55 +00:00
|
|
|
do {
|
|
|
|
if (ppc_result_b & insert_rot) {
|
2019-07-02 02:15:33 +00:00
|
|
|
mask_insert &= ~insert_rot;
|
|
|
|
mask_insert |= (ppc_result_d & insert_rot);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
insert_rot = insert_rot >> 1;
|
|
|
|
} while (insert_rot > 0);
|
2019-07-02 02:15:33 +00:00
|
|
|
|
|
|
|
ppc_result_a = (ppc_result_d & ppc_result_b);
|
|
|
|
ppc_changecrf0(ppc_result_a);
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_mul() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsdab();
|
|
|
|
uint64_t product;
|
|
|
|
|
|
|
|
product = ((uint64_t)ppc_result_a) * ((uint64_t)ppc_result_b);
|
|
|
|
ppc_result_d = ((uint32_t)(product >> 32));
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = ((uint32_t)(product));
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_store_result_regd();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_muldot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsdab();
|
|
|
|
uint64_t product;
|
|
|
|
|
|
|
|
product = ((uint64_t)ppc_result_a) * ((uint64_t)ppc_result_b);
|
|
|
|
ppc_result_d = ((uint32_t)(product >> 32));
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = ((uint32_t)(product));
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_changecrf0(ppc_result_d);
|
|
|
|
ppc_store_result_regd();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_mulo() {
|
2019-07-02 02:15:33 +00:00
|
|
|
uint64_t product;
|
|
|
|
|
|
|
|
product = ((uint64_t)ppc_result_a) * ((uint64_t)ppc_result_b);
|
|
|
|
ppc_result_d = ((uint32_t)(product >> 32));
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = ((uint32_t)(product));
|
2019-07-02 02:15:33 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_mulodot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
uint64_t product;
|
|
|
|
|
|
|
|
product = ((uint64_t)ppc_result_a) * ((uint64_t)ppc_result_b);
|
|
|
|
ppc_result_d = ((uint32_t)(product >> 32));
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = ((uint32_t)(product));
|
2019-07-02 02:15:33 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_nabs() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regsda();
|
|
|
|
ppc_result_d = (0x80000000 | ppc_result_a);
|
|
|
|
ppc_store_result_regd();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_nabsdot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = (0x80000000 | ppc_result_a);
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_nabso() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = (0x80000000 | ppc_result_a);
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_nabsodot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_d = (0x80000000 | ppc_result_a);
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_rlmi() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssab();
|
2019-08-05 16:42:15 +00:00
|
|
|
unsigned rot_mb = (ppc_cur_instruction >> 6) & 31;
|
|
|
|
unsigned rot_me = (ppc_cur_instruction >> 1) & 31;
|
2019-07-02 02:15:33 +00:00
|
|
|
uint32_t rot_amt = ppc_result_b & 31;
|
|
|
|
uint32_t insert_mask = 0;
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
if (rot_mb < (rot_me + 1)) {
|
|
|
|
for (uint32_t i = rot_mb; i < rot_me; i++) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (0x80000000 >> i);
|
|
|
|
}
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else if (rot_mb == (rot_me + 1)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask = 0xFFFFFFFF;
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask = 0xFFFFFFFF;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = (rot_me + 1); i < (rot_mb - 1); i++) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask &= (~(0x80000000 >> i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t step2 = (ppc_result_d << rot_amt) | (ppc_result_d >> rot_amt);
|
|
|
|
ppc_result_a = step2 & insert_mask;
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_rrib() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssab();
|
2020-01-26 02:30:55 +00:00
|
|
|
if (ppc_result_d & 0x80000000) {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_a |= (0x80000000 >> ppc_result_b);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_a &= ~(0x80000000 >> ppc_result_b);
|
|
|
|
}
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_rribdot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssab();
|
2020-01-26 02:30:55 +00:00
|
|
|
if (ppc_result_d & 0x80000000) {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_a |= (0x80000000 >> ppc_result_b);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
else {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_a &= ~(0x80000000 >> ppc_result_b);
|
|
|
|
}
|
|
|
|
ppc_changecrf0(ppc_result_a);
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sle() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
|
|
|
uint32_t rot_amt = ppc_result_b & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_amt; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
|
|
|
uint32_t insert_final = ((ppc_result_d << rot_amt) | (ppc_result_d >> (32 - rot_amt)));
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_final & insert_mask;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_a = insert_final & insert_mask;
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sledot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
|
|
|
uint32_t rot_amt = ppc_result_b & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_amt; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
|
|
|
uint32_t insert_final = ((ppc_result_d << rot_amt) | (ppc_result_d >> (32 - rot_amt)));
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_final & insert_mask;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_a = insert_final & insert_mask;
|
|
|
|
ppc_changecrf0(ppc_result_a);
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sleq() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
|
|
|
uint32_t rot_amt = ppc_result_b & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_amt; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
uint32_t insert_start = ((ppc_result_d << rot_amt) | (ppc_result_d >> (rot_amt - 31)));
|
2020-01-28 03:39:23 +00:00
|
|
|
uint32_t insert_end = ppc_state.ppc_spr[SPR::MQ];
|
2019-07-02 02:15:33 +00:00
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
for (int i = 0; i < 32; i++) {
|
|
|
|
if (insert_mask & (1 << i)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_end &= ~(1 << i);
|
|
|
|
insert_end |= (insert_start & (1 << i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc_result_a = insert_end;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_start;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sleqdot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
|
|
|
uint32_t rot_amt = ppc_result_b & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_amt; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
uint32_t insert_start = ((ppc_result_d << rot_amt) | (ppc_result_d >> (rot_amt - 31)));
|
2020-01-28 03:39:23 +00:00
|
|
|
uint32_t insert_end = ppc_state.ppc_spr[SPR::MQ];
|
2019-07-02 02:15:33 +00:00
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
for (int i = 0; i < 32; i++) {
|
|
|
|
if (insert_mask & (1 << i)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_end &= ~(1 << i);
|
|
|
|
insert_end |= (insert_start & (1 << i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc_result_a = insert_end;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_start;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_changecrf0(ppc_result_a);
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sliq() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
2019-08-05 16:42:15 +00:00
|
|
|
unsigned rot_sh = (ppc_cur_instruction >> 11) & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_sh; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
uint32_t insert_start = ((ppc_result_d << rot_sh) | (ppc_result_d >> (rot_sh - 31)));
|
2020-01-28 03:39:23 +00:00
|
|
|
uint32_t insert_end = ppc_state.ppc_spr[SPR::MQ];
|
2019-07-02 02:15:33 +00:00
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
for (int i = 0; i < 32; i++) {
|
|
|
|
if (insert_mask & (1 << i)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_end &= ~(1 << i);
|
|
|
|
insert_end |= (insert_start & (1 << i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc_result_a = insert_end & insert_mask;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_start;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sliqdot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
2019-08-05 16:42:15 +00:00
|
|
|
unsigned rot_sh = (ppc_cur_instruction >> 11) & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_sh; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
uint32_t insert_start = ((ppc_result_d << rot_sh) | (ppc_result_d >> (rot_sh - 31)));
|
2020-01-28 03:39:23 +00:00
|
|
|
uint32_t insert_end = ppc_state.ppc_spr[SPR::MQ];
|
2019-07-02 02:15:33 +00:00
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
for (int i = 0; i < 32; i++) {
|
|
|
|
if (insert_mask & (1 << i)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_end &= ~(1 << i);
|
|
|
|
insert_end |= (insert_start & (1 << i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc_result_a = insert_end & insert_mask;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_start;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_changecrf0(ppc_result_a);
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_slliq() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
2019-08-05 16:42:15 +00:00
|
|
|
unsigned rot_sh = (ppc_cur_instruction >> 11) & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_sh; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
uint32_t insert_start = ((ppc_result_d << rot_sh) | (ppc_result_d >> (32 - rot_sh)));
|
2020-01-28 03:39:23 +00:00
|
|
|
uint32_t insert_end = ppc_state.ppc_spr[SPR::MQ];
|
2019-07-02 02:15:33 +00:00
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
for (int i = 0; i < 32; i++) {
|
|
|
|
if (insert_mask & (1 << i)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_end &= ~(1 << i);
|
|
|
|
insert_end |= (insert_start & (1 << i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc_result_a = insert_end;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_start;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_slliqdot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
2019-08-05 16:42:15 +00:00
|
|
|
unsigned rot_sh = (ppc_cur_instruction >> 11) & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_sh; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
uint32_t insert_start = ((ppc_result_d << rot_sh) | (ppc_result_d >> (32 - rot_sh)));
|
2020-01-28 03:39:23 +00:00
|
|
|
uint32_t insert_end = ppc_state.ppc_spr[SPR::MQ];
|
2019-07-02 02:15:33 +00:00
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
for (int i = 0; i < 32; i++) {
|
|
|
|
if (insert_mask & (1 << i)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_end &= ~(1 << i);
|
|
|
|
insert_end |= (insert_start & (1 << i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc_result_a = insert_end;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_start;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_changecrf0(ppc_result_a);
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sllq() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for sllq!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sllqdot() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for sllq.!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_slq() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for slq!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_slqdot() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for slq.!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sraiq() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for sraiq!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sraiqdot() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for sraiq.!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sraq() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for sraq!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sraqdot() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for sraq.!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sre() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
|
|
|
uint32_t rot_amt = ppc_result_b & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_amt; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
|
|
|
uint32_t insert_final = ((ppc_result_d >> rot_amt) | (ppc_result_d << (32 - rot_amt)));
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_final & insert_mask;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_a = insert_final;
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sredot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
|
|
|
uint32_t rot_amt = ppc_result_b & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_amt; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
|
|
|
uint32_t insert_final = ((ppc_result_d >> rot_amt) | (ppc_result_d << (32 - rot_amt)));
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_final & insert_mask;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_result_a = insert_final;
|
|
|
|
ppc_changecrf0(ppc_result_a);
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_srea() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for srea!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sreadot() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for srea.!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sreq() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
2019-08-05 16:42:15 +00:00
|
|
|
unsigned rot_sh = ppc_result_b & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_sh; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
uint32_t insert_start = ((ppc_result_d >> rot_sh) | (ppc_result_d << (32 - rot_sh)));
|
2020-01-28 03:39:23 +00:00
|
|
|
uint32_t insert_end = ppc_state.ppc_spr[SPR::MQ];
|
2019-07-02 02:15:33 +00:00
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
for (int i = 0; i < 32; i++) {
|
|
|
|
if (insert_mask & (1 << i)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_end &= ~(1 << i);
|
|
|
|
insert_end |= (insert_start & (1 << i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc_result_a = insert_end;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_start;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sreqdot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
2019-08-05 16:42:15 +00:00
|
|
|
unsigned rot_sh = ppc_result_b & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_sh; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
uint32_t insert_start = ((ppc_result_d >> rot_sh) | (ppc_result_d << (32 - rot_sh)));
|
2020-01-28 03:39:23 +00:00
|
|
|
uint32_t insert_end = ppc_state.ppc_spr[SPR::MQ];
|
2019-07-02 02:15:33 +00:00
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
for (int i = 0; i < 32; i++) {
|
|
|
|
if (insert_mask & (1 << i)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_end &= ~(1 << i);
|
|
|
|
insert_end |= (insert_start & (1 << i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc_result_a = insert_end;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_start;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_changecrf0(ppc_result_a);
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sriq() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
2019-08-05 16:42:15 +00:00
|
|
|
unsigned rot_sh = (ppc_cur_instruction >> 11) & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_sh; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
uint32_t insert_start = ((ppc_result_d >> rot_sh) | (ppc_result_d << (32 - rot_sh)));
|
2020-01-28 03:39:23 +00:00
|
|
|
uint32_t insert_end = ppc_state.ppc_spr[SPR::MQ];
|
2019-07-02 02:15:33 +00:00
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
for (int i = 0; i < 32; i++) {
|
|
|
|
if (insert_mask & (1 << i)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_end &= ~(1 << i);
|
|
|
|
insert_end |= (insert_start & (1 << i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc_result_a = insert_end;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_start;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_sriqdot() {
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_grab_regssa();
|
|
|
|
uint32_t insert_mask = 0;
|
2019-08-05 16:42:15 +00:00
|
|
|
unsigned rot_sh = (ppc_cur_instruction >> 11) & 31;
|
2020-01-26 02:30:55 +00:00
|
|
|
for (uint32_t i = 31; i > rot_sh; i--) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_mask |= (1 << i);
|
|
|
|
}
|
2020-01-26 02:30:55 +00:00
|
|
|
uint32_t insert_start = ((ppc_result_d >> rot_sh) | (ppc_result_d << (32 - rot_sh)));
|
2020-01-28 03:39:23 +00:00
|
|
|
uint32_t insert_end = ppc_state.ppc_spr[SPR::MQ];
|
2019-07-02 02:15:33 +00:00
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
for (int i = 0; i < 32; i++) {
|
|
|
|
if (insert_mask & (1 << i)) {
|
2019-07-02 02:15:33 +00:00
|
|
|
insert_end &= ~(1 << i);
|
|
|
|
insert_end |= (insert_start & (1 << i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc_result_a = insert_end;
|
2020-01-28 03:39:23 +00:00
|
|
|
ppc_state.ppc_spr[SPR::MQ] = insert_start;
|
2019-07-02 02:15:33 +00:00
|
|
|
ppc_changecrf0(ppc_result_a);
|
|
|
|
ppc_store_result_rega();
|
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_srliq() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for slriq!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_srliqdot() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for slriq.!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_srlq() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for slrq!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_srlqdot() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for slrq.!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_srq() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for srq!!! \n");
|
2019-07-02 02:15:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 02:30:55 +00:00
|
|
|
void power_srqdot() {
|
2020-02-25 02:50:52 +00:00
|
|
|
LOG_F(WARNING, "OOPS! Placeholder for srq.!!! \n");
|
2020-02-04 13:20:10 +00:00
|
|
|
}
|