]> Chaos Git - corbenik/ctrulib.git/commitdiff
Added svc calls for svcCreateCodeSet and svcCreateProcess
authorYifan Lu <me@yifanlu.com>
Sat, 23 Jan 2016 00:18:13 +0000 (16:18 -0800)
committerYifan Lu <me@yifanlu.com>
Sat, 23 Jan 2016 22:32:36 +0000 (14:32 -0800)
libctru/include/3ds/svc.h
libctru/source/svc.s

index 8a5af5895eed93c7e76c6dda197097411515036c..68f884ee536857b4f07e9e223e5822e2770d1684 100644 (file)
@@ -241,6 +241,30 @@ typedef struct {
 
 ///@}
 
+///@name Processes
+///@{
+
+/// Information on address space for process. All sizes are in pages (0x1000 bytes)
+typedef struct {
+       u8 name[8];           ///< ASCII name of codeset
+       u16 unk1;
+       u16 unk2;
+       u32 unk3;
+       u32 text_addr;        ///< .text start address
+       u32 text_size;        ///< .text number of pages
+       u32 ro_addr;          ///< .rodata start address
+       u32 ro_size;          ///< .rodata number of pages
+       u32 rw_addr;          ///< .data, .bss start address
+       u32 rw_size;          ///< .data number of pages
+       u32 text_size_total;  ///< total pages for .text (aligned)
+       u32 ro_size_total;    ///< total pages for .rodata (aligned)
+       u32 rw_size_total;    ///< total pages for .data, .bss (aligned)
+       u32 unk4;
+       u64 program_id;       ///< Program ID
+} CodeSetInfo;
+
+///@}
+
 /**
  * @brief Gets the thread local storage buffer.
  * @return The thread local storage bufger.
@@ -487,6 +511,25 @@ Result svcCreatePort(Handle* portServer, Handle* portClient, const char* name, s
  * @param portName Name of the port.
  */
 Result svcConnectToPort(volatile Handle* out, const char* portName);
+
+/**
+ * @brief Sets up virtual address space for a new process
+ * @param[out] out Pointer to output the code set handle to.
+ * @param info Description for setting up the addresses
+ * @param code_ptr Pointer to .text in shared memory
+ * @param ro_ptr Pointer to .rodata in shared memory
+ * @param data_ptr Pointer to .data in shared memory
+ */
+Result svcCreateCodeSet(Handle* out, const CodeSetInfo *info, void* code_ptr, void* ro_ptr, void* data_ptr);
+
+/**
+ * @brief Sets up virtual address space for a new process
+ * @param[out] out Pointer to output the process handle to.
+ * @param codeset Codeset created for this process
+ * @param arm11kernelcaps ARM11 Kernel Capabilities from exheader
+ * @param arm11kernelcaps_num Number of kernel capabilities
+ */
+Result svcCreateProcess(Handle* out, Handle codeset, u32 *arm11kernelcaps, u32 arm11kernelcaps_num);
 ///@}
 
 ///@name Multithreading
index 2e00f0fbf84585bb5c7a265dece9f7246e176881..e69c5585357b577c617fefbb730acf99710830c9 100644 (file)
@@ -404,6 +404,23 @@ SVC_BEGIN svcUnmapProcessMemory
        svc 0x72
        bx  lr
 
+SVC_BEGIN svcCreateCodeSet
+       str r0, [sp, #-0x4]!
+       ldr r0, [sp, #4]
+       svc 0x73
+       ldr r2, [sp, #0]
+       str r1, [r2]
+       add sp, sp, #4
+       bx  lr
+
+SVC_BEGIN svcCreateProcess
+       str r0, [sp, #-0x4]!
+       svc 0x75
+       ldr r2, [sp, #0]
+       str r1, [r2]
+       add sp, sp, #4
+       bx  lr
+
 SVC_BEGIN svcTerminateProcess
        svc 0x76
        bx  lr