forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[PSP] prxtool fix reloc count and code end point

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> Patch Submissions
View previous topic :: View next topic  
Author Message
coyotebean



Joined: 05 Dec 2009
Posts: 26

PostPosted: Thu Jan 21, 2010 3:39 pm    Post subject: [PSP] prxtool fix reloc count and code end point Reply with quote

Fix error in reloc counting and changes the calculation of the m_StubBottom (end of text section)


Code:
Index: prxtool-2459-fix/ProcessPrx.C
===================================================================
--- prxtool-2459-fix/ProcessPrx.C   (revision 2459)
+++ prxtool-2459-fix/ProcessPrx.C   (working copy)
@@ -192,10 +192,6 @@
             funcAddr += 8;
          }
          
-         if (funcAddr > m_stubBottom) {
-            m_stubBottom = funcAddr;
-         }
-
          for(iLoop = 0; iLoop < pLib->v_count; iLoop++)
          {
             u32 varFixup;
@@ -272,7 +268,6 @@
 
    imp_base = m_modInfo.info.imports;
    imp_end =  m_modInfo.info.imp_end;
-   m_stubBottom = 0;
 
    if(imp_base != 0)
    {
@@ -304,9 +299,6 @@
       }
    }
 
-   m_stubBottom += 4;
-   COutput::Printf(LEVEL_DEBUG, "Stub bottom 0x%08X\n", m_stubBottom);
-
    return blRet;
 }
 
@@ -497,6 +489,8 @@
       m_modInfo.info.exp_end = LW(m_modInfo.info.exp_end);
       m_modInfo.info.imports = LW(m_modInfo.info.imports);
       m_modInfo.info.imp_end = LW(m_modInfo.info.imp_end);
+      m_stubBottom = m_modInfo.info.exports - 4; // ".lib.ent.top"
+      COutput::Printf(LEVEL_DEBUG, "Stub bottom 0x%08X\n", m_stubBottom);
       blRet = true;
 
       if(COutput::GetDebug())
@@ -641,13 +635,28 @@
                return 0;
             }
             part1 = block1[temp];
-            pos += (part1 & 0x06);
-            if ((part1 & 0x01) != 0) {
-               if (part1 & 0x38 == 0x10) {
+            if ( (part1 & 0x01) == 0 ) {
+               if ( ( part1 & 0x06 ) == 4 ) {
+                  pos += 4;
+               }
+            }
+            else {
+               switch (part1 & 0x06) {
+               case 2:
                   pos += 2;
-               } else if (part1 & 0x38 == 0x18) {
+                  break;
+               case 4:
                   pos += 4;
+                  break;
                }
+               switch (part1 & 0x38) {
+               case 0x10:
+                  pos += 2;
+                  break;
+               case 0x18:
+                  pos += 4;
+                  break;
+               }
             }
             iRelocCount++;
          }


Last edited by coyotebean on Thu Jan 21, 2010 5:19 pm; edited 2 times in total
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Thu Jan 21, 2010 4:19 pm    Post subject: Reply with quote

please use unified diff format ("diff -u") or just do a "svn diff"
Back to top
View user's profile Send private message
coyotebean



Joined: 05 Dec 2009
Posts: 26

PostPosted: Thu Jan 21, 2010 5:18 pm    Post subject: Reply with quote

code updated ^_^
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> Patch Submissions All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group