Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRTE / TRTRE fix - endian issue #529

Merged
merged 2 commits into from
Dec 1, 2022

Conversation

JamesWekel
Copy link
Contributor

Fish,

Here is my proposed fix for the big-endian issue. I've also made one other small fix for a potential page cross on the initial MADDRL address lookup for the operand argument.

Jim

Copy link
Member

@Fish-Git Fish-Git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comment in the GitHub Issues thread:

You need to fix your other CSWAP16 bugs that are causing Sparc to crash.

@Fish-Git
Copy link
Member

Fish-Git commented Dec 1, 2022

FYI:  Here's (hopefully!) the Sparc fix:

--- hyperion-TRTE-Fix-1/general2.c	2022-11-30 16:03:32.508006500 -0800
+++ hyperion-TRTE-Fix-0/general2.c	2022-11-30 15:59:26.721574900 -0800
@@ -3258,9 +3258,7 @@
                 arg_ch  =  (temp_h << 8) | temp_l;
             }
             else
-            {
-                arg_ch = CSWAP16( *(U16*) buf_main_addr );
-            }
+                arg_ch = fetch_hw( buf_main_addr );
         }
         else
         {
@@ -3290,7 +3288,10 @@
                     fc      =  (temp_h << 8) | temp_l;
                 }
                 else
-                    fc =  CSWAP16( *(U16*) (fct_main_page_addr[ fc_page_no - fct_page_no ] + (fc_addr & PAGEFRAME_BYTEMASK)));
+                {
+                    BYTE* fct_main = fct_main_page_addr[ fc_page_no - fct_page_no ] + (fc_addr & PAGEFRAME_BYTEMASK);
+                    fc = fetch_hw( fct_main );
+                }
             }
             else
             {

@JamesWekel
Copy link
Contributor Author

JamesWekel commented Dec 1, 2022

Fish,

As I was already building a big-endian U16 across a page boundary, I thought the code read better just continuing building the U16 value on the 'else' block.

As for copying the FC Table, I was trying to avoid that because the table could be 128 KB.

Hope this works on the Sparc 64. I've never worked on this hardware platform so understanding that there was an alignment issue with CSWAP16 was way beyond my pay grade. Still learning.  :-)

Jim

Copy link
Member

@Fish-Git Fish-Git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Pull Request accepted!

@Fish-Git Fish-Git merged commit c926d83 into SDL-Hercules-390:develop Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants