Skip to content

Commit

Permalink
Change arg types of svcCreateCodeSet and improve documentation
Browse files Browse the repository at this point in the history
Since kernel doesn't directly access the LMA, but just does memory
management on them instead, they should be passed as u32 (uptr) instead
of void *.

Also change CodeSetInfo to CodeSetHeader to avoid confusion with
ExHeader types.
  • Loading branch information
TuxSH committed Feb 8, 2023
1 parent a306280 commit cd78fb0
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions libctru/include/3ds/svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,8 @@ typedef enum {
/// 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;
u16 version; ///< Version field of codeset (unused)
u16 padding[3]; ///< Padding
u32 text_addr; ///< .text start address
u32 text_size; ///< .text number of pages
u32 ro_addr; ///< .rodata start address
Expand All @@ -509,9 +508,9 @@ typedef struct {
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;
u32 padding2; ///< Padding
u64 program_id; ///< Program ID
} CodeSetInfo;
} CodeSetHeader;

/// Information for the main thread of a process.
typedef struct
Expand Down Expand Up @@ -756,23 +755,24 @@ Result svcCreatePort(Handle* portServer, Handle* portClient, const char* name, s
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
* @brief Sets up virtual address space for a new process.
* @param[out] out Pointer to output the codeset handle to.
* @param info Codeset header, contains process name, titleId and segment info.
* @param textSegmentLma Address of executable segment in caller's address space.
* @param roSegmentLma Address of read-only segment in caller's address space.
* @param dataSegmentLma Address of read-write segment in caller's address space.
* @note On success, the provided segments are unmapped from the caller's address space.
*/
Result svcCreateCodeSet(Handle* out, const CodeSetInfo *info, void* code_ptr, void* ro_ptr, void* data_ptr);
Result svcCreateCodeSet(Handle* out, const CodeSetHeader* info, u32 textSegmentLma, u32 roSegmentLma, u32 dataSegmentLma);

/**
* @brief Sets up virtual address space for a new process
* @brief Create 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
* @param codeset Codeset created for this process.
* @param arm11KernelCaps Arm11 Kernel Capabilities from exheader.
* @param numArm11KernelCaps Number of kernel capabilities.
*/
Result svcCreateProcess(Handle* out, Handle codeset, const u32 *arm11kernelcaps, u32 arm11kernelcaps_num);
Result svcCreateProcess(Handle* out, Handle codeset, const u32* arm11KernelCaps, s32 numArm11KernelCaps);

/**
* @brief Gets a process's affinity mask.
Expand Down

0 comments on commit cd78fb0

Please sign in to comment.