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 

ELF import table

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



Joined: 02 Jun 2009
Posts: 226

PostPosted: Sat Jul 18, 2009 10:30 am    Post subject: ELF import table Reply with quote

Hi there, me again

As I said, I'm trying to make an eboot loader from an exploit. I've managed to load the program section from the ELF. Now the thing is to resolve the imports table. And sincerely, my ignorance about this on PSP is absolute, except for understanding what an import table is, of course. And I guess it has something to do with the symbol table too...

I have also read that you can use the import table of the game being exploited to do the resolving. I guess if a function is not imported in the game, you'll not be able to resolve it, right?

And also, how relocating works on PRXs? I understand the concept of relocation sections, and that the symbols there needs to be relocated, but how it is done I cannot figure out.

:(
_________________
The Incredible Bill Gates wrote:
The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
Back to top
View user's profile Send private message
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Mon Jul 20, 2009 1:22 am    Post subject: Reply with quote

Ok, the imports table is .lib.stub, in case someone has the same question. It's explained here: http://hitmen.c02.at/files/yapspd/psp_doc/chap26.html#sec26.2.2.6

Relocation next.
_________________
The Incredible Bill Gates wrote:
The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
Back to top
View user's profile Send private message
sauron_le_noir



Joined: 05 Jul 2008
Posts: 229

PostPosted: Mon Jul 20, 2009 10:08 pm    Post subject: Reply with quote

thx tyranid has also provide macros to handle function that must be imported
Code:

.macro IMPORT_START module, flags_ver

   .set push
   .section .rodata.sceResident, "a"
   .word   0
__stub_modulestr_\module:
   .asciz  "\module"
   .align  2

   .section .lib.stub, "a", @progbits
   .global __stub_module_\module
__stub_module_\module:
   .word   __stub_modulestr_\module
   .word   \flags_ver
   .word   0x5
   .word   __executable_start
   .word   __executable_start

   .set pop
.endm

.macro IMPORT_FUNC module, funcid, funcname

   .set push
   .set noreorder

   .extern __stub_module_\module
   .section .sceStub.text, "ax", @progbits
   .globl  \funcname
   .type   \funcname, @function
   .ent    \funcname, 0
\funcname:
   .word   __stub_module_\module
   .word   \funcid
   .end    \funcname
   .size   \funcname, .-\funcname

   .section .rodata.sceNid, "a"
   .word   \funcid

   .set pop
.endm

.macro IMPORT_FUNC_WITH_ALIAS module, funcid, funcname, alias

   .set push
   .set noreorder

   .extern __stub_module_\module
   .section .sceStub.text, "ax", @progbits
   .globl  \alias
   .type   \alias, @function
\alias:
   .globl  \funcname
   .type   \funcname, @function
   .ent    \funcname, 0
\funcname:
   .word   __stub_module_\module
   .word   \funcid
   .end    \funcname
   .size   \funcname, .-\funcname

   .section .rodata.sceNid, "a"
   .word   \funcid

   .set pop
.endm
Back to top
View user's profile Send private message Send e-mail MSN Messenger
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Thu Jul 23, 2009 7:02 pm    Post subject: Reply with quote

Thanks to your for sharing that too, mon ami :)
_________________
The Incredible Bill Gates wrote:
The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
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