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 

Problem with prxtool release 245x

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



Joined: 05 Dec 2009
Posts: 26

PostPosted: Wed Jan 20, 2010 8:22 pm    Post subject: Problem with prxtool release 245x Reply with quote

Any person using prxtool release 2457/2458/2459, the version with updated reloc format?

I don't known if an issue with MinGW or prxtool, when I tried to dump files from 3.71 and above (e.g. the simple clockgen.prx), prxtool have (slightly) random crash which seems to be releated to memory. This file is using 0x700000A1 reloc format from 3.71 onwards.

my problem:
prxtool -d -s lxsir 300/clockgen.prx is fine
prxtool -d -s lxsir 371/clockgen.prx crashes
prxtool -d -s lxsir 400/clockgen.prx crashes
prxtool -d -s lxsir 500/clockgen.prx crashes

Code:

3.71 debug out...

Debug: 98: [R_MIPS_32] SW(0000083C,0000083C)
Debug: 98: addr 000007C0, target 0000083C, text 0
Debug: 99: [R_MIPS_32] SW(00000858,00000858)
Debug: 99: addr 000007D4, target 00000858, text 0
Debug: 100: [R_MIPS_32] SW(0000072C,0000072C)
Debug: 100: addr 000007BC, target 0000072C, text 0
Debug: 101: [R_MIPS_32] SW(000008FC,000008FC)
Debug: 101: addr 000007B8, target 000008FC, text 0
Debug: 102: [R_MIPS_32] SW(00000754,00000754)
Debug: 102: addr 000007E4, target 00000754, text 0
Debug: 103: [R_MIPS_32] SW(00000910,00000910)
Debug: 103: addr 000007E0, target 00000910, text 0
Debug:


Code:

4.00 debug output...

Debug: 98: [R_MIPS_32] SW(00000718,00000718)
Debug: 98: addr 000007A4, target 00000718, text 0
Debug: 99: [R_MIPS_32] SW(000008D0,000008D0)
Debug: 99: addr 000007A0, target 000008D0, text 0
Debug: 100: [R_MIPS_32] SW(00000730,00000730)
Debug: 100: addr 00000790, target 00000730, text 0
Debug: 101: [R_MIPS_32] SW(000008DC,000008DC)
Debug: 101: addr 0000078C, target 000008DC, text 0
Debug: 102: [R_MIPS_32] SW(00008050,00008950)
Debug: 102: addr 000007CC, target 00008950, text 0
Debug: 103: [R_MIPS_32] SW(00000744,00000744)
Debug: 103: addr 000007D0, target 00000744, text 0
Debug: 104: [R_MIPS_32] SW(00000764,00000764)
Debug: 104: addr 000007D4, target 00000764, text 0
Debug: 105: [R_MIPS_32] SW(0000076C,0000076C)
Debug: 105: addr 000007D8, target 0000076C, text 0
Debug: 106: [R_MIPS_32] SW(000007A8,000007A8)
Debug: 106: addr 000007DC, target 000007A8, text 0
Debug: 107: [R_MIPS_32] SW(000002D0,000002D0)
Debug: 107: addr 00000838, target 000002D0, text 0
Debug: 108: [R_MIPS_32] SW(0000


Code:

5.00 debug output...

Debug: 98: [R_MIPS_32] SW(00000718,00000718)
Debug: 98: addr 000007A8, target 00000718, text 0
Debug: 99: [R_MIPS_32] SW(000008D4,000008D4)
Debug: 99: addr 000007A4, target 000008D4, text 0
Debug: 100: [R_MIPS_32] SW(00000730,00000730)
Debug: 100: addr 00000794, target 00000730, text 0
Debug: 101: [R_MIPS_32] SW(000008E0,000008E0)
Debug: 101: addr 00000790, target 000008E0, text 0
Debug: 102: [R_MIPS_32] SW(00008040,00008950)
Debug: 102: addr 000007D0, target 00008950, text 0
Debug: 103: [R_MIPS_32] SW(00000744,00000744)
Debug: 103: addr 000007D4, target 00000744, text 0
Debug: 104: [R_MIPS_32] SW(00000764,00000764)
Debug: 104: addr 000007D8, target 00000764, text 0
Debug: 105: [R_MIPS_32] SW(0000076C,0000076C)
Debug: 105: addr 000007DC, target 0000076C, text 0
Debug: 106: [R_MIPS_32] SW(000007AC,000007AC)
Debug: 106: addr 000007E0, target 000007AC, text 0
Debug: 107: [R_MIPS_32] SW(000002D0,000002D0)
Debug: 107: addr 0000083C, target 000002D0, text 0
Debug: 108: [R_MIPS_32] SW(000003

Oh, just now, I tried disasm and it ran fine.
So, it maybe only some issue with serialize.
Damn, I was misled by the stupid crash

Another things is that it didn't disasm sysmem.prx properly (probably from 3.71 and above) I guess that's just a small bug in the calculation of the active "text" range.
Back to top
View user's profile Send private message
coyotebean



Joined: 05 Dec 2009
Posts: 26

PostPosted: Thu Jan 21, 2010 1:10 pm    Post subject: Reply with quote

I see, originally there was a bug in CountRelocs which causes disasm of 5.00 clockgen.prx to fail which I had fixed. So my current version disasm successfully.

Code:
Original errorneous code:

            pos += (part1 & 0x06);
            if ((part1 & 0x01) != 0) {
               if (part1 & 0x38 == 0x10) {
                  pos += 2;
               } else if (part1 & 0x38 == 0x18) {
                  pos += 4;
               }
            }

pos += (part1 & 0x06) is incorrect.


Code:
Updated code:

            if ( (part1 & 0x01) == 0 ) {
               if ( ( part1 & 0x06 ) == 4 ) {
                  pos += 4;
               }
            }
            else {
               switch (part1 & 0x06) {
               case 2:
                  pos += 2;
                  break;
               case 4:
                  pos += 4;
                  break;
               }
               switch (part1 & 0x38) {
               case 0x10:
                  pos += 2;
                  break;
               case 0x18:
                  pos += 4;
                  break;
               }
            }
Back to top
View user's profile Send private message
coyotebean



Joined: 05 Dec 2009
Posts: 26

PostPosted: Thu Jan 21, 2010 1:41 pm    Post subject: Reply with quote

A quick look review end of text section is calculated from imports, it will have problem with any file with no imports like sysmem.prx.

"ModuleInfo" is probably a good point to split code and data.
Back to top
View user's profile Send private message
coyotebean



Joined: 05 Dec 2009
Posts: 26

PostPosted: Thu Jan 21, 2010 3:15 pm    Post subject: Reply with quote

This is ".lib.ent.top" (the end of .sceSub.text) it seems

Code:
m_stubBottom = m_modInfo.info.exports - 4;
Back to top
View user's profile Send private message
coyotebean



Joined: 05 Dec 2009
Posts: 26

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

hehe~ another issue noticed (possible for 0x700000A1 relocs only)

The target of reloc type 0xE(R_MIPS_X_J26) are "lui" instrution, applying a "J26" type reloc trash the instruction.

The target of reloc type 0x2(R_MIPS_32) are "j" instrution...

The target of reloc type 0x6(R_MIPS_LO16) feels like they are meant for (R_MIPS_32)....

The action of reloc type are different between chkreg.prx/loadexec.prx and sysmem.prx/loadcore.prx in firmware 5.00 !?!?!?
Back to top
View user's profile Send private message
coyotebean



Joined: 05 Dec 2009
Posts: 26

PostPosted: Thu Jan 28, 2010 2:29 am    Post subject: Reply with quote

Some quick test indicate that 0x700000A1 was introduced with 3.70
sysmem.prx & loadcore.prx upto 6.20 seems to be using the old reloc type (possibly because it is handled by IPL so the reloc type hasn't changed)
All the order files with 0x700000A1 reloc table format use the new reloc type.
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Sat Mar 27, 2010 8:14 am    Post subject: Reply with quote

Do you use the last SVN prxtools ?

You seem to think they changed the relocation types in their kernel modules as a protection as they had the NID randomization in their kernel modules ?
Back to top
View user's profile Send private message
coyotebean



Joined: 05 Dec 2009
Posts: 26

PostPosted: Sun Mar 28, 2010 6:59 pm    Post subject: Reply with quote

The general 0x700000A1 relocation operation failed for loadcore.prx & sysmem.prx and only loadcore.prx & sysmem.prx are different.

Code:

fw 3.00 : clockgen.prx        0x700000A0

Debug:    93: CMD=0000 P1= 0 P2= 0 R_32      02 Addr 00000780 from 00000858 to 00000858
Debug:    94: CMD=0000 P1= 0 P2= 0 R_32      02 Addr 00000784 from 00000878 to 00000878
Debug:     2: CMD=0000 P1= 0 P2= 0 R_26      04 Addr 00000048 from 0C0001CF to 0C0001CF
Debug:     3: CMD=0000 P1= 0 P2= 0 R_26      04 Addr 000000AC from 0C0001CF to 0C0001CF
Debug:     4: CMD=0000 P1= 0 P2= 0 R_26      04 Addr 000000F0 from 0800001E to 0800001E
Debug:     0: CMD=0000 P1= 0 P2= 0 R_HI16    05 Addr 00000004 from 3C030000 to 3C030000
Debug:     5: CMD=0000 P1= 0 P2= 0 R_HI16    05 Addr 00000120 from 3C070000 to 3C070000
Debug:     1* CMD=0000 P1= 0 P2= 0 R_LO16    06 Addr 0000000C from 24710000 to 24710930
Debug:     6* CMD=0000 P1= 0 P2= 0 R_LO16    06 Addr 00000124 from 24E50000 to 24E50930
Debug:     8* CMD=0000 P1= 0 P2= 0 R_LO16    06 Addr 00000170 from 8CE40000 to 8CE40930

fw 3.00 : loadcore.prx        0x700000A0

Debug:   965: CMD=0000 P1= 0 P2= 0 R_32      02 Addr 00006B90 from 00006CF4 to 00006CF4
Debug:   966: CMD=0000 P1= 0 P2= 0 R_32      02 Addr 00006B94 from 00006D0C to 00006D0C
Debug:    13: CMD=0000 P1= 0 P2= 0 R_26      04 Addr 00000090 from 0C001AA1 to 0C001AA1
Debug:    14: CMD=0000 P1= 0 P2= 0 R_26      04 Addr 00000098 from 0800001B to 0800001B
Debug:     0: CMD=0000 P1= 0 P2= 0 R_HI16    05 Addr 00000000 from 3C030000 to 3C030000
Debug:     3: CMD=0000 P1= 0 P2= 0 R_HI16    05 Addr 00000030 from 3C060000 to 3C060001
Debug:     1* CMD=0000 P1= 0 P2= 0 R_LO16    06 Addr 00000004 from AC600348 to AC607A28
Debug:     2* CMD=0000 P1= 0 P2= 0 R_LO16    06 Addr 00000008 from 24670348 to 24677A28
Debug:     4* CMD=0000 P1= 0 P2= 0 R_LO16    06 Addr 00000034 from 24C50C58 to 24C58338

fw 3.00 : loadexec.prx        0x700000A0

Debug:   228: CMD=0000 P1= 0 P2= 0 R_32      02 Addr 00001BE0 from 00001E1C to 00001E1C
Debug:   229: CMD=0000 P1= 0 P2= 0 R_32      02 Addr 00001BE4 from 00001E34 to 00001E34
Debug:     3: CMD=0000 P1= 0 P2= 0 R_26      04 Addr 00000138 from 0C0006C6 to 0C0006C6
Debug:     4: CMD=0000 P1= 0 P2= 0 R_26      04 Addr 00000148 from 08000028 to 08000028
Debug:    14: CMD=0000 P1= 0 P2= 0 R_HI16    05 Addr 000003B0 from 3C010001 to 3C010001
Debug:    17: CMD=0000 P1= 0 P2= 0 R_HI16    05 Addr 000003EC from 3C010001 to 3C010001
Debug:    34* CMD=0000 P1= 0 P2= 0 R_LO16    06 Addr 000005DC from 24A52014 to 24A52014
Debug:    37* CMD=0000 P1= 0 P2= 0 R_LO16    06 Addr 000005F4 from 8E310004 to 8E312084
Debug:    43* CMD=0000 P1= 0 P2= 0 R_LO16    06 Addr 00000648 from AC20AAF0 to AC20CB70

fw 3.00 : sysmem.prx          0x700000A0

Debug:  2148: CMD=0000 P1= 0 P2= 0 R_32      02 Addr 00010ED0 from 00010FBC to 00010FBC
Debug:  2149: CMD=0000 P1= 0 P2= 0 R_32      02 Addr 00010ED4 from 00010FD4 to 00010FD4
Debug:    16: CMD=0000 P1= 0 P2= 0 R_26      04 Addr 0000015C from 0C004391 to 0C004391
Debug:    17: CMD=0000 P1= 0 P2= 0 R_26      04 Addr 00000168 from 08000041 to 08000041
Debug:     2: CMD=0000 P1= 0 P2= 0 R_HI16    05 Addr 00000058 from 3C140000 to 3C140001
Debug:    12: CMD=0000 P1= 0 P2= 0 R_HI16    05 Addr 00000130 from 3C0F0001 to 3C0F0001
Debug:     6* CMD=0000 P1= 0 P2= 0 R_LO16    06 Addr 0000007C from 8E8B0A0C to 8E8B3B8C
Debug:    11* CMD=0000 P1= 0 P2= 0 R_LO16    06 Addr 00000138 from 25C41B04 to 25C41B04

fw 5.00 : clockgen.prx        0x700000A1

Debug:    90: CMD=4053 P1= 9 P2= 2 R_32      02 Addr 00000750 from 0000082C to 0000082C
Debug:    91: CMD=0253 P1= 9 P2= 2 R_32      02 Addr 00000754 from 0000084C to 0000084C
Debug:     6: CMD=022B P1= 9 P2= 5 R_LO16    06 Addr 0000011C from 24E90000 to 24E90910
Debug:     7: CMD=2C2B P1= 9 P2= 5 R_LO16    06 Addr 00000174 from 8CE40000 to 8CE40910
Debug:     0: CMD=001A P1=17 P2= 4 X_HI16    0D Addr 00000004 from 3C030000 to 3C030000
Debug:     5: CMD=141A P1=17 P2= 4 X_HI16    0D Addr 00000118 from 3C070000 to 3C070000
Debug:     4: CMD=2244 P1= 1 P2= 6 X_J26     0E Addr 000000F0 from 0800001E to 0800001E
Debug:    14: CMD=2444 P1= 1 P2= 6 X_J26     0E Addr 00000200 from 0800005D to 0800005D
Debug:     2: CMD=1E34 P1= 1 P2= 7 X_JAL26   0F Addr 00000048 from 0C0001C8 to 0C0001C8
Debug:     3: CMD=3234 P1= 1 P2= 7 X_JAL26   0F Addr 000000AC from 0C0001C8 to 0C0001C8

fw 5.00 : loadcore.prx        0x700000A1

Debug:    17: CMD=0445 P1= 1 P2= 2 R_32      02 Addr 0000028C from 08000098 to 08000098
Debug:    27: CMD=0645 P1= 1 P2= 2 R_32      02 Addr 00000318 from 080000B9 to 080000B9
Debug:    16: CMD=0835 P1= 1 P2= 3 R_26      04 Addr 00000284 from 0C00205B to 0C00205B
Debug:    26: CMD=0835 P1= 1 P2= 3 R_26      04 Addr 0000030C from 0C002051 to 0C002051
Debug:  1258: CMD=0056 P1=11 P2= 5 R_LO16    06 Addr 00008270 from 000083C4 to 000083C4
Debug:  1259: CMD=0253 P1= 9 P2= 5 R_LO16    06 Addr 00008274 from 000083DC to 000083DC
Debug:     0: CMD=001A P1=17 P2= 6 X_J26     0E Addr 000000C8 from 3C020000 to 3C022290
Debug:     2: CMD=061A P1=17 P2= 6 X_J26     0E Addr 000000D8 from 3C020000 to 3C022290
Debug:     1: CMD=022B P1= 9 P2= 7 X_JAL26   0F Addr 000000CC from 8C420354 to 8C4225E4
Debug:     3: CMD=022B P1= 9 P2= 7 X_JAL26   0F Addr 000000DC from 24420014 to 244222A4
Debug:     5: CMD=022B P1= 9 P2= 7 X_JAL26   0F Addr 000001F8 from AC600564 to AC6027F4

fw 5.00 : loadexec_01g.prx    0x700000A1

Debug:   405: CMD=00A6 P1=11 P2= 2 R_32      02 Addr 00002FB0 from 000031FC to 000031FC
Debug:   406: CMD=04A5 P1= 9 P2= 2 R_32      02 Addr 00002FB4 from 00003214 to 00003214
Debug:    45: CMD=0495 P1= 9 P2= 5 R_LO16    06 Addr 00000DD0 from 8C849494 to 8C84CA54
Debug:    48: CMD=0495 P1= 9 P2= 5 R_LO16    06 Addr 00000DE0 from 24639494 to 2463CA54
Debug:   111: CMD=3864 P1=17 P2= 4 X_HI16    0D Addr 00001334 from 3C020000 to 3C020000
Debug:   115: CMD=3074 P1=17 P2= 4 X_HI16    0D Addr 00001374 from 3C040001 to 3C040001
Debug:     4: CMD=4422 P1= 1 P2= 6 X_J26     0E Addr 000005E8 from 08000174 to 08000174
Debug:     5: CMD=1022 P1= 1 P2= 6 X_J26     0E Addr 000005F8 from 0800023A to 0800023A
Debug:   131: CMD=4842 P1= 1 P2= 7 X_JAL26   0F Addr 00001478 from 0C000B7F to 0C000B7F
Debug:   132: CMD=4042 P1= 1 P2= 7 X_JAL26   0F Addr 000014B8 from 0C000BDD to 0C000BDD

fw 5.00 : loadexec_02g.prx    0x700000A1

Debug:   408: CMD=08A5 P1= 9 P2= 2 R_32      02 Addr 00002FC8 from 000032F8 to 000032F8
Debug:   409: CMD=0CA5 P1= 9 P2= 2 R_32      02 Addr 00002FD4 from 00003308 to 00003308
Debug:    55: CMD=0495 P1= 9 P2= 5 R_LO16    06 Addr 00000E48 from AC349510 to AC34CAD0
Debug:    62: CMD=0485 P1= 9 P2= 5 R_LO16    06 Addr 00000F54 from 24A53440 to 24A53440
Debug:    65: CMD=0495 P1= 9 P2= 5 R_LO16    06 Addr 00000F6C from 8E529500 to 8E52CAC0
Debug:    52: CMD=3474 P1=17 P2= 4 X_HI16    0D Addr 00000E3C from 3C040001 to 3C040001
Debug:    54: CMD=0474 P1=17 P2= 4 X_HI16    0D Addr 00000E44 from 3C010001 to 3C010001
Debug:     7: CMD=1022 P1= 1 P2= 6 X_J26     0E Addr 00000624 from 08000157 to 08000157
Debug:     8: CMD=1822 P1= 1 P2= 6 X_J26     0E Addr 0000063C from 08000148 to 08000148
Debug:    28: CMD=1842 P1= 1 P2= 7 X_JAL26   0F Addr 00000A5C from 0C000BB3 to 0C000BB3
Debug:    30: CMD=3C42 P1= 1 P2= 7 X_JAL26   0F Addr 00000ACC from 0C000BBB to 0C000BBB

fw 5.00 : sysmem.prx          0x700000A1

Debug:    91: CMD=4C34 P1= 1 P2= 2 R_32      02 Addr 00001990 from 0800066A to 0800066A
Debug:    92: CMD=4434 P1= 1 P2= 2 R_32      02 Addr 00001A18 from 0800067E to 0800067E
Debug:   245: CMD=0E44 P1= 1 P2= 3 R_26      04 Addr 00003584 from 0C001A43 to 0C001A43
Debug:   246: CMD=0A44 P1= 1 P2= 3 R_26      04 Addr 00003598 from 0C001A43 to 0C001A43
Debug:  2140: CMD=0253 P1= 9 P2= 5 R_LO16    06 Addr 00011AD8 from 00009650 to 00009650
Debug:  2141: CMD=0253 P1= 9 P2= 5 R_LO16    06 Addr 00011ADC from 0000A6C4 to 0000A6C4
Debug:   633: CMD=041A P1=17 P2= 6 X_J26     0E Addr 00006A20 from 3C030000 to 3C034CB0
Debug:   644: CMD=F81A P1=17 P2= 6 X_J26     0E Addr 00006B24 from 3C120000 to 3C124CB0
Debug:   922: CMD=022B P1= 9 P2= 7 X_JAL26   0F Addr 00009624 from 246604AC to 2466515C
Debug:   924: CMD=042B P1= 9 P2= 7 X_JAL26   0F Addr 0000964C from 8C820984 to 8C825634

_________________
GBASP x1, GBM x2, NDSL x2, PSP 100X x3, PSP 200X x5, PSP 300X x3, PSP Go x2, Wii x1
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 -> PSP Development 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