skapi.s 2.08 KB
#include <regdef.h>
#include <asm.h>
#include <PR/R4300.h>

#include <PR/bcp.h>
#include <PR/bbsim.h>
#include <PR/bbskapi.h>

#define SK_ENTRY_AND_RETURN               \
    li t0, PHYS_TO_K1(MI_SEC_MODE_REG);   \
    .set noreorder;                       \
    lw t1, (t0);                          \
    nop;                                  \
    .set reorder;                         \
    j ra

#define SK_API_APP_STUB(_funcname,_funcindx)  \
    .text;                                    \
    .align 2;                                 \
    .globl _funcname;                         \
    .type symbol,@function;                   \
    .ent _funcname;                           \
    _funcname:;                               \
      li   v0, _funcindx;                     \
      SK_ENTRY_AND_RETURN;                    \
    .end _funcname

SK_API_APP_STUB(skGetId,SK_API_CALL_GET_ID)
SK_API_APP_STUB(skLaunchSetup,SK_API_CALL_LAUNCH_SETUP)
SK_API_APP_STUB(skLaunch,SK_API_CALL_LAUNCH)
SK_API_APP_STUB(skRecryptListValid,SK_API_CALL_LIST_VALID)
SK_API_APP_STUB(skRecryptBegin,SK_API_CALL_RECRYPT_BEGIN)
SK_API_APP_STUB(skRecryptData,SK_API_CALL_RECRYPT_DATA)
SK_API_APP_STUB(skRecryptComputeState,SK_API_CALL_RECRYPT_STATE)
SK_API_APP_STUB(skRecryptEnd,SK_API_CALL_RECRYPT_END)
SK_API_APP_STUB(skSignHash, SK_API_CALL_SIGN_HASH)
SK_API_APP_STUB(skVerifyHash, SK_API_CALL_VERIFY_HASH)
SK_API_APP_STUB(skGetConsumption, SK_API_CALL_GET_CONSUMPTION)
SK_API_APP_STUB(skAdvanceTicketWindow, SK_API_CALL_ADVANCE_TICKET_WINDOW)
SK_API_APP_STUB(skSetLimit, SK_API_CALL_SET_LIMIT)
SK_API_APP_STUB(skExit, SK_API_CALL_EXIT)
SK_API_APP_STUB(skKeepAlive, SK_API_CALL_KEEP_ALIVE)

/* sk api development apis, only available for special
 * sk build. calling these stubs with a "normal" sk will
 * return failure.
 */
SK_API_APP_STUB(skGetRandomKeyData, SK_API_CALL_GET_RAND)
SK_API_APP_STUB(skDumpVirage, SK_API_CALL_DUMP_VIRAGE)
SK_API_APP_STUB(skTest2, SK_API_CALL_TEST2)
SK_API_APP_STUB(skTest3, SK_API_CALL_TEST3)
SK_API_APP_STUB(skResetWindow, SK_API_CALL_RESET_WINDOW)
SK_API_APP_STUB(skValidateRls, SK_API_CALL_VALIDATE_RLS)