PSX-SCENE Forum Discussion for Sony PlayStation/PsOne/PS2/PS3/PSP/PS VITA
  • How to Hook into LV2 Memory

    This post is meant for the more advanced developers out there. PS3mrengigma has updated his blog with a tutorial on how to hook into LV2. In this tutorial he utilizes, the undocumented, SYSCALL 867 for his hook. SYSCALL 867, which he explained previously, controls the PS3′s model information (retail, debug, reference tool etc). In his tutorial he walks us through the process of making his debug PS3, thinking its a retail unit (there is no benefit to making it think its a retail, its simply a learning exercise). For those interested in the tutorial, check it out after the jump.

    Translated:
    In this post we will see how to make hooks (hooks) in the LV-2 SYSCALL. The possibilities are endless da hook, only to be limited to our imagination
    and what we want to achieve with the hook.

    For this section we should bear in mind that we need to meet the following requirements:

    - Take a dump of the entire LV-2, possibly without being modified in any way by a payload.
    – Knowledge of assembler to understand the original SYSCALL to create our hooks.
    – Understand how the / s SYSCALL we will modify.

    For this post’ll take the example of a LV-2 3.41 Debug (for it is that I work mostly), but can be applied just as in a LV-2 Retail.

    The first thing you need to know is the beginning of the SYSCALL_TABLE, and the number of SYSCALL we want to put a hook.
    For example put a hook to the SYSCALL 0 × 363 (867) to alter the machine model that we will return.

    The SYSCALL_TABLE is at position 0 × 303130 (at any position in the LV-2 assume that they add the base address 0 × 8000 …), knowing the number of the SYSCALL (867)
    and taking into account that each table entry is 8 bytes in the address pointed to multiply 867 * 8 = 6936, so we add that to the SYSCALL_TABLE, 0 × 303130 + 0x1B18 = 0x304C48.

    In this direction we find another memory address, 0x348FB0, we go to the second and we have another memory address, 0x27A368. In this direction starts the code of the SYSCALL.
    Point out the direction where is the address where the SYSCALL would begin, in this case, 0x348FB4.


    Enter the code in the SYSCALL, knowing that the SYSCALL has 2 parameters, the first command of the operation to be performed and the second a pointer to a buffer to store the result
    of the call, we can try to see how the SYSCALL.

    The SYSCALL 867 with the command 0 × 19004 returned in the output buffer at position 3 (starting from 0) the byte that indicates the machine model, knowing that we can make our hook
    inject this value in the output buffer.


    We started writing our hook, for it wrote the preamble to the SYSCALL basing in the original code:

    STDU% sp,-0xB0 (% sp)
    mflr% r0
    std% r30, 0xA0 (% sp)
    std% r31, 0xA8 (% sp)
    std% r29, 0 × 98 (% sp)
    std% r0, 0xC0 (% sp)

    Having echo the preamble, we see that we have stored on the stack the registers% r30,% r31,% r29 pudiendolos use for what we need in our hook, as we have in store
    the Link Register so you could use our hook subllamadas smooth caller to return to the code.


    Need to check that the command you want to modify is the 0 × 19004, so we proceed to create a check:

    lis% r31, 1
    ori% r31,% r31, 0 × 9004
    cmpw% r31,% r3
    bne _salir_sin_nada

    At this point we have two possible flows, which is our command or it may not be. Start by it to be:

    li% r30, 0 × 85
    li% r29, 1

    stb% r29, 1 (% r4)
    stb% r30, 3 (% R4)
    stb% r29, 5 (% r4)
    stb% r29, 7 (% r4)

    li% r3, 0

    ld% r0, 0xC0 (% sp)
    ld% r29, 0 × 98 (% sp)
    ld% r31, 0xA8 (% sp)
    ld% r30, 0xA0 (% sp)
    mtlr% r0
    addi% sp,% sp, 0xB0

    BLR

    _salir_sin_nada:

    With this code will always let a European Retail of the first sub-models.

    Now to implement the code in the event that the command is not checked:

    b <address> , here we have to calculate a memory address where the branch is unconditional distance to the target memory address where we go, in this case 0x27A380.

    We will explain the code, if the command was desired, modify the destination buffer filling with a retail eur forced model, the first sub-models, after which he managed
    the preamble of the function and return without going through the SYSCALL original caller of the SYSCALL code. In the event that is not the command, do an unconditional jump to the original SYSCALL
    after its preamble already done in our code, so as the original parameters are untouched, as the SYSCALL finish and proceed to return to its caller, would return to the code
    the original name, because the code itself will correct the preamble SYSCALL ours.

    Once you create the hook, just have to copy it to a memory region in the LV-2 proper, in the case of the debug start in 0 × 54408, while retail 0x50B44.
    Do not forget that the unconditional jump performed at the end of the hook has to be recalculated at the address where the copied.

    Once copied, you need to install the hook so that when the modules call the SYSCALL call our code, in our case as we know where to start our code (0 × 54 408), proceed to write
    this direction in the second memory address that points that indicate the SYSCALL_TABLE, ie 0x348FB4.

    Once done, any module, homebrew, etc to call that SYSCALL go through our hook, and if the command is 0 × 19004, we will refund a forced Retail Eur.

    For this sample, a produce debug it from the XMB can not launch applications without signing, returning the error VSH not allowed (this problem is patched by PSGROOVE as
    we will explain in a future post).
  • Daily Digest


    Want to receive the latest PSX info in your email?

    Sign up for our Daily Digest!



    Want to learn more about the team keeping you up to date with the latest scene news?

    Read about them now!

    Check out our Developer bios, too!

  • Recent Threads

    Hussein007

    multiplayer with backup game

    Thread Starter: Hussein007

    I will have a plan to install jailbreak 4.41,

    It is okay if i play multiplayer with backup game?

    Last Post By: mschumacher69 Today, 08:06 AM Go to last post
    SP193

    Getting the FreeType library in PS2SDK-ports working

    Thread Starter: SP193

    Several of my ongoing projects need to be moved from gsKit's FONTM support to some other font system that doesn't involve rom0:FONTM because not all consoles

    Last Post By: SP193 Today, 06:18 AM Go to last post
    hcode123

    Multiman Theme Request Thread by hcode123

    Thread Starter: hcode123

    Hi everybody. Here I will be taking theme request. I will try my best to finish them asap. So just post the name of the theme you wanna see and I'll try

    Last Post By: hcode123 Today, 06:13 AM Go to last post
    lovewiibrew

    OPL development stalling?

    Thread Starter: lovewiibrew

    It's a fantastic program and I would hate to see it abandoned. One commit in 9 months and sometimes there's maybe one post a day in the OPl forum. Has

    Last Post By: l_oliveira Today, 07:58 AM Go to last post
    w0mb

    SLIM - Firmware 3.50 120 GB - cech2001a - For Sale

    Thread Starter: w0mb

    Listing on ebay to buy but shoot me offers before I list it. Will do transaction threw ebay.
    Perfect condition.
    This is the Offical Sony

    Last Post By: w0mb Yesterday, 10:43 PM Go to last post
    inserttwo

    PS4 new Teaser! Console shown!

    Thread Starter: inserttwo

    New teaser folks with a few close ups of the PS4 Console:



    It seems they will show the complete console in June 10th.

    Last Post By: spud42 Today, 05:56 AM Go to last post
  • Recent Comments

    matthi321

    PSIO Team Update To Project PlayStation Input Output - A PS1 SD Card Hack

    how much is it gonna cost? Go to last post

    matthi321 Today 07:49 AM
    newgold

    In Depth Review/Comparison Of OEM Cooling Fans

    Ah yes and the ps3 and xbox use non lead based solder. For some laws they use non toxic lead. It... Go to last post

    newgold Today 07:02 AM
    negodosul

    PS4 E3 Promo Video: June 10th be the first to see

    What is the purpose of this video? Go to last post

    negodosul Today 06:49 AM
    matt100

    New Multiman Themes by hcode123

    got to admit you make some fantastic themes...bootifull just bootifull Go to last post

    matt100 Today 05:11 AM
    alaska32

    [update #32] New EBOOT Patches/Fixes for 3.55/3.41

    Thanks bro Go to last post

    alaska32 Today 04:10 AM
    White Lord

    English Patch version for Dynasty Warriors Strikeforce 2 PSP.

    i would love to see this running on ps3 surely. :)
    There is no reason for this not to work on PS3... Go to last post

    White Lord Today 03:50 AM
    gamecheater

    Latest in PSP Conversions Tools and News (PSPonPS3)

    Using Ez psp2ps3 1.3, tried making remaster on 3 different iso and can successfully convert into... Go to last post

    gamecheater Today 02:14 AM
    XPredator13

    Fan Control Utility v1.7 Relased CFW 4.41 Supported!!

    Yep. But, after booting MM or RT, it works flawless, but it has a major issue in rebug 4.30, the... Go to last post

    XPredator13 Today 01:46 AM
    bitsbubba

    English Patch version for Dynasty Warriors Strikeforce 2 PSP.

    be sure to report back atreyu187 (like there's any doubt you won't :D ) Go to last post

    bitsbubba Today 12:57 AM
    atreyu187

    English Patch version for Dynasty Warriors Strikeforce 2 PSP.

    Wonder how it handles in a PSP2PS3 conversion, time for testing and thank a lot!! No PSP anymore... Go to last post

    atreyu187 Today 12:51 AM