Add svcSetProcessAffinityMask, svcSetProcessIdealProcessor and svcRun

This commit is contained in:
fincs 2016-05-17 00:14:32 +02:00
parent 3ed89e6bd9
commit 7ce124e744
2 changed files with 54 additions and 2 deletions

View File

@ -263,6 +263,16 @@ typedef struct {
u64 program_id; ///< Program ID u64 program_id; ///< Program ID
} CodeSetInfo; } CodeSetInfo;
/// Information for the main thread of a process.
typedef struct
{
int priority; ///< Priority of the main thread.
u32 stack_size; ///< Size of the stack of the main thread.
int argc; ///< Unused on retail kernel.
u16* argv; ///< Unused on retail kernel.
u16* envp; ///< Unused on retail kernel.
} StartupInfo;
///@} ///@}
/** /**
@ -529,7 +539,30 @@ Result svcCreateCodeSet(Handle* out, const CodeSetInfo *info, void* code_ptr, vo
* @param arm11kernelcaps ARM11 Kernel Capabilities from exheader * @param arm11kernelcaps ARM11 Kernel Capabilities from exheader
* @param arm11kernelcaps_num Number of kernel capabilities * @param arm11kernelcaps_num Number of kernel capabilities
*/ */
Result svcCreateProcess(Handle* out, Handle codeset, u32 *arm11kernelcaps, u32 arm11kernelcaps_num); Result svcCreateProcess(Handle* out, Handle codeset, const u32 *arm11kernelcaps, u32 arm11kernelcaps_num);
/**
* @brief Sets a process's affinity mask.
* @param process Handle of the process.
* @param affinitymask Pointer to retrieve the affinity masks from.
* @param processorcount Number of processors.
*/
Result svcSetProcessAffinityMask(Handle process, const u8* affinitymask, s32 processorcount);
/**
* Sets a process's ideal processor.
* @param process Handle of the process.
* @param processorid ID of the thread's ideal processor.
*/
Result svcSetProcessIdealProcessor(Handle process, s32 processorid);
/**
* Launches the main thread of the process.
* @param process Handle of the process.
* @param info Pointer to a StartupInfo structure describing information for the main thread.
*/
Result svcRun(Handle process, const StartupInfo* info);
///@} ///@}
///@name Multithreading ///@name Multithreading
@ -602,7 +635,7 @@ Result svcGetThreadAffinityMask(u8* affinitymask, Handle thread, s32 processorco
* @param affinitymask Pointer to retrieve the affinity masks from. * @param affinitymask Pointer to retrieve the affinity masks from.
* @param processorcount Number of processors. * @param processorcount Number of processors.
*/ */
Result svcSetThreadAffinityMask(Handle thread, u8* affinitymask, s32 processorcount); Result svcSetThreadAffinityMask(Handle thread, const u8* affinitymask, s32 processorcount);
/** /**
* @brief Gets a thread's ideal processor. * @brief Gets a thread's ideal processor.

View File

@ -37,6 +37,14 @@ SVC_BEGIN svcExitProcess
svc 0x03 svc 0x03
bx lr bx lr
SVC_BEGIN svcSetProcessAffinityMask
svc 0x05
bx lr
SVC_BEGIN svcSetProcessIdealProcessor
svc 0x07
bx lr
SVC_BEGIN svcCreateThread SVC_BEGIN svcCreateThread
push {r0, r4} push {r0, r4}
ldr r0, [sp, #0x8] ldr r0, [sp, #0x8]
@ -89,6 +97,17 @@ SVC_BEGIN svcGetProcessorID
svc 0x11 svc 0x11
bx lr bx lr
SVC_BEGIN svcRun
push {r4,r5}
ldr r2, [r1, #0x04]
ldr r3, [r1, #0x08]
ldr r4, [r1, #0x0C]
ldr r5, [r1, #0x10]
ldr r1, [r1, #0x00]
svc 0x12
pop {r4,r5}
bx lr
SVC_BEGIN svcCreateMutex SVC_BEGIN svcCreateMutex
str r0, [sp, #-4]! str r0, [sp, #-4]!
svc 0x13 svc 0x13