vitasdk
Documentation of the vitasdk

Exports for Kernel. More...

Macros

#define ksceSblSmSchedProxyChangeF00DStatus   ksceSblSmSchedProxyForceStop
 Previous VitaSDK name retained for backwards compatibility.
 
#define ksceSblSmSchedProxyDisableCry2ArmInterrupt   ksceSblSmSchedProxyReleaseIntrHandler
 Previous VitaSDK name retained for backwards compatibility.
 
#define ksceSblSmSchedProxyEnableCry2ArmInterrupt   ksceSblSmSchedProxyRegisterIntrHandler
 Previous VitaSDK name retained for backwards compatibility.
 
#define ksceSblSmSchedProxyExecuteF00DCommand   ksceSblSmSchedProxyExecuteSKCommand
 Previous VitaSDK name retained for backwards compatibility.
 
#define ksceSblSmSchedProxyGetCommandF00DRegister   ksceSblSmSchedProxyReadArm2Cry
 Previous VitaSDK name retained for backwards compatibility.
 
#define ksceSblSmSchedProxyWriteArm2Cry   ksceSblSmSchedProxyClearArm2Cry
 Previous VitaSDK name retained for backwards compatibility.
 
#define ksceSblSmSchedProxyWriteCry2Arm   ksceSblSmSchedProxyClearCry2Arm
 Previous VitaSDK name retained for backwards compatibility.
 

Typedefs

typedef int SceSblSmSchedProxyIntrHandler(SceSmSchedRequestId req_id, SceUInt32 interrupt_index, int callback_arg, SceUInt32 status, int result)
 Secure-module scheduler interrupt handler.
 
typedef SceSblSmSchedProxyIntrHandler sceSblSmSchedProxyIntrHandler
 Previous VitaSDK type name retained for backwards compatibility.
 

Enumerations

enum  SceSblSmSchedProxyErrorCode {
  SCE_SM_SCHED_PROXY_ERROR_RESOURCE_LIMIT = 0x800F040C , SCE_SM_SCHED_PROXY_ERROR_INVALID_ARGUMENT = 0x800F0416 , SCE_SM_SCHED_PROXY_ERROR_NOT_SUPPORTED = 0x800F0425 , SCE_SM_SCHED_PROXY_ERROR_NOT_INITIALIZED = 0x800F0426 ,
  SCE_SM_SCHED_PROXY_ERROR_REQUEST_ALREADY_STOPPED = 0x800F0429 , SCE_SM_SCHED_PROXY_ERROR_REQUEST_NOT_FOUND = 0x800F042B , SCE_SM_SCHED_PROXY_ERROR_HANDLER_ALREADY_REGISTERED = 0x800F042E
}
 Scheduler-proxy errors identified on FW 3.60. More...
 
enum  SceSmStatus {
  SCE_SM_STATUS_READY = 0x1 , SCE_SM_STATUS_RUNNING = 0x2 , SCE_SM_STATUS_STOPPED = 0x3 , SCE_SM_STATUS_FORCE_STOPPED = 0x4 ,
  SCE_SM_STATUS_START_RESUME_REQUESTED = 0x6 , SCE_SM_STATUS_SUSPENDING = 0x7 , SCE_SM_STATUS_SUSPEND_REQUESTED = 0xB
}
 Secure-module scheduler lifecycle states. More...
 

Functions

 VITASDK_BUILD_ASSERT_EQ (4, SceSblSmSchedProxyErrorCode)
 
 VITASDK_BUILD_ASSERT_EQ (1, SceSmStatus)
 
int ksceSblSmSchedCallFunc (SceSmSchedRequestId req_id, SceUInt32 mailbox_id, SceUInt32 mail_mask)
 Set bits in an ARM-to-Cry scheduler mailbox through SMC 0x133.
 
int ksceSblSmSchedProxyForceStop (SceSmSchedRequestId req_id)
 Forcibly stop a secure-module scheduler request through SMC 0x130.
 
int ksceSblSmSchedProxyReleaseIntrHandler (SceSmSchedRequestId req_id, SceUInt32 interrupt_index)
 Release a scheduler interrupt handler through SMC 0x139.
 
int ksceSblSmSchedProxyRegisterIntrHandler (SceSmSchedRequestId req_id, SceUInt32 interrupt_index, SceSblSmSchedProxyIntrHandler *handler, int callback_arg)
 Register a scheduler interrupt handler through SMC 0x138.
 
int ksceSblSmSchedProxyExecuteSKCommand (SceUInt32 command_index, SceUInt32 unused1, SceUInt32 unused2, SceUInt32 unused3)
 Execute a secure scheduler control command selected by index through SMC 0x13C.
 
int ksceSblSmSchedProxyReadArm2Cry (SceSmSchedRequestId req_id, SceUInt32 mailbox_id, SceUInt32 *mail_value)
 Read an ARM-to-Cry mailbox through SMC 0x134.
 
int ksceSblSmSchedProxyGetStatus (SceSmSchedRequestId req_id, SceSblSmCommPair *result)
 Query a secure-module request through SMC 0x12F.
 
int ksceSblSmSchedProxyInitialize (void)
 Initialize the scheduler proxy.
 
int ksceSblSmSchedProxyInvoke (SceBool priority, SceUIntPtr pa_ranges_paddr, SceSize pa_range_count, const SceSmInvokeDataBlockInput *invoke_input, const SceSblSmCommContext130 *context, SceSmSchedRequestId *request_id)
 Start a secure-module scheduler request through SMC 0x12D.
 
int ksceSblSmSchedProxyReadCry2Arm (SceSmSchedRequestId req_id, SceUInt32 mailbox_id, SceUInt32 *mail_value)
 Read a Cry-to-ARM mailbox through SMC 0x137.
 
int ksceSblSmSchedProxyUninitialize (void)
 Uninitialize the scheduler proxy.
 
int ksceSblSmSchedProxyWait (SceSmSchedRequestId req_id, SceSblSmCommPair *result)
 Wait for a secure-module request to complete through SMC 0x12E.
 
int ksceSblSmSchedProxyClearArm2Cry (SceSmSchedRequestId req_id, SceUInt32 mailbox_id, SceUInt32 mail_mask)
 Clear bits in an ARM-to-Cry mailbox through SMC 0x135.
 
int ksceSblSmSchedProxyClearCry2Arm (SceSmSchedRequestId req_id, SceUInt32 mailbox_id, SceUInt32 mail_mask)
 Clear bits in a Cry-to-ARM mailbox through SMC 0x136.
 
int SceSblSmSchedProxyForKernel_1DFC8624 (void)
 Does nothing on FW 3.60.
 
int SceSblSmSchedProxyForKernel_984EC9D1 (void)
 Does nothing on FW 3.60.
 

Detailed Description

Exports for Kernel.


Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceSblSmSchedProxyForKernel_stub



Macro Definition Documentation

◆ ksceSblSmSchedProxyChangeF00DStatus

#define ksceSblSmSchedProxyChangeF00DStatus   ksceSblSmSchedProxyForceStop

Previous VitaSDK name retained for backwards compatibility.

◆ ksceSblSmSchedProxyDisableCry2ArmInterrupt

#define ksceSblSmSchedProxyDisableCry2ArmInterrupt   ksceSblSmSchedProxyReleaseIntrHandler

Previous VitaSDK name retained for backwards compatibility.

◆ ksceSblSmSchedProxyEnableCry2ArmInterrupt

#define ksceSblSmSchedProxyEnableCry2ArmInterrupt   ksceSblSmSchedProxyRegisterIntrHandler

Previous VitaSDK name retained for backwards compatibility.

◆ ksceSblSmSchedProxyExecuteF00DCommand

#define ksceSblSmSchedProxyExecuteF00DCommand   ksceSblSmSchedProxyExecuteSKCommand

Previous VitaSDK name retained for backwards compatibility.

◆ ksceSblSmSchedProxyGetCommandF00DRegister

#define ksceSblSmSchedProxyGetCommandF00DRegister   ksceSblSmSchedProxyReadArm2Cry

Previous VitaSDK name retained for backwards compatibility.

◆ ksceSblSmSchedProxyWriteArm2Cry

#define ksceSblSmSchedProxyWriteArm2Cry   ksceSblSmSchedProxyClearArm2Cry

Previous VitaSDK name retained for backwards compatibility.

◆ ksceSblSmSchedProxyWriteCry2Arm

#define ksceSblSmSchedProxyWriteCry2Arm   ksceSblSmSchedProxyClearCry2Arm

Previous VitaSDK name retained for backwards compatibility.

Typedef Documentation

◆ SceSblSmSchedProxyIntrHandler

typedef int SceSblSmSchedProxyIntrHandler(SceSmSchedRequestId req_id, SceUInt32 interrupt_index, int callback_arg, SceUInt32 status, int result)

Secure-module scheduler interrupt handler.

Parameters
req_id- Scheduler request ID.
interrupt_index- Interrupt index in the range 0 through 3.
callback_arg- Value supplied to ksceSblSmSchedProxyRegisterIntrHandler.
status- Scheduler status. FW 3.60 callers clear bit 0x8 before testing for SCE_SM_STATUS_RUNNING; the bit's purpose is unknown.
result- Secure-module result or error code.

The handler's return value is ignored on FW 3.60.

◆ sceSblSmSchedProxyIntrHandler

Previous VitaSDK type name retained for backwards compatibility.

Enumeration Type Documentation

◆ SceSblSmSchedProxyErrorCode

Scheduler-proxy errors identified on FW 3.60.

Enumerator
SCE_SM_SCHED_PROXY_ERROR_RESOURCE_LIMIT 
SCE_SM_SCHED_PROXY_ERROR_INVALID_ARGUMENT 
SCE_SM_SCHED_PROXY_ERROR_NOT_SUPPORTED 
SCE_SM_SCHED_PROXY_ERROR_NOT_INITIALIZED 
SCE_SM_SCHED_PROXY_ERROR_REQUEST_ALREADY_STOPPED 

FW 3.60 callers treat this as an already stopped request.

SCE_SM_SCHED_PROXY_ERROR_REQUEST_NOT_FOUND 
SCE_SM_SCHED_PROXY_ERROR_HANDLER_ALREADY_REGISTERED 

◆ SceSmStatus

Secure-module scheduler lifecycle states.

FW 3.60 SceSblAuthMgr and SceSblSsSmComm clear bit 0x8 before comparing a callback status with SCE_SM_STATUS_RUNNING. The purpose of that bit is unknown.

A request enters SCE_SM_STATUS_READY when created or after suspension completes. The normal scheduling path is SCE_SM_STATUS_READY -> SCE_SM_STATUS_START_RESUME_REQUESTED -> SCE_SM_STATUS_RUNNING. Preemption follows SCE_SM_STATUS_RUNNING -> SCE_SM_STATUS_SUSPEND_REQUESTED -> SCE_SM_STATUS_SUSPENDING -> SCE_SM_STATUS_READY. A request that finishes normally enters SCE_SM_STATUS_STOPPED. An explicit force-stop or scheduler shutdown puts it in SCE_SM_STATUS_FORCE_STOPPED.

Enumerator
SCE_SM_STATUS_READY 
SCE_SM_STATUS_RUNNING 
SCE_SM_STATUS_STOPPED 
SCE_SM_STATUS_FORCE_STOPPED 
SCE_SM_STATUS_START_RESUME_REQUESTED 
SCE_SM_STATUS_SUSPENDING 
SCE_SM_STATUS_SUSPEND_REQUESTED 

Function Documentation

◆ VITASDK_BUILD_ASSERT_EQ() [1/2]

VITASDK_BUILD_ASSERT_EQ ( 4  ,
SceSblSmSchedProxyErrorCode   
)

◆ VITASDK_BUILD_ASSERT_EQ() [2/2]

VITASDK_BUILD_ASSERT_EQ ( 1  ,
SceSmStatus   
)

◆ ksceSblSmSchedCallFunc()

int ksceSblSmSchedCallFunc ( SceSmSchedRequestId  req_id,
SceUInt32  mailbox_id,
SceUInt32  mail_mask 
)

Set bits in an ARM-to-Cry scheduler mailbox through SMC 0x133.

Parameters
req_id- Scheduler request ID.
mailbox_id- Mailbox ID in the range 1 through 3.
mail_mask- Bits to set.
Returns
Secure-monitor result or a negative scheduler validation error.

◆ ksceSblSmSchedProxyForceStop()

int ksceSblSmSchedProxyForceStop ( SceSmSchedRequestId  req_id)

Forcibly stop a secure-module scheduler request through SMC 0x130.

SCE_SM_STATUS_READY and SCE_SM_STATUS_SUSPENDING requests are first moved to SCE_SM_STATUS_READY and then enter SCE_SM_STATUS_FORCE_STOPPED. SCE_SM_STATUS_RUNNING and SCE_SM_STATUS_START_RESUME_REQUESTED requests issue secure control command 0x501 and transition through internal states 0xC and 0x9 before reaching SCE_SM_STATUS_FORCE_STOPPED.

Parameters
req_id- Scheduler request ID.
Returns
0 on success, SCE_SM_SCHED_PROXY_ERROR_REQUEST_ALREADY_STOPPED when the request is not in a stoppable state, or another negative scheduler validation error.

◆ ksceSblSmSchedProxyReleaseIntrHandler()

int ksceSblSmSchedProxyReleaseIntrHandler ( SceSmSchedRequestId  req_id,
SceUInt32  interrupt_index 
)

Release a scheduler interrupt handler through SMC 0x139.

Parameters
req_id- Scheduler request ID.
interrupt_index- Interrupt index in the range 0 through 3.

The local handler slot is cleared before the secure-monitor call and is not restored if that call fails.

Returns
Secure-monitor result or a negative scheduler validation error.

◆ ksceSblSmSchedProxyRegisterIntrHandler()

int ksceSblSmSchedProxyRegisterIntrHandler ( SceSmSchedRequestId  req_id,
SceUInt32  interrupt_index,
SceSblSmSchedProxyIntrHandler *  handler,
int  callback_arg 
)

Register a scheduler interrupt handler through SMC 0x138.

Parameters
req_id- Scheduler request ID.
interrupt_index- Interrupt index in the range 0 through 3.
handler- Interrupt handler; must be non-NULL.
callback_arg- Value passed unchanged as the handler's third argument.

If a notification is already pending, the handler is called before this function executes the secure-monitor command. The handler remains installed locally if the secure-monitor call fails.

Returns
Secure-monitor result or a negative scheduler validation error.

◆ ksceSblSmSchedProxyExecuteSKCommand()

int ksceSblSmSchedProxyExecuteSKCommand ( SceUInt32  command_index,
SceUInt32  unused1,
SceUInt32  unused2,
SceUInt32  unused3 
)

Execute a secure scheduler control command selected by index through SMC 0x13C.

FW 3.60 accepts command indices 0 through 4 and writes control values 0xB01 through 0xF01 respectively to the secure scheduler control register. The three remaining arguments are forwarded by the non-secure proxy but ignored by the secure handler.

SceSdif uses command index 3 while resetting the eMMC host controller. SceSblSsMgr uses command index 4 at the end of the 0x20F-through-0x200 system-suspend event sequence. These call sites do not establish the exact hardware purposes of either command.

Parameters
command_index- Secure-monitor command index.
unused1- Ignored on FW 3.60; set to 0.
unused2- Ignored on FW 3.60; set to 0.
unused3- Ignored on FW 3.60; set to 0.
Returns
0 on success, SCE_SM_SCHED_PROXY_ERROR_INVALID_ARGUMENT for an index greater than 4, or SCE_SM_SCHED_PROXY_ERROR_NOT_INITIALIZED.

◆ ksceSblSmSchedProxyReadArm2Cry()

int ksceSblSmSchedProxyReadArm2Cry ( SceSmSchedRequestId  req_id,
SceUInt32  mailbox_id,
SceUInt32 *  mail_value 
)

Read an ARM-to-Cry mailbox through SMC 0x134.

Parameters
req_id- Scheduler request ID.
mailbox_id- Mailbox ID in the range 1 through 3.
mail_value- Receives the register value; must be non-NULL.
Returns
Secure-monitor result or a negative scheduler validation error.

◆ ksceSblSmSchedProxyGetStatus()

int ksceSblSmSchedProxyGetStatus ( SceSmSchedRequestId  req_id,
SceSblSmCommPair *  result 
)

Query a secure-module request through SMC 0x12F.

Parameters
req_id- Scheduler request ID.
result- Receives the secure-module result and scheduler status; must be non-NULL. Unlike ksceSblSmSchedProxyWait, this function does not release the request record.
Returns
Secure-monitor result or a negative scheduler validation error.

◆ ksceSblSmSchedProxyInitialize()

int ksceSblSmSchedProxyInitialize ( void  )

Initialize the scheduler proxy.

Initialization runs only when this function is called on CPU 0.

Returns
0 on success, < 0 on error.

◆ ksceSblSmSchedProxyInvoke()

int ksceSblSmSchedProxyInvoke ( SceBool  priority,
SceUIntPtr  pa_ranges_paddr,
SceSize  pa_range_count,
const SceSmInvokeDataBlockInput *  invoke_input,
const SceSblSmCommContext130 *  context,
SceSmSchedRequestId *  request_id 
)

Start a secure-module scheduler request through SMC 0x12D.

Parameters
priority- Boolean priority: 0 for high priority, 1 for low priority.
pa_ranges_paddr- Physical address of an array of SceKernelPARange entries. It is required when (context->self_type & 0xF000) == 0 and must be 0 when that value is 0x1000.
pa_range_count- Number of entries in the physical-address range array. It must be 0 when (context->self_type & 0xF000) == 0x1000.
invoke_input- Optional four-word startup data, copied unchanged. The secure module defines their meaning; the scheduler does not interpret them. NULL passes four zero words.
context- Launch context; must be non-NULL. FW 3.60 reads only self_type, media_type, and the program authority ID and capability from spawner_self_auth_info.
request_id- Receives the scheduler request ID; must be non-NULL.

Values of context->self_type & 0xF000 other than 0 or 0x1000 are rejected. A request ID is assigned before the shared-buffer and secure-monitor work; callers may therefore receive an assigned ID even when a later step fails. The proxy can track at most 64 concurrent request records.

Returns
Secure-monitor result or a negative scheduler/kernel error.

◆ ksceSblSmSchedProxyReadCry2Arm()

int ksceSblSmSchedProxyReadCry2Arm ( SceSmSchedRequestId  req_id,
SceUInt32  mailbox_id,
SceUInt32 *  mail_value 
)

Read a Cry-to-ARM mailbox through SMC 0x137.

Parameters
req_id- Scheduler request ID.
mailbox_id- Mailbox ID in the range 1 through 3.
mail_value- Receives the mailbox value; must be non-NULL.
Returns
Secure-monitor result or a negative scheduler validation error.

◆ ksceSblSmSchedProxyUninitialize()

int ksceSblSmSchedProxyUninitialize ( void  )

Uninitialize the scheduler proxy.

Uninitialization runs only when this function is called on CPU 0.

Returns
Secure-monitor result or 0 when called on another CPU.

◆ ksceSblSmSchedProxyWait()

int ksceSblSmSchedProxyWait ( SceSmSchedRequestId  req_id,
SceSblSmCommPair *  result 
)

Wait for a secure-module request to complete through SMC 0x12E.

Parameters
req_id- Scheduler request ID.
result- Receives the secure-module result and scheduler status; must be non-NULL. The request record is released before this function returns.
Returns
Secure-monitor result or a negative scheduler/kernel error.

◆ ksceSblSmSchedProxyClearArm2Cry()

int ksceSblSmSchedProxyClearArm2Cry ( SceSmSchedRequestId  req_id,
SceUInt32  mailbox_id,
SceUInt32  mail_mask 
)

Clear bits in an ARM-to-Cry mailbox through SMC 0x135.

Parameters
req_id- Scheduler request ID.
mailbox_id- Mailbox ID in the range 1 through 3.
mail_mask- Bits to clear.
Returns
Secure-monitor result or a negative scheduler validation error.

◆ ksceSblSmSchedProxyClearCry2Arm()

int ksceSblSmSchedProxyClearCry2Arm ( SceSmSchedRequestId  req_id,
SceUInt32  mailbox_id,
SceUInt32  mail_mask 
)

Clear bits in a Cry-to-ARM mailbox through SMC 0x136.

Parameters
req_id- Scheduler request ID.
mailbox_id- Mailbox ID in the range 1 through 3.
mail_mask- Bits to clear.
Returns
Secure-monitor result or a negative scheduler validation error.

◆ SceSblSmSchedProxyForKernel_1DFC8624()

int SceSblSmSchedProxyForKernel_1DFC8624 ( void  )

Does nothing on FW 3.60.

Returns
Always 0x800F0425 on FW 3.60.

◆ SceSblSmSchedProxyForKernel_984EC9D1()

int SceSblSmSchedProxyForKernel_984EC9D1 ( void  )

Does nothing on FW 3.60.

Returns
Always 0x800F0425 on FW 3.60.