any plan for prxtool update?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
D_Street
Posts: 22
Joined: Thu Jun 12, 2008 2:09 pm
Location: Berkeley, CA

any plan for prxtool update?

Post by D_Street »

looks like the current version of prxtool doesn't fully support some of the later firmwares, any plan to fix that?
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Doubtful, though what doesn't work? I know it doesn't support the newer relocation format (but I am too lazy to reverse the code to work out how to decode it) but I did update it to handle prxes without section headers. Perhaps you are just using a pre-built old version.
D_Street
Posts: 22
Joined: Thu Jun 12, 2008 2:09 pm
Location: Berkeley, CA

Post by D_Street »

I believe I am using the newest build. I think prxtool is a very useful tool because it has the ability to detect data references and gives me some level of information about it. So good jobs you guys! This feature doesn't work anymore (I don't know since which firmware). It is a bit annoying without it. Just for the update, it appears to work again under the latest firmware, although I have no idea whether or not it gives the correct addresses.

Anyway, I went through the source code a bit last night. I think this is likely caused by the new relocation format. It there a quick fix for that by disabling/changing a small portion of the source code?

Oh, forgive me if you think I am a little captious.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

It happens since 3.70 when sony changed again the format, since that version prxtool doesn't find variable addresses exactly (that's probably why no data is printed), and doesn't detect functions that are passed as parameters (like thread ones, callbacks, etc).

For variables you actually have to add the data section address to the variable address to get the proper address.
D_Street
Posts: 22
Joined: Thu Jun 12, 2008 2:09 pm
Location: Berkeley, CA

Post by D_Street »

moonlight wrote:For variables you actually have to add the data section address to the variable address to get the proper address.
I think this is no longer the case for fw3.70+ (according to you). Variable addresses appear to be the real addresses, as their values are all above 0x8804000.

Can I modify some part of the source to make it work? It is not my work, probably gonna take a while... Any time-saving suggestions would be appreciated!
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

moonlight, did you ever actually work out how the relocations decode in your travels? I really never have the desire to actually reverse the code myself :)

And I guess as moonlight says the variables should need the data section address adding to them, sure they did last time. But I have been long out of the psp dev scene so not really paid much attention.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Nope, I didn't even looked at it.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Damn you! :)

Maybe I will dig it out again then and have a look, I just seem to recall it was some horrible code so I couldn't be arsed since I had pretty much given up on PSP stuff.
D_Street
Posts: 22
Joined: Thu Jun 12, 2008 2:09 pm
Location: Berkeley, CA

Post by D_Street »

Will there be a quick fix anyway? :P
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Doubtful :)
hnaves
Posts: 30
Joined: Tue Feb 03, 2009 3:01 am

Post by hnaves »

I "reversed engineered" the subroutine at address 0x55FC of the loadcore.prx (FW 5.0), and I found pretty interesting things about the new relocation format:

Code: Select all

static
int load_unk (struct elf_program *programs, uint32 prgidx, uint8 *data, uint32 size)
{
  uint32 nbits;
  uint8 part1s, part2s;
  uint32 block1s, block2s;
  uint8 block1[256], block2[256];
  uint8 *ndata, *end;
  uint32 vaddr, temp1, temp2;
  uint32 part1, part2, lastpart2;
  uint32 addend = 0, offset = 0;
  uint32 ofsbase = 0xFFFFFFFF;
  uint32 addrbase;
  char *type;

  end = data + size;
  for &#40;nbits = 1; &#40;1 << nbits&#41; < prgidx; nbits++&#41; &#123;
    if &#40;nbits >= 33&#41; &#123;
      error &#40;__FILE__  "&#58; invalid number of bits for indexes"&#41;;
      return 0;
    &#125;
  &#125;

  if &#40;read_uint16_le &#40;data&#41; != 0&#41; &#123;
    error &#40;__FILE__  "&#58; invalid header for relocation"&#41;;
    return 0;
  &#125;

  part1s = data&#91;2&#93;;
  part2s = data&#91;3&#93;;

  block1s = data&#91;4&#93;;
  data += 4;

  if &#40;block1s&#41; &#123;
    memcpy &#40;block1, data, block1s&#41;;
    data += block1s;
  &#125;

  block2s = *data;
  if &#40;block2s&#41; &#123;
    memcpy &#40;block2, data, block2s&#41;;
    data += block2s;
  &#125;


  lastpart2 = block2s;
  for &#40;ndata = data; ndata < end; data = ndata&#41; &#123;
    uint32 cmd = read_uint16_le &#40;data&#41;;
    temp1 = &#40;cmd << &#40;16 - part1s&#41;&#41; & 0xFFFF;
    temp1 = &#40;temp1 >> &#40;16 -part1s&#41;&#41; & 0xFFFF;

    ndata = data + 2;
    if &#40;temp1 >= block1s&#41; &#123;
      error &#40;__FILE__ "&#58; invalid index for the first part"&#41;;
      return 0;
    &#125;
    part1= block1&#91;temp1&#93;;

    if &#40;&#40;part1 & 0x01&#41; == 0&#41; &#123;
      ofsbase = &#40;cmd << &#40;16 - part1s - nbits&#41;&#41; & 0xFFFF;
      ofsbase = &#40;ofsbase >> &#40;16 - nbits&#41;&#41; & 0xFFFF;
      if &#40;!&#40;ofsbase < prgidx&#41;&#41; &#123;
        error &#40;__FILE__ "&#58; invalid offset base"&#41;;
        return 0;
      &#125;

      offset = cmd >> &#40;part1s + nbits&#41;;
      if &#40;&#40;part1 & 0x06&#41; == 0&#41; continue;
      if &#40;&#40;part1 & 0x06&#41; != 4&#41; &#123;
        error &#40;__FILE__ "&#58; invalid size"&#41;;
        return 0;
      &#125;
      offset = read_uint32_le &#40;ndata&#41;;
      ndata = data + 6;
    &#125; else &#123;
      temp2 = &#40;cmd << &#40;16 - &#40;part1s + nbits + part2s&#41;&#41;&#41; & 0xFFFF;
      temp2 = &#40;temp2 >> &#40;16 - part2s&#41;&#41; & 0xFFFF;
      if &#40;temp2 >= block2s&#41; &#123;
        error &#40;__FILE__ "&#58; invalid index for the second part"&#41;;
        return 0;
      &#125;

      addrbase = &#40;cmd << &#40;16 - part1s - nbits&#41;&#41; & 0xFFFF;
      addrbase = &#40;addrbase >> &#40;16 - nbits&#41;&#41; & 0xFFFF;
      if &#40;!&#40;addrbase < prgidx&#41;&#41; &#123;
        error &#40;__FILE__ "&#58; invalid address base"&#41;;
        return 0;
      &#125;
      part2 = block2&#91;temp2&#93;;

      switch &#40;part1 & 0x06&#41; &#123;
      case 0&#58;
        if &#40;cmd & 0x8000&#41; &#123;
          cmd |= ~0xFFFF;
          cmd >>= part1s + part2s + nbits;
          cmd |= ~0xFFFF;
        &#125; else &#123;
          cmd >>= part1s + part2s + nbits;
        &#125;
        offset += cmd;
        break;
      case 2&#58;
        if &#40;cmd & 0x8000&#41; cmd |= ~0xFFFF;
        cmd = &#40;cmd >> &#40;part1s + part2s + nbits&#41;&#41; << 16;
        cmd |= read_uint16_le &#40;&data&#91;2&#93;&#41;;
        offset += cmd;
        ndata = data + 4;
        break;
      case 4&#58;
        offset = read_uint32_le &#40;ndata&#41;;
        ndata = data + 6;
        break;
      default&#58;
        error &#40;__FILE__ "&#58; invalid part1 size"&#41;;
        return 0;
      &#125;

      if &#40;!&#40;offset < programs&#91;ofsbase&#93;.filesz&#41;&#41; &#123;
        error &#40;__FILE__ "&#58; invalid relocation offset"&#41;;
        return 0;
      &#125;

      switch &#40;part1 & 0x38&#41; &#123;
      case 0x00&#58;
        addend = 0;
        break;
      case 0x08&#58;
        if &#40;&#40;lastpart2 ^ 0x04&#41; != 0&#41; &#123;
          addend = 0;
        &#125;
        break;
      case 0x10&#58;
        addend = read_uint16_le &#40;ndata&#41;;
        ndata += 2;
        break;
      case 0x18&#58;
        read_uint32_le &#40;ndata&#41;;
        return 0;
      default&#58;
        error &#40;__FILE__ "&#58; invalid addendum size"&#41;;
        return 0;
      &#125;

      lastpart2 = part2;

      vaddr = programs&#91;addrbase&#93;.vaddr;
      data = &#40;uint8 *&#41; &programs&#91;ofsbase&#93;.data&#91;offset&#93;;
      switch &#40;part2&#41; &#123;
      case 2&#58;
        temp2 = read_uint32_le &#40;data&#41; + vaddr;
        type = "mips32";
        break;
      case 0&#58;
        continue;
      case 3&#58;
        temp1 = read_uint32_le &#40;data&#41;;
        temp2 = offset + programs&#91;ofsbase&#93;.vaddr;
        temp2 &= 0xF0000000;
        temp2 = &#40;&#40;&#40;&#40;&#40;temp1 & 0x3FFFFFF&#41; << 2&#41; | temp2&#41; + vaddr&#41; >> 2&#41; & 0x3FFFFFF;
        temp1 &= ~0x3FFFFFF;
        temp2 |= temp1;
        type = "mips26";
        break;
      case 4&#58;
        temp1 = read_uint32_le &#40;data&#41;;
        temp2 = &#40;temp1 << 16&#41; + &#40;&#40;int&#41; &#40;&#40;short&#41; addend&#41;&#41; + vaddr;
        temp2 = temp2 >> 15;
        temp2 = &#40;&#40;temp2 + 1&#41; >> 1&#41; & 0xFFFF;
        temp2 |= &#40;temp1 & ~0xFFFF&#41;;
        type = "hi16";
        break;
      case 1&#58;
      case 5&#58;
        temp1 = read_uint32_le &#40;data&#41;;
        temp2 = &#40;int&#41; &#40;&#40;short&#41; temp1&#41;;
        temp2 = &#40;vaddr + temp2&#41; & 0xFFFF;
        temp1 &= ~0xFFFF;
        temp2 |= temp1;
        if &#40;part2 == 1&#41;
          type = "lo16/clear";
        else
          type = "lo16";
        break;
      case 6&#58;
        temp1 = read_uint32_le &#40;data&#41; & ~0xFC000000;
        temp2 = offset + programs&#91;ofsbase&#93;.vaddr;
        temp2 &= ~0xF0000000;
        temp2 = &#40;&#40;temp1 << 2&#41; | temp2&#41; + vaddr;
        temp2 = &#40;temp2 >> 2&#41; & 0x3FFFFFF;
        temp2 |= 0x8000000;
        type = "j26";
        break;
      case 7&#58;
        temp1 = read_uint32_le &#40;data&#41; & ~0xFC000000;
        temp2 = offset + programs&#91;ofsbase&#93;.vaddr;
        temp2 &= ~0xF0000000;
        temp2 = &#40;&#40;temp1 << 2&#41; | temp2&#41; + vaddr;
        temp2 = &#40;temp2 >> 2&#41; & 0x3FFFFFF;
        temp2 |= 0xC000000;
        type = "jal26";
        break;
      default&#58;
        error &#40;__FILE__ "&#58; invalid relocation type"&#41;;
        return 0;
      &#125;
      report &#40;"Address base&#58; %02d Offset base&#58; %02d Type&#58; %-12s Offset&#58; 0x%08X Old data&#58; 0x%08X New data&#58; 0x%08X\n",
          addrbase, ofsbase, type, offset, read_uint32_le &#40;data&#41;, temp2&#41;;
    &#125;
  &#125;

  return 1;
&#125;
Running my code on the chkreg.prx, it produced the following output:

Code: Select all

Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000008 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x0000001C Old data&#58; 0x24520130 New data&#58; 0x24520AB0
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000014 Old data&#58; 0x3C130000 New data&#58; 0x3C130000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000028 Old data&#58; 0x8E700000 New data&#58; 0x8E700980
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x0000003C Old data&#58; 0x0C0001F1 New data&#58; 0x0C0001FF
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000060 Old data&#58; 0x8E700000 New data&#58; 0x8E700980
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x000000B0 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000000B4 Old data&#58; 0xAC430040 New data&#58; 0xAC4309C0
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x000000BC Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000000C0 Old data&#58; 0xAC430044 New data&#58; 0xAC4309C4
Address base&#58; 00 Offset base&#58; 00 Type&#58; j26          Offset&#58; 0x00000104 Old data&#58; 0x0800002C New data&#58; 0x0800006D
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x0000010C Old data&#58; 0x0C0001F1 New data&#58; 0x0C0001F3
Address base&#58; 00 Offset base&#58; 00 Type&#58; j26          Offset&#58; 0x00000120 Old data&#58; 0x08000033 New data&#58; 0x0800007B
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000128 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x0000012C Old data&#58; 0x8C430040 New data&#58; 0x8C4309C0
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000130 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000134 Old data&#58; 0x244A0130 New data&#58; 0x244A0AB0
Address base&#58; 00 Offset base&#58; 00 Type&#58; j26          Offset&#58; 0x00000188 Old data&#58; 0x0800005D New data&#58; 0x0800007F
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000198 Old data&#58; 0x3C100000 New data&#58; 0x3C100000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x0000019C Old data&#58; 0x26100A80 New data&#58; 0x26101400
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x000001B0 Old data&#58; 0x0C0001EF New data&#58; 0x0C0001EF
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x000001D0 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000001D4 Old data&#58; 0xAC430048 New data&#58; 0xAC4309C8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x000001F0 Old data&#58; 0x0C0001EF New data&#58; 0x0C0001FF
Address base&#58; 00 Offset base&#58; 00 Type&#58; j26          Offset&#58; 0x00000204 Old data&#58; 0x08000078 New data&#58; 0x080000F9
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x0000020C Old data&#58; 0x3C060000 New data&#58; 0x3C060000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000214 Old data&#58; 0x24C60A80 New data&#58; 0x24C61400
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x00000228 Old data&#58; 0x0C0001F3 New data&#58; 0x0C0001FB
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000254 Old data&#58; 0x3C050000 New data&#58; 0x3C050000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000258 Old data&#58; 0x8CA20000 New data&#58; 0x8CA20980
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000270 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000274 Old data&#58; 0x24450A80 New data&#58; 0x24451400
Address base&#58; 00 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000294 Old data&#58; 0x3C040000 New data&#58; 0x3C040000
Address base&#58; 00 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x0000029C Old data&#58; 0x24840938 New data&#58; 0x24840938
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000290 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000002B0 Old data&#58; 0xAC400040 New data&#58; 0xAC4009C0
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000344 Old data&#58; 0x3C030000 New data&#58; 0x3C030000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000002B8 Old data&#58; 0xAC600044 New data&#58; 0xAC6009C4
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x000002BC Old data&#58; 0x0C0001ED New data&#58; 0x0C0001EF
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000350 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000002C0 Old data&#58; 0xAC400048 New data&#58; 0xAC4009C8
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x000002CC Old data&#58; 0x3C030000 New data&#58; 0x3C030000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000002D0 Old data&#58; 0xAC620B38 New data&#58; 0xAC6214B8
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x000002F4 Old data&#58; 0x3C050000 New data&#58; 0x3C050000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000300 Old data&#58; 0x8CA20000 New data&#58; 0x8CA20980
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000318 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x0000031C Old data&#58; 0x24450A80 New data&#58; 0x24451400
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000338 Old data&#58; 0x3C100000 New data&#58; 0x3C100000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x0000033C Old data&#58; 0x8E040B38 New data&#58; 0x8E0414B8
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000340 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000348 Old data&#58; 0xAC400040 New data&#58; 0xAC4009C0
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000298 Old data&#58; 0x3C030000 New data&#58; 0x3C030000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000358 Old data&#58; 0xAC600044 New data&#58; 0xAC6009C4
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x0000035C Old data&#58; 0x0C0001EB New data&#58; 0x0C0001FF
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x000002B4 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000360 Old data&#58; 0xAC400048 New data&#58; 0xAC4009C8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x00000380 Old data&#58; 0x0C0001E7 New data&#58; 0x0C0001E7
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x000006D0 Old data&#58; 0x3C120000 New data&#58; 0x3C120000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000384 Old data&#58; 0x8E040B38 New data&#58; 0x8E0414B8
Address base&#58; 00 Offset base&#58; 00 Type&#58; j26          Offset&#58; 0x00000388 Old data&#58; 0x080000DB New data&#58; 0x080000FB
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000398 Old data&#58; 0x3C130000 New data&#58; 0x3C130000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000003A8 Old data&#58; 0x8E640B38 New data&#58; 0x8E6414B8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x000003C4 Old data&#58; 0x0C0001EB New data&#58; 0x0C0001FB
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x000003D0 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000003D4 Old data&#58; 0x8C430044 New data&#58; 0x8C4309C4
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x000003E0 Old data&#58; 0x0C000000 New data&#58; 0x0C0000F8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x000003F4 Old data&#58; 0x0C00004A New data&#58; 0x0C0000FF
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000400 Old data&#58; 0x8E640B38 New data&#58; 0x8E6414B8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x00000404 Old data&#58; 0x0C0001E9 New data&#58; 0x0C0001E9
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000440 Old data&#58; 0x3C120000 New data&#58; 0x3C120000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000454 Old data&#58; 0x8E440B38 New data&#58; 0x8E4414B8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x00000464 Old data&#58; 0x0C0001EB New data&#58; 0x0C0001FB
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000470 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000474 Old data&#58; 0x8C430048 New data&#58; 0x8C4309C8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x00000480 Old data&#58; 0x0C000064 New data&#58; 0x0C000164
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x00000490 Old data&#58; 0x0C000083 New data&#58; 0x0C0001A7
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x0000072C Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000004A4 Old data&#58; 0x24440A80 New data&#58; 0x24441400
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000004E8 Old data&#58; 0x8E440B38 New data&#58; 0x8E4414B8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x000004EC Old data&#58; 0x0C0001E9 New data&#58; 0x0C0001FB
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000524 Old data&#58; 0x3C140000 New data&#58; 0x3C140000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000534 Old data&#58; 0x8E840B38 New data&#58; 0x8E8414B8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x00000554 Old data&#58; 0x0C0001EB New data&#58; 0x0C0001FF
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000560 Old data&#58; 0x3C100000 New data&#58; 0x3C100000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000564 Old data&#58; 0x8E040004 New data&#58; 0x8E040984
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000568 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000570 Old data&#58; 0xAC430B40 New data&#58; 0xAC4314C0
Address base&#58; 00 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000574 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 00 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x0000057C Old data&#58; 0x24470944 New data&#58; 0x24470944
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000005E8 Old data&#58; 0x8E040004 New data&#58; 0x8E040984
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x000005F8 Old data&#58; 0x0C0001F3 New data&#58; 0x0C0001FF
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000630 Old data&#58; 0x8E020004 New data&#58; 0x8E020984
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000648 Old data&#58; 0x8E840B38 New data&#58; 0x8E8414B8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x0000064C Old data&#58; 0x0C0001E9 New data&#58; 0x0C0001FB
Address base&#58; 00 Offset base&#58; 00 Type&#58; j26          Offset&#58; 0x00000688 Old data&#58; 0x0800018B New data&#58; 0x080001AB
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000690 Old data&#58; 0x8E020004 New data&#58; 0x8E020984
Address base&#58; 00 Offset base&#58; 00 Type&#58; j26          Offset&#58; 0x000006B0 Old data&#58; 0x0800018B New data&#58; 0x080001AF
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x000006EC Old data&#58; 0x8E440B38 New data&#58; 0x8E4414B8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x000006F4 Old data&#58; 0x0C0001EB New data&#58; 0x0C0001FF
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x00000700 Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000704 Old data&#58; 0x8C430048 New data&#58; 0x8C4309C8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x00000710 Old data&#58; 0x0C000064 New data&#58; 0x0C0001E4
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x00000720 Old data&#58; 0x0C000083 New data&#58; 0x0C0001CB
Address base&#58; 01 Offset base&#58; 00 Type&#58; hi16         Offset&#58; 0x0000049C Old data&#58; 0x3C020000 New data&#58; 0x3C020000
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000734 Old data&#58; 0x24450A80 New data&#58; 0x24451400
Address base&#58; 01 Offset base&#58; 00 Type&#58; lo16         Offset&#58; 0x00000758 Old data&#58; 0x8E440B38 New data&#58; 0x8E4414B8
Address base&#58; 00 Offset base&#58; 00 Type&#58; jal26        Offset&#58; 0x0000075C Old data&#58; 0x0C0001E9 New data&#58; 0x0C0001FF
Address base&#58; 00 Offset base&#58; 00 Type&#58; j26          Offset&#58; 0x00000794 Old data&#58; 0x080001D6 New data&#58; 0x080001F7
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x000007F0 Old data&#58; 0x000008C4 New data&#58; 0x000008C4
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x000007F4 Old data&#58; 0x000008E4 New data&#58; 0x000008E4
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000800 Old data&#58; 0x000008F8 New data&#58; 0x000008F8
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x0000080C Old data&#58; 0x00000888 New data&#58; 0x00000888
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000824 Old data&#58; 0x000008A0 New data&#58; 0x000008A0
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000838 Old data&#58; 0x000008B8 New data&#58; 0x000008B8
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x0000081C Old data&#58; 0x0000079C New data&#58; 0x0000079C
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000818 Old data&#58; 0x00000918 New data&#58; 0x00000918
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000834 Old data&#58; 0x000007BC New data&#58; 0x000007BC
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000830 Old data&#58; 0x00000928 New data&#58; 0x00000928
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000848 Old data&#58; 0x000007CC New data&#58; 0x000007CC
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000844 Old data&#58; 0x00000930 New data&#58; 0x00000930
Address base&#58; 01 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000870 Old data&#58; 0x00008000 New data&#58; 0x00008980
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000874 Old data&#58; 0x000007E4 New data&#58; 0x000007E4
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000878 Old data&#58; 0x00000804 New data&#58; 0x00000804
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x0000087C Old data&#58; 0x0000080C New data&#58; 0x0000080C
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000880 Old data&#58; 0x0000084C New data&#58; 0x0000084C
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x000008D4 Old data&#58; 0x00000248 New data&#58; 0x00000248
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x000008D8 Old data&#58; 0x000002E0 New data&#58; 0x000002E0
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x000008DC Old data&#58; 0x00000850 New data&#58; 0x00000850
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x000008E0 Old data&#58; 0x00000934 New data&#58; 0x00000934
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000908 Old data&#58; 0x00000390 New data&#58; 0x00000390
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x0000090C Old data&#58; 0x00000438 New data&#58; 0x00000438
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000910 Old data&#58; 0x000006B8 New data&#58; 0x000006B8
Address base&#58; 00 Offset base&#58; 00 Type&#58; mips32       Offset&#58; 0x00000914 Old data&#58; 0x0000051C New data&#58; 0x0000051C
Address base&#58; 01 Offset base&#58; 01 Type&#58; mips32       Offset&#58; 0x00000000 Old data&#58; 0x00000080 New data&#58; 0x00000A00
Address base&#58; 01 Offset base&#58; 01 Type&#58; mips32       Offset&#58; 0x00000004 Old data&#58; 0x00000B40 New data&#58; 0x000014C0
I supposed it worked fine, and the next step is to put it on the prxtool
hnaves
Posts: 30
Joined: Tue Feb 03, 2009 3:01 am

Post by hnaves »

(The output of psp-readelf -a chkreg.prx)

Code: Select all

ELF Header&#58;
  Magic&#58;   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class&#58;                             ELF32
  Data&#58;                              2's complement, little endian
  Version&#58;                           1 &#40;current&#41;
  OS/ABI&#58;                            UNIX - System V
  ABI Version&#58;                       0
  Type&#58;                              Processor Specific&#58; &#40;ffa0&#41;
  Machine&#58;                           MIPS R3000
  Version&#58;                           0x1
  Entry point address&#58;               0x248
  Start of program headers&#58;          52 &#40;bytes into file&#41;
  Start of section headers&#58;          0 &#40;bytes into file&#41;
  Flags&#58;                             0x10a23001, noreorder, allegrex, eabi32, mips2
  Size of this header&#58;               52 &#40;bytes&#41;
  Size of program headers&#58;           32 &#40;bytes&#41;
  Number of program headers&#58;         3
  Size of section headers&#58;           0 &#40;bytes&#41;
  Number of section headers&#58;         0
  Section header string table index&#58; 0

There are no sections in this file.

There are no sections in this file.

Program Headers&#58;
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x0000a0 0x00000000 0x800008f0 0x00958 0x00958 R E 0x10
  LOAD           0x000a00 0x00000980 0x00000000 0x00008 0x00b80 RW  0x40
  LOPROC+a1      0x000a10 0x00000000 0x00000000 0x00174 0x00000     0x10

There is no dynamic section in this file.

There are no relocations in this file.

There are no unwind sections in this file.

No version information found in this file.
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

@hnaves
to be sure to understand what you posted. Is "load_unk" to be called with prgidx as the third index in program headers ? the one of type LOPROC+a1 (0xFFA1) ? if so, that's a great help, thanx !
hnaves
Posts: 30
Joined: Tue Feb 03, 2009 3:01 am

Post by hnaves »

Yes. But the custom program type is 0x700000A1 (not 0xFFA1).
Accordingly to loadcore.prx, programs is an array of all program headers whose type is LOAD, prgidx is the index of the relocation program (type 0x700000A1), data is a pointer to the relocation program bytes and size is the corresponding size of the relocation program.
hnaves
Posts: 30
Joined: Tue Feb 03, 2009 3:01 am

Post by hnaves »

The patch to make prxtool works with the new relocation type is at
http://forums.ps2dev.org/viewtopic.php?p=80441
D_Street
Posts: 22
Joined: Thu Jun 12, 2008 2:09 pm
Location: Berkeley, CA

Post by D_Street »

@ hnaves

i just tried out your patch, maybe it doesn't work with the boot file i was trying to disassemble last July. well, i got an "Couldn't load elf file structures" error. well, maybe it only works with prx's but not elf files? anyway, i was away from the psp stuff for a while and didn't have a chance to come back here and say thank you for your work :)
NoEffex
Posts: 106
Joined: Thu Nov 27, 2008 6:48 am

Post by NoEffex »

D_Street wrote:@ hnaves

i just tried out your patch, maybe it doesn't work with the boot file i was trying to disassemble last July. well, i got an "Couldn't load elf file structures" error. well, maybe it only works with prx's but not elf files? anyway, i was away from the psp stuff for a while and didn't have a chance to come back here and say thank you for your work :)
I believe it only works with prx's, and decompressed ones at that.
Programming with:
Geany + Latest PSPSDK from svn
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Seems to work on my ELF files I have built using the SDK, turn on the debugging option and see if there is something specific it is failing on.
D_Street
Posts: 22
Joined: Thu Jun 12, 2008 2:09 pm
Location: Berkeley, CA

Post by D_Street »

just give an example elf here.

and i tracked down the error:

LoadExports() returns false in CProcessPrx::LoadFromFile(const char *szFilename)

and thats because in CProcessPrx::LoadExports(), pExport == NULL at some point.

here is the debug output:

Code: Select all

PRXTool v1.1 &#58; &#40;c&#41; TyRaNiD 2k6
Built&#58; May 15 2009 23&#58;23&#58;49
Loading BOOT.PBP
Debug&#58; 00000054, 00183588, 00183588
Debug&#58; ELF Header&#58;
Debug&#58; Magic 464C457F
Debug&#58; Class 1
Debug&#58; Data 1
Debug&#58; Idver 1
Debug&#58; Type 0002
Debug&#58; Start 08804124
Debug&#58; PH Offs 00000034
Debug&#58; SH Offs 00183100
Debug&#58; Flags 10A23001
Debug&#58; EH Size 52
Debug&#58; PHEntSize 32
Debug&#58; PHNum 1
Debug&#58; SHEntSize 40
Debug&#58; SHNum 29
Debug&#58; SHStrndx 28

Debug&#58; Program Headers&#58;
Debug&#58; Program Header 0&#58;
Debug&#58; Type&#58; 00000001
Debug&#58; Offset&#58; 00001018
Debug&#58; VAddr&#58; 00000000
Debug&#58; PAddr&#58; 000E740C
Debug&#58; FileSz&#58; 1397892
Debug&#58; MemSz&#58; 3970700
Debug&#58; Flags&#58; 00000007
Debug&#58; Align&#58; 00001000

Debug&#58; Section 0
Debug&#58; Name&#58; 0 
Debug&#58; Type&#58; 00000000
Debug&#58; Flags&#58; 00000000
Debug&#58; Addr&#58; 00000000
Debug&#58; Offset&#58; 00000000
Debug&#58; Size&#58; 00000000
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000000
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7fe20008

Debug&#58; Section 1
Debug&#58; Name&#58; 11 .reginfo
Debug&#58; Type&#58; 70000006
Debug&#58; Flags&#58; 00000000
Debug&#58; Addr&#58; 08804000
Debug&#58; Offset&#58; 00156530
Debug&#58; Size&#58; 00000018
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000001
Debug&#58; Data 0x7ff76538

Debug&#58; Section 2
Debug&#58; Name&#58; 20 .init
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000006
Debug&#58; Addr&#58; 08804018
Debug&#58; Offset&#58; 00001018
Debug&#58; Size&#58; 00000024
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000001
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7fe21020

Debug&#58; Section 3
Debug&#58; Name&#58; 40 .text
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000006
Debug&#58; Addr&#58; 08804040
Debug&#58; Offset&#58; 00001040
Debug&#58; Size&#58; 000E5C10
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000010
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7fe21048

Debug&#58; Section 4
Debug&#58; Name&#58; 26 .fini
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000006
Debug&#58; Addr&#58; 088E9C50
Debug&#58; Offset&#58; 000E6C50
Debug&#58; Size&#58; 0000001C
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000001
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff06c58

Debug&#58; Section 5
Debug&#58; Name&#58; 32 .sceStub.text
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000006
Debug&#58; Addr&#58; 088E9C6C
Debug&#58; Offset&#58; 000E6C6C
Debug&#58; Size&#58; 000005C8
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff06c74

Debug&#58; Section 6
Debug&#58; Name&#58; 46 .lib.ent.top
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000002
Debug&#58; Addr&#58; 088EA234
Debug&#58; Offset&#58; 000E7234
Debug&#58; Size&#58; 00000004
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff0723c

Debug&#58; Section 7
Debug&#58; Name&#58; 59 .lib.ent
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000002
Debug&#58; Addr&#58; 088EA238
Debug&#58; Offset&#58; 000E7238
Debug&#58; Size&#58; 00000010
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff07240

Debug&#58; Section 8
Debug&#58; Name&#58; 68 .lib.ent.btm
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000002
Debug&#58; Addr&#58; 088EA248
Debug&#58; Offset&#58; 000E7248
Debug&#58; Size&#58; 00000004
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff07250

Debug&#58; Section 9
Debug&#58; Name&#58; 81 .lib.stub.top
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000002
Debug&#58; Addr&#58; 088EA24C
Debug&#58; Offset&#58; 000E724C
Debug&#58; Size&#58; 00000004
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff07254

Debug&#58; Section 10
Debug&#58; Name&#58; 95 .lib.stub
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000002
Debug&#58; Addr&#58; 088EA250
Debug&#58; Offset&#58; 000E7250
Debug&#58; Size&#58; 000001B8
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff07258

Debug&#58; Section 11
Debug&#58; Name&#58; 105 .lib.stub.btm
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000002
Debug&#58; Addr&#58; 088EA408
Debug&#58; Offset&#58; 000E7408
Debug&#58; Size&#58; 00000004
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff07410

Debug&#58; Section 12
Debug&#58; Name&#58; 119 .rodata.sceModuleInfo
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000002
Debug&#58; Addr&#58; 088EA40C
Debug&#58; Offset&#58; 000E740C
Debug&#58; Size&#58; 00000034
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff07414

Debug&#58; Section 13
Debug&#58; Name&#58; 141 .rodata.sceResident
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000002
Debug&#58; Addr&#58; 088EA440
Debug&#58; Offset&#58; 000E7440
Debug&#58; Size&#58; 000001D0
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff07448

Debug&#58; Section 14
Debug&#58; Name&#58; 161 .rodata.sceNid
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000002
Debug&#58; Addr&#58; 088EA610
Debug&#58; Offset&#58; 000E7610
Debug&#58; Size&#58; 000002E4
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff07618

Debug&#58; Section 15
Debug&#58; Name&#58; 176 .rodata
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000002
Debug&#58; Addr&#58; 088EA900
Debug&#58; Offset&#58; 000E7900
Debug&#58; Size&#58; 00031C13
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000040
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff07908

Debug&#58; Section 16
Debug&#58; Name&#58; 184 .data
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000003
Debug&#58; Addr&#58; 0891C540
Debug&#58; Offset&#58; 00119540
Debug&#58; Size&#58; 0003CEE0
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000040
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff39548

Debug&#58; Section 17
Debug&#58; Name&#58; 190 .eh_frame
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000003
Debug&#58; Addr&#58; 08959420
Debug&#58; Offset&#58; 00156420
Debug&#58; Size&#58; 00000068
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff76428

Debug&#58; Section 18
Debug&#58; Name&#58; 200 .ctors
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000003
Debug&#58; Addr&#58; 08959488
Debug&#58; Offset&#58; 00156488
Debug&#58; Size&#58; 00000008
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff76490

Debug&#58; Section 19
Debug&#58; Name&#58; 207 .dtors
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000003
Debug&#58; Addr&#58; 08959490
Debug&#58; Offset&#58; 00156490
Debug&#58; Size&#58; 00000008
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff76498

Debug&#58; Section 20
Debug&#58; Name&#58; 214 .jcr
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000003
Debug&#58; Addr&#58; 08959498
Debug&#58; Offset&#58; 00156498
Debug&#58; Size&#58; 00000004
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff764a0

Debug&#58; Section 21
Debug&#58; Name&#58; 219 .sbss
Debug&#58; Type&#58; 00000008
Debug&#58; Flags&#58; 10000003
Debug&#58; Addr&#58; 08959500
Debug&#58; Offset&#58; 00156500
Debug&#58; Size&#58; 00000C50
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000080
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff76508

Debug&#58; Section 22
Debug&#58; Name&#58; 225 .bss
Debug&#58; Type&#58; 00000008
Debug&#58; Flags&#58; 00000003
Debug&#58; Addr&#58; 0895A180
Debug&#58; Offset&#58; 00156530
Debug&#58; Size&#58; 0019442C
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000080
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff76538

Debug&#58; Section 23
Debug&#58; Name&#58; 230 .comment
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000000
Debug&#58; Addr&#58; 00000000
Debug&#58; Offset&#58; 00156548
Debug&#58; Size&#58; 000004ED
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000001
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff76550

Debug&#58; Section 24
Debug&#58; Name&#58; 239 .pdr
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000000
Debug&#58; Addr&#58; 00000000
Debug&#58; Offset&#58; 00156A38
Debug&#58; Size&#58; 0002C5A0
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000004
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff76a40

Debug&#58; Section 25
Debug&#58; Name&#58; 244 .mdebug.eabi32
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000000
Debug&#58; Addr&#58; 00000000
Debug&#58; Offset&#58; 00182FD8
Debug&#58; Size&#58; 00000000
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000001
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ffa2fe0

Debug&#58; Section 26
Debug&#58; Name&#58; 259 .gcc_compiled_long32
Debug&#58; Type&#58; 00000001
Debug&#58; Flags&#58; 00000000
Debug&#58; Addr&#58; 00000000
Debug&#58; Offset&#58; 00182FD8
Debug&#58; Size&#58; 00000000
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000001
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ffa2fe0

Debug&#58; Section 27
Debug&#58; Name&#58; 280 .overlay_area
Debug&#58; Type&#58; 00000008
Debug&#58; Flags&#58; 00000007
Debug&#58; Addr&#58; 08AEE5AC
Debug&#58; Offset&#58; 00156530
Debug&#58; Size&#58; 000DF0F8
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000001
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ff76538

Debug&#58; Section 28
Debug&#58; Name&#58; 1 .shstrtab
Debug&#58; Type&#58; 00000003
Debug&#58; Flags&#58; 00000000
Debug&#58; Addr&#58; 00000000
Debug&#58; Offset&#58; 00182FD8
Debug&#58; Size&#58; 00000126
Debug&#58; Link&#58; 00000000
Debug&#58; Info&#58; 00000000
Debug&#58; Addralign&#58; 00000001
Debug&#58; Entsize&#58; 00000000
Debug&#58; Data 0x7ffa2fe0

Debug&#58; Size 16
Debug&#58; Min Address 00000000, Max Address 003C968C
Debug&#58; Loading program 0 0x00000001
Debug&#58; pData 0x7fa50008, iSize 3c968c, iBaseAddr 0x00000000, endian 0
Debug&#58; Module Info&#58;
Debug&#58; Name&#58; tor
Debug&#58; Addr&#58; 0x088EA40C
Debug&#58; Flags&#58; 0x01010000
Debug&#58; GP&#58; 0x08961490
Debug&#58; Exports&#58; 0x088EA238, Exp_end 0x088EA248
Debug&#58; Imports&#58; 0x088EA250, Imp_end 0x088EA408
Debug&#58; Ptr out of region 0x088EA238
Error&#58; Couldn't load elf file structures
Done
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Well the real problem is the program header is garbage. No idea what you used to build it, most likely as the ELF is not loaded at the "standard" address you have a custom linker script? Or is this "third party code"?

I am sure I am paranoid, but I would swear some of the changes Sony have made over the years to the way prxes etc. are represented have less to do with saving space and shit like that and more to hamper reverse engineering and break prxtool :)
D_Street
Posts: 22
Joined: Thu Jun 12, 2008 2:09 pm
Location: Berkeley, CA

Post by D_Street »

TyRaNiD wrote:Well the real problem is the program header is garbage. No idea what you used to build it, most likely as the ELF is not loaded at the "standard" address you have a custom linker script? Or is this "third party code"?

I am sure I am paranoid, but I would swear some of the changes Sony have made over the years to the way prxes etc. are represented have less to do with saving space and shit like that and more to hamper reverse engineering and break prxtool :)
what if i tell you that any version below revision 2457 would load the elf just fine? so my first thought was that there might be some inconsistency in between the code that introduce this error, not necessarily the elf's fault.

i totally agree with the second part of your comment though :)
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

hmm... I will look into it then. I think I see it, the patch changed the loader code to always use program headers, think I will just add a check for loading an ELF and in that situation always use the section headers :)

Update: Try it now, hopefully fixed it :)
D_Street
Posts: 22
Joined: Thu Jun 12, 2008 2:09 pm
Location: Berkeley, CA

Post by D_Street »

yup, it works this time.
Post Reply