ps2dev/ps2-packer — Issue #1: n2e asm stub is sometimes buggy
Author: jimmikaelkael
Created: 2012-02-19 08:48:38+00:00
State: open

Some times ago I found out that the n2e unpacker stub from ps2-packer have a bug striking sometimes, depending on the size on the original packed elf.
When it happens, simply trying to launch the packed elf ends up with an exception in the n2e unpacker stub (see attached ps2link log and ps2dis capture of the stub.
The exception strike during the branch delay slot (at 0x01d001a0).

```console
jimmikaelkael@PC-DE-JIM:~/PS2dev/open-ps2-loader-new$ ps2client execee host:OPNPS2LD.ELF
loadelf: fname host:OPNPS2LD.ELF secname all
loadelf version 3.30
Input ELF format filename = host:OPNPS2LD.ELF
0 01c57060 000a915d ...........
Loaded, host:OPNPS2LD.ELF
start address 0x1d00008
gp address 00000000

EE Exception handler: TLB load/inst fetch exception

Cause B0008008 BadVAddr 02000000 Status 70030C13 EPC 01D0019C

zero: 00000000000000000000000000000000 t8: 00000000000000000000000000000000
at: 00000000000000000000000000000000 t9: 00000000000000000000000001D00024
v0: 00000000000000000000000000000000 s0: 00000000000000000000000002000000
v1: 00000000000000000000000000000000 s1: 00000000000000000000000000440DD5
a0: 000000000000000000000000000EB500 s2: 00000000000000000000000001C57060
a1: 00000000000000000000000000000000 s3: 0000000000000000000000000019DDA0
a2: 00000000000000000000000000000000 s4: 0000000000000000000000000029DDA0
a3: 00000000000000000000000000000000 s5: 00000000000000000000000000000000
t0: 0000000000000000000000001FE00000 s6: 00000000000000000000000000000000
t1: 00000000000000000000000000E00000 s7: 00000000000000000000000000000000
t2: 00000000000000000000000000000001 k0: 00000000000000000000000000000000
t3: 00000000000000000000000000000000 k1: EDF755BEFF7FEFF80000000000000000
t4: 00000000000000000000000000000000 gp: 00000000000000000000000000000000
t5: 00000000000000000000000000000000 sp: 000000000000000000000000000DB320
t6: 00000000000000000000000000FF0000 fp: 000000000000000000000000000DB320
t7: 00000000000000000000000000000000 ra: 00000000000000000000000001D00084

```

ps2dis screenshot:
http://imageshack.us/photo/my-images/9/n2eunpackerstubdisasm.png/