Merge pull request #159 from Lectem/documentation

documentation for the soc service and svcCreateMemoryBlock
This commit is contained in:
fincs 2015-09-05 17:46:49 +02:00
commit e7e21fa9d5
2 changed files with 27 additions and 1 deletions

View File

@ -1,7 +1,23 @@
/**
* @file soc.h
* @brief SOC service for sockets communications
*
* After initializing this service you will be able to use system calls from netdb.h, sys/socket.h etc.
*/
#pragma once
Result SOC_Initialize(u32 *context_addr, u32 context_size);//Example context_size: 0x48000. The specified context buffer can no longer be accessed by the process which called this function, since the userland permissions for this block are set to no-access.
/**
* @brief Initializes the SOC service.
* @param context_addr Address of a page-aligned (0x1000) buffer to be used.
* @param context_size Size of the buffer, a multiple of 0x1000.
* @note The specified context buffer can no longer be accessed by the process which called this function, since the userland permissions for this block are set to no-access.
*/
Result SOC_Initialize(u32 *context_addr, u32 context_size);
/**
* @brief Closes the soc service.
* @note You need to call this in order to be able to use the buffer again.
*/
Result SOC_Shutdown(void);
/* this is supposed to be in unistd.h but newlib only puts it for cygwin */

View File

@ -265,6 +265,16 @@ Result svcControlMemory(u32* addr_out, u32 addr0, u32 addr1, u32 size, MemOp op,
*/
Result svcControlProcessMemory(Handle process, u32 addr0, u32 addr1, u32 size, u32 type, u32 perm);
/**
* @brief Creates a block of shared memory
* @param memblock Pointer to store the handle of the block
* @param addr Address of the memory to map, page-aligned. So its alignment must be 0x1000.
* @param size Size of the memory to map, a multiple of 0x1000.
* @param my_perm Memory permissions for the current process
* @param my_perm Memory permissions for the other processes
*
* @note The shared memory block, and its rights, are destroyed when the handle is closed.
*/
Result svcCreateMemoryBlock(Handle* memblock, u32 addr, u32 size, MemPerm my_perm, MemPerm other_perm);
Result svcMapMemoryBlock(Handle memblock, u32 addr, MemPerm my_perm, MemPerm other_perm);
Result svcMapProcessMemory(Handle process, u32 startAddr, u32 endAddr);