ppcopcodes: partial fix for XER[CA] updates.

This commit is contained in:
Maxim Poliakovski 2019-07-17 17:40:19 +02:00
parent 9685be3154
commit fc26660f11

View File

@ -168,7 +168,7 @@ void ppc_changecrf0(uint32_t set_result){
//Affects the XER register's Carry Bit
void ppc_carry(uint32_t a, uint32_t b){
if (b > ~a){
if (b < a){ // TODO: ensure it works everywhere
ppc_state.ppc_spr[1] |= 0x20000000;
}
else{
@ -384,9 +384,9 @@ void ppc_addcodot(){
void ppc_adde(){
ppc_grab_regsdab();
uint32_t grab_xer = ppc_state.ppc_spr[1] & 0x20000000;
ppc_result_d = ppc_result_a + ppc_result_b + grab_xer;
if (((grab_xer != 0) && (grab_xer > (~(ppc_result_b + ppc_result_a)))) || (ppc_result_d > ~ppc_result_a)){
uint32_t xer_ca = !!(ppc_state.ppc_spr[1] & 0x20000000);
ppc_result_d = ppc_result_a + ppc_result_b + xer_ca;
if ((ppc_result_d < ppc_result_a) || (xer_ca && (ppc_result_d == ppc_result_a))){
ppc_state.ppc_spr[1] |= 0x20000000;
}
else{
@ -646,7 +646,7 @@ void ppc_subfic(){
ppc_grab_regsdasimm();
not_this = ~ppc_result_a;
ppc_result_d = not_this + simm + 1;
if (ppc_result_d < (not_this + 1)){
if (ppc_result_d <= not_this) {
ppc_state.ppc_spr[1] |= 0x20000000;
}
else{