https://www.3dbrew.org/w/api.php?action=feedcontributions&user=Ichfly&feedformat=atom
3dbrew - User contributions [en]
2024-03-29T11:56:16Z
User contributions
MediaWiki 1.35.8
https://www.3dbrew.org/w/index.php?title=GPU/External_Registers&diff=12968
GPU/External Registers
2015-07-27T15:39:36Z
<p>Ichfly: /* Map */</p>
<hr />
<div>This page describes the address range accessible from the ARM11, used to configure the basic GPU functionality. For information about the internal registers used for 3D rendering, see [[GPU:Internal Registers]].<br />
<br />
== Map ==<br />
{| class="wikitable" border="1"<br />
! User VA<br />
! PA<br />
! Length<br />
! Name<br />
! Comments<br />
|-<br />
| 0x1EF00004<br />
| 0x10400004<br />
| 4<br />
| ?<br />
|<br />
|-<br />
| 0x1EF00010<br />
| 0x10400010<br />
| 16<br />
| [[#Memory Fill|Memory Fill1]] "PSC0"<br />
| GX command 2<br />
|-<br />
| 0x1EF00020<br />
| 0x10400020<br />
| 16<br />
| [[#Memory Fill|Memory Fill2]] "PSC1"<br />
| GX command 2<br />
|-<br />
| 0x1EF00030<br />
| 0x10400030<br />
| 4<br />
| ?<br />
|<br />
|-<br />
| 0x1EF00034<br />
| 0x10400034<br />
| 4<br />
| GPU Busy<br />
| Bit31 = cmd-list busy, bit27 = PSC0 busy, bit26 = PSC1 busy.<br />
|-<br />
| 0x1EF00050<br />
| 0x10400050<br />
| 4<br />
| ?<br />
| Writes 0x22221200 on GPU init.<br />
|-<br />
| 0x1EF00054<br />
| 0x10400054<br />
| 4<br />
| ?<br />
| Writes 0xFF2 on GPU init.<br />
|-<br />
| 0x1EF00400<br />
| 0x10400400<br />
| 0x100<br />
| [[#Framebuffer_Setup|Framebuffer Setup]] "PDC0" (top screen)<br />
|<br />
|-<br />
| 0x1EF00500<br />
| 0x10400500<br />
| 0x100<br />
| [[#Framebuffer_Setup|Framebuffer Setup]] "PDC1" (bottom)<br />
|<br />
|-<br />
| 0x1EF00C00<br />
| 0x10400C00<br />
| ?<br />
| [[#Transfer_Engine|Transfer Engine]] "DMA"<br />
|<br />
|-<br />
| 0x1EF01000<br />
| 0x10401000<br />
| 0x4<br />
| ?<br />
| Writes 0 on GPU init and before the Command List is used<br />
|-<br />
| 0x1EF01080<br />
| 0x10401080<br />
| 0x4<br />
| ?<br />
| Writes 0x12345678 on GPU init.<br />
|-<br />
| 0x1EF010C0<br />
| 0x104010C0<br />
| 0x4<br />
| ?<br />
| Writes 0xFFFFFFF0 on GPU init.<br />
|-<br />
| 0x1EF010D0<br />
| 0x104010D0<br />
| 0x4<br />
| ?<br />
| Writes 1 on GPU init.<br />
|-<br />
| 0x1EF014??<br />
| 0x104014??<br />
| 0x14<br />
| "PPF" ?<br />
|<br />
|-<br />
| 0x1EF018E0<br />
| 0x104018E0<br />
| 0x14<br />
| [[#Command_List|Command List]] "P3D"<br />
|<br />
|}<br />
<br />
== Memory Fill ==<br />
{| class="wikitable" border="1"<br />
! User VA<br />
! Description<br />
|-<br />
| 0x1EF000X0<br />
| Buffer start physaddr >> 3<br />
|-<br />
| 0x1EF000X4<br />
| Buffer end physaddr >> 3<br />
|-<br />
| 0x1EF000X8<br />
| Fill value<br />
|-<br />
| 0x1EF000XC<br />
| Control. bit0: start/busy, bit1: finished, bit8-9: fill-width (0=16bit, 1=3=24bit, 2=32bit)<br />
|}<br />
<br />
Memory fills are used to initialize buffers in memory with a given value, similar to memset. A memory fill is triggered by setting bit0 in the control register. Doing so aborts any running memory fills on that filling unit. Upon completion, the hardware unsets bit0 and sets bit1 and fires interrupt PSC0.<br />
<br />
These registers are used by [[GSP Shared Memory#GX SetMemoryFill|GX SetMemoryFill]].<br />
<br />
== LCD Source Framebuffer Setup ==<br />
{| class="wikitable" border="1"<br />
! Offset<br />
! Length<br />
! Name<br />
! Comments<br />
|-<br />
| 0x5C<br />
| 4<br />
| Framebuffer width & height<br />
| Lower 16 bits: width, upper 16 bits: height<br />
|-<br />
| 0x68<br />
| 4<br />
| Framebuffer A first address<br />
| For top screen, this is the left eye 3D framebuffer.<br />
|-<br />
| 0x6C<br />
| 4<br />
| Framebuffer A second address<br />
| For top screen, this is the left eye 3D framebuffer.<br />
|-<br />
| 0x70<br />
| 4<br />
| Framebuffer format<br />
| Bit0-15: framebuffer format, bit16-31: unknown<br />
|-<br />
| 0x78<br />
| 4<br />
| Framebuffer select<br />
| Bit0: which framebuffer to display, bit1-7: unknown<br />
|-<br />
| 0x90<br />
| 4<br />
| Framebuffer stride<br />
| Distance in bytes between the start of two framebuffer rows (must be a multiple of 8).<br />
|-<br />
| 0x94<br />
| 4<br />
| Framebuffer B first address<br />
| For top screen, this is the right eye 3D framebuffer. Unused for bottom screen.<br />
|-<br />
| 0x98<br />
| 4<br />
| Framebuffer B second address<br />
| For top screen, this is the right eye 3D framebuffer. Unused for bottom screen.<br />
|}<br />
<br />
=== Framebuffer format ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Bit<br />
! Description<br />
|-<br />
| 2-0<br />
| Color format<br />
|-<br />
| 3<br />
| ?<br />
|-<br />
| 4<br />
| Unused?<br />
|-<br />
| 5<br />
| Set when the main screen 3D right framebuffer address is set.<br />
|-<br />
| 6<br />
| 1 = main screen, 0 = sub screen. However if bit5 is set, this bit is cleared.<br />
|-<br />
| 7<br />
| ?<br />
|-<br />
| 9-8<br />
| Value 1 = unknown: get rid of rainbow strip on top of screen, 3 = unknown: black screen.<br />
|-<br />
| 15-10<br />
| Unused?<br />
|}<br />
<br />
GSP module only allows the LCD stereoscopy to be enabled when bit5=1 and bit6=0 here. When GSP module updates this register, GSP module will automatically disable the stereoscopy if those bits are not set for enabling stereoscopy.<br />
<br />
=== Framebuffer color formats ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0<br />
| GL_RGBA8_OES<br />
|-<br />
| 1<br />
| GL_RGB8_OES<br />
|-<br />
| 2<br />
| GL_RGB565_OES<br />
|-<br />
| 3<br />
| GL_RGB5_A1_OES<br />
|-<br />
| 4<br />
| GL_RGBA4_OES<br />
|}<br />
Color components are laid out in reverse byte order, with the most significant bits used first (i.e. non-24-bit pixels are stored as a little-endian values). For instance, a raw data stream of two GL_RGB565_OES pixels looks like GGGBBBBB RRRRRGGG GGGBBBBB RRRRRGGG.<br />
<br />
== Transfer Engine ==<br />
{| class="wikitable" border="1"<br />
! Register address<br />
! Description<br />
|-<br />
| 0x1EF00C00<br />
| Input physical address>>3<br />
|-<br />
| 0x1EF00C04<br />
| Output physical address>>3<br />
|-<br />
| 0x1EF00C08<br />
| Output framebuffer dimensions, used with cmd3<br />
|-<br />
| 0x1EF00C0C<br />
| Input framebuffer dimensions, used with cmd3<br />
|-<br />
| 0x1EF00C10<br />
| Flags, used with cmd3 and cmd4.<br />
|-<br />
| 0x1EF00C14<br />
| GSP module writes value 0 here prior to writing to 0x1EF00C18, for cmd3.<br />
|-<br />
| 0x1EF00C18<br />
| Setting bit0 starts the transfer. Upon completion, bit0 is unset and bit8 is set.<br />
|-<br />
| 0x1EF00C20<br />
| Texture info? used with cmd4 ("Size" in [[GSP_Shared_Memory|GX command]])<br />
|-<br />
| 0x1EF00C24<br />
| Texture info? used with cmd4 ("Input dimensions?" in [[GSP_Shared_Memory|GX command]])<br />
|-<br />
| 0x1EF00C28<br />
| Texture info? used with cmd4 ("Output dimensions?" in [[GSP_Shared_Memory|GX command]])<br />
|}<br />
<br />
These registers are used by [[GSP_Shared_Memory|GX command]] 3 and 4. For cmd4, *0x1EF00C18 |= 1 is used instead of just writing value 1. The dimensions fields seem to use the same format as [[LCD]] register 0x1EF00X5C. The input framebuffer width for the main screen is normally 480.<br />
<br />
==== 0x1EF00C10 ====<br />
{| class="wikitable" border="1"<br />
! Bit<br />
! Description<br />
|-<br />
| 0<br />
| When set, the framebuffer data is flipped vertically.<br />
|-<br />
| 1<br />
| When set, the input framebuffer is treated as linear and converted to tiled in the output, converts tiled->linear when unset.<br />
|-<br />
| 2<br />
| This bit is set when the out-framebuf width/height is less than the input framebuf width/height, clear otherwise. Bit24 is normally clear when this bit is set.<br />
|-<br />
| 3<br />
| When set, the input framebuffer data is copied as-is to the output framebuffer, without any kind of conversions. The data is truncated to the output size.<br />
|-<br />
| 4<br />
| Not writable<br />
|-<br />
| 5<br />
| Writable, but purpose unknown (usually zero)<br />
|-<br />
| 7-6<br />
| Not writable<br />
|-<br />
| 10-8<br />
| Input framebuffer color format, value0 and value1 are the same as the [[GPU Registers#Framebuffer_color_formats|LCD Source Framebuffer Formats]] (usually zero)<br />
|-<br />
| 11<br />
| Not writable<br />
|-<br />
| 14-12<br />
| Output framebuffer color format<br />
|-<br />
| 15<br />
| Not writable<br />
|-<br />
| 16<br />
| Unknown, normally zero.<br />
|-<br />
| 17-23<br />
| Not writable<br />
|-<br />
| 24<br />
| Scale down the input image to its half width using a box filter.<br />
|-<br />
| 25<br />
| Scale down the input image to its half height and half width using a box filter.<br />
|-<br />
| 31-26<br />
| Not writable<br />
|}<br />
<br />
== Command List ==<br />
{| class="wikitable" border="1"<br />
! Register address<br />
! Description<br />
|-<br />
| 0x1EF018E0<br />
| Buffer size in bytes >> 3<br />
|-<br />
| 0x1EF018E8<br />
| Buffer physical address >> 3<br />
|-<br />
| 0x1EF018F0<br />
| Setting bit0 to 1 enables processing GPU command execution. Upon completion, bit0 seems to be reset to 0.<br />
|}<br />
<br />
These 3 registers are used by [[GSP_Shared_Memory|GX command]] 1. This is used for [[GPU_Commands|GPU commands]].<br />
<br />
== Framebuffers ==<br />
These LCD framebuffers normally contain the last rendered frames from the GPU. The framebuffers are drawn from left-to-right, instead of top-to-bottom.(Thus the beginning of the framebuffer is drawn starting at the left side of the screen)<br />
<br />
Both of the 3D screen left/right framebuffers are displayed regardless of the 3D slider's state, however when the 3D slider is set to "off" the 3D effect is disabled. Normally when the 3D slider's state is set to "off" the left/right framebuffer addresses are set to the same physical address. When the 3D effect is disabled and the left/right framebuffers are set to separate addresses, the LCD seems to alternate between displaying the left/right framebuffer each frame.<br />
<br />
==== Init Values from nngxInitialize for Top Screen ====<br />
* 0x1EF00400 = 0x1C2<br />
* 0x1EF00404 = 0xD1<br />
* 0x1EF00408 = 0x1C1<br />
* 0x1EF0040C = 0x1C1<br />
* 0x1EF00410 = 0<br />
* 0x1EF00414 = 0xCF<br />
* 0x1EF00418 = 0xD1<br />
* 0x1EF0041C = 0x1C501C1<br />
* 0x1EF00420 = 0x10000<br />
* 0x1EF00424 = 0x19D<br />
* 0x1EF00428 = 2<br />
* 0x1EF0042C = 0x1C2<br />
* 0x1EF00430 = 0x1C2<br />
* 0x1EF00434 = 0x1C2<br />
* 0x1EF00438 = 1<br />
* 0x1EF0043C = 2<br />
* 0x1EF00440 = 0x1960192<br />
* 0x1EF00444 = 0<br />
* 0x1EF00448 = 0<br />
* 0x1EF0045C = 0x19000F0<br />
* 0x1EF00460 = 0x1c100d1<br />
* 0x1EF00464 = 0x1920002<br />
* 0x1EF00470 = 0x80340<br />
* 0x1EF0049C = 0<br />
<br />
==== More Init Values from nngxInitialize for Top Screen ====<br />
* 0x1EF00468 = 0x18300000, later changed by GSP module when updating state, framebuffer<br />
* 0x1EF0046C = 0x18300000, later changed by GSP module when updating state, framebuffer<br />
* 0x1EF00494 = 0x18300000<br />
* 0x1EF00498 = 0x18300000<br />
* 0x1EF00478 = 1, doesn't stay 1, read as 0<br />
* 0x1EF00474 = 0x10501</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Talk:DSP:RegisterInterruptEvents&diff=12859
Talk:DSP:RegisterInterruptEvents
2015-06-21T18:42:56Z
<p>Ichfly: ups</p>
<hr />
<div>DSP really changes header in answer? but why? applications never checks it, as far as i know<br />
--[[User:Mailwl|Mailwl]] 13:47, 21 June 2015 (CEST)<br />
Many do that in case of an error for example some errors in the GSP come back with 0x00000040<br />
--[[User:ichfly]]</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Talk:DSP:RegisterInterruptEvents&diff=12858
Talk:DSP:RegisterInterruptEvents
2015-06-21T18:42:44Z
<p>Ichfly: </p>
<hr />
<div>DSP really changes header in answer? but why? applications never checks it, as far as i know<br />
--[[User:Mailwl|Mailwl]] 13:47, 21 June 2015 (CEST)<br />
Many do that in case of an error for example some errors in the GSP come back with 0x00000040<br />
--[[User:John]]</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=IPC&diff=12262
IPC
2015-04-09T16:27:01Z
<p>Ichfly: </p>
<hr />
<div>The IPC commands are written to the Thread Local Storage, at offset 0x80. Every IPC command sent to services starts with a u32 header code, and parameters, if any, are written after this header. If the kernel was able to dispatch the request, the server reply will be written to TLS+0x80. Often the first word of the response data is the error code (or 0 if success).<br />
<br />
The command header is a 32-bit integer that can be decompossed in the following parts:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Bits<br />
! Description<br />
|-<br />
| 0-5<br />
| Number of translate parameters (=y)<br />
|-<br />
| 6-11<br />
| Number of normal parameters (=x)<br />
|-<br />
| 12-15<br />
| Unused<br />
|-<br />
| 16-31<br />
| Command ID<br />
|}<br />
<br />
The entire command has the following structure:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Word<br />
! Size<br />
! Description<br />
|-<br />
| 0<br />
| 1<br />
| Header code<br />
|-<br />
| 1<br />
| x<br />
| Normal parameters<br />
|-<br />
| x<br />
| y<br />
| Translate parameters<br />
|}<br />
<br />
Translate parameters are modified/translated transparently by the kernel. They are used to transfer handles/buffers between the different processes.<br />
<br />
The type of parameter is described by the bits 1-3 in the translation descriptor. Parameter types accepted for sending by the kernel are: 0, 1, 2, 5, 6, 7. <br />
Type 0 is used to send handles across processes:<br />
if desc & 0x30 == 0x20:<br />
write process id to value<br />
else:<br />
translate handle<br />
if desc & 0x30 == 0x10:<br />
close handle for caller<br />
<br />
For replies, only 0, 1, 5, 6, 7 are allowed. In other words any type 2 fields must be zeroed before calling svcReplyAndReceive on the server-side. For replies type 0, 1, 2 are ignored. Types 5, 6, 7 do something with the mem pointer upon reply. The type 0 descriptor can be used to ignore parameters. The number of parameters covered by a type-0 descriptor is (desc >> 26) + 1.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Type<br />
! scope="col" width="300" | Usual form<br />
! Description<br />
|-<br />
| 0<br />
| 0x00000000 <nowiki>|</nowiki> ((num_handles-1)<<26)<br />
<br />
<handle 0><br />
<br />
<handle 1><br />
...<br />
| The corresponding values are KHandles, that should be closed in calling process. Or zero otherwise.<br />
|-<br />
| 0<br />
| 0x00000010 <nowiki>|</nowiki> ((num_handles-1)<<26)<br />
<br />
<handle 0><br />
<br />
<handle 1><br />
...<br />
| The corresponding values are KHandles, that will be duplicated. Or zero otherwise.<br />
|-<br />
| 0<br />
| 0x00000020<br />
<placeholder><br />
| Let kernel set value to calling process ProcessID.<br />
|-<br />
| 1<br />
| 0x00000002 <nowiki>|</nowiki> (size<<14) <nowiki>|</nowiki> (static_buffer_id<<10)<br />
<ptr><br />
| The corresponding value contains a ptr to a buffer of said size, that should be copied to an already set-up buffer in destination process at [[Thread Local Storage]] offset 0x180 + static_buffer_id*8. The static_buffer_id is only 4 bits, making it possible for at most up to 16 buffers in total per thread.<br />
|-<br />
| 2<br />
| 0x00000004 <nowiki>|</nowiki> (size<<4)<br />
| This is used for PXI commands input/output buffers. The address written to the destination cmd-buf is a phys-addr for a table located in the BASE memregion. This table contains the phys-addrs for the actual data, the array entries have the following format: {u32 *datachunk_physaddr, u32 datachunk_bytesize}.<br />
|-<br />
| 3<br />
| <nowiki>0x00000006 | (size<<8)</nowiki><br />
| Does nothing?<br />
|-<br />
| 4<br />
| 0x00000008<br />
| This command will cause a kernelpanic.<br />
|-<br />
| 5<br />
| <nowiki>0x0000000A | (size<<4)</nowiki><br />
<ptr><br />
| The corresponding value contains a ptr to a buffer of said size. It is mapped R- in the destination process??<br />
|-<br />
| 6<br />
| 0x0000000C <nowiki>|</nowiki> (size<<4)<br />
<ptr><br />
| The corresponding value contains a ptr to a buffer of said size. It is mapped -W in the destination process??<br />
|-<br />
| 7<br />
| 0x0000000E <nowiki>|</nowiki> (size<<4)<br />
<ptr><br />
| The corresponding value contains a ptr to a buffer of said size. It is mapped RW in the destination process??<br />
|}<br />
<br />
Buffers from commands 5,6,7 will get mapped at virtual address 0x04000000+ in destination process.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=IPC&diff=12261
IPC
2015-04-09T16:25:30Z
<p>Ichfly: </p>
<hr />
<div>The IPC commands are written to the Thread Local Storage, at offset 0x80. Every IPC command sent to services starts with a u32 header code, and parameters, if any, are written after this header. If the kernel was able to dispatch the request, the server reply will be written to TLS+0x80. Often the first word of the response data is the error code (or 0 if success).<br />
<br />
The command header is a 32-bit integer that can be decompossed in the following parts:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Bits<br />
! Description<br />
|-<br />
| 0-5<br />
| Number of translate parameters (=y)<br />
|-<br />
| 6-11<br />
| Number of normal parameters (=x)<br />
|-<br />
| 12-15<br />
| Unused<br />
|-<br />
| 16-31<br />
| Command ID<br />
|}<br />
<br />
The entire command has the following structure:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Word<br />
! Size<br />
! Description<br />
|-<br />
| 0<br />
| 1<br />
| Header code<br />
|-<br />
| 1<br />
| x<br />
| Normal parameters<br />
|-<br />
| x<br />
| y<br />
| Translate parameters<br />
|}<br />
<br />
Translate parameters are modified/translated transparently by the kernel. They are used to transfer handles/buffers between the different processes.<br />
<br />
The type of parameter is described by the bits 1-3 in the translation descriptor. Parameter types accepted for sending by the kernel are: 0, 1, 2, 5, 6, 7. <br />
Type 0 is used to send handles across processes:<br />
if desc & 0x30 == 0x20:<br />
write process id to value<br />
else:<br />
translate handle<br />
if desc & 0x30 == 0x10:<br />
close handle for caller<br />
<br />
For replies, only 0, 1, 5, 6, 7 are allowed. In other words any type 2 fields must be zeroed before calling svcReplyAndReceive on the server-side. For replies type 0, 1, 2 are ignored. Types 5, 6, 7 do something with the mem pointer upon reply. The type 0 descriptor can be used to ignore parameters. The number of parameters covered by a type-0 descriptor is (desc >> 26) + 1.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Type<br />
! scope="col" width="300" | Usual form<br />
! Description<br />
|-<br />
| 0<br />
| 0x00000000 <nowiki>|</nowiki> ((num_handles-1)<<26)<br />
<br />
<handle 0><br />
<br />
<handle 1><br />
...<br />
| The corresponding values are KHandles, that should be closed in calling process. Or zero otherwise.<br />
|-<br />
| 0<br />
| 0x00000010 <nowiki>|</nowiki> ((num_handles-1)<<26)<br />
<br />
<handle 0><br />
<br />
<handle 1><br />
...<br />
| The corresponding values are KHandles, that will be duplicated. Or zero otherwise.<br />
|-<br />
| 0<br />
| 0x00000020<br />
<placeholder><br />
| Let kernel set value to calling process ProcessID.<br />
|-<br />
| 1<br />
| 0x00000002 <nowiki>|</nowiki> (size<<14) <nowiki>|</nowiki> (static_buffer_id<<10)<br />
<ptr><br />
| The corresponding value contains a ptr to a buffer of said size, that should be copied to an already set-up buffer in destination process at [[Thread Local Storage]] offset 0x180 + static_buffer_id*8. The static_buffer_id is only 4 bits, making it possible for at most up to 16 buffers in total per thread.<br />
|-<br />
| 2<br />
| 0x00000004 <nowiki>|</nowiki> (size<<4)<br />
| This is used for PXI commands input/output buffers. The address written to the destination cmd-buf is a phys-addr for a table located in the BASE memregion. This table contains the phys-addrs for the actual data, the array entries have the following format: {u32 *datachunk_physaddr, u32 datachunk_bytesize}.<br />
|-<br />
| 3<br />
| <nowiki>0x00000006 | (size<<4)</nowiki><br />
| Does nothing?<br />
|-<br />
| 4<br />
| 0x00000008<br />
| This command will cause a kernelpanic.<br />
|-<br />
| 5<br />
| <nowiki>0x0000000A | (size<<4)</nowiki><br />
<ptr><br />
| The corresponding value contains a ptr to a buffer of said size. It is mapped R- in the destination process??<br />
|-<br />
| 6<br />
| 0x0000000C <nowiki>|</nowiki> (size<<4)<br />
<ptr><br />
| The corresponding value contains a ptr to a buffer of said size. It is mapped -W in the destination process??<br />
|-<br />
| 7<br />
| 0x0000000E <nowiki>|</nowiki> (size<<4)<br />
<ptr><br />
| The corresponding value contains a ptr to a buffer of said size. It is mapped RW in the destination process??<br />
|}<br />
<br />
Buffers from commands 5,6,7 will get mapped at virtual address 0x04000000+ in destination process.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=IPC&diff=12260
IPC
2015-04-09T16:24:57Z
<p>Ichfly: </p>
<hr />
<div>The IPC commands are written to the Thread Local Storage, at offset 0x80. Every IPC command sent to services starts with a u32 header code, and parameters, if any, are written after this header. If the kernel was able to dispatch the request, the server reply will be written to TLS+0x80. Often the first word of the response data is the error code (or 0 if success).<br />
<br />
The command header is a 32-bit integer that can be decompossed in the following parts:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Bits<br />
! Description<br />
|-<br />
| 0-5<br />
| Number of translate parameters (=y)<br />
|-<br />
| 6-11<br />
| Number of normal parameters (=x)<br />
|-<br />
| 12-15<br />
| Unused<br />
|-<br />
| 16-31<br />
| Command ID<br />
|}<br />
<br />
The entire command has the following structure:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Word<br />
! Size<br />
! Description<br />
|-<br />
| 0<br />
| 1<br />
| Header code<br />
|-<br />
| 1<br />
| x<br />
| Normal parameters<br />
|-<br />
| x<br />
| y<br />
| Translate parameters<br />
|}<br />
<br />
Translate parameters are modified/translated transparently by the kernel. They are used to transfer handles/buffers between the different processes.<br />
<br />
The type of parameter is described by the bits 1-3 in the translation descriptor. Parameter types accepted for sending by the kernel are: 0, 1, 2, 5, 6, 7. <br />
Type 0 is used to send handles across processes:<br />
if desc & 0x30 == 0x20:<br />
write process id to value<br />
else:<br />
translate handle<br />
if desc & 0x30 == 0x10:<br />
close handle for caller<br />
<br />
For replies, only 0, 1, 5, 6, 7 are allowed. In other words any type 2 fields must be zeroed before calling svcReplyAndReceive on the server-side. For replies type 0, 1, 2 are ignored. Types 5, 6, 7 do something with the mem pointer upon reply. The type 0 descriptor can be used to ignore parameters. The number of parameters covered by a type-0 descriptor is (desc >> 26) + 1.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Type<br />
! scope="col" width="300" | Usual form<br />
! Description<br />
|-<br />
| 0<br />
| 0x00000000 <nowiki>|</nowiki> ((num_handles-1)<<26)<br />
<br />
<handle 0><br />
<br />
<handle 1><br />
...<br />
| The corresponding values are KHandles, that should be closed in calling process. Or zero otherwise.<br />
|-<br />
| 0<br />
| 0x00000010 <nowiki>|</nowiki> ((num_handles-1)<<26)<br />
<br />
<handle 0><br />
<br />
<handle 1><br />
...<br />
| The corresponding values are KHandles, that will be duplicated. Or zero otherwise.<br />
|-<br />
| 0<br />
| 0x00000020<br />
<placeholder><br />
| Let kernel set value to calling process ProcessID.<br />
|-<br />
| 1<br />
| 0x00000002 <nowiki>|</nowiki> (size<<14) <nowiki>|</nowiki> (static_buffer_id<<10)<br />
<ptr><br />
| The corresponding value contains a ptr to a buffer of said size, that should be copied to an already set-up buffer in destination process at [[Thread Local Storage]] offset 0x180 + static_buffer_id*8. The static_buffer_id is only 4 bits, making it possible for at most up to 16 buffers in total per thread.<br />
|-<br />
| 2<br />
| 0x00000004 <nowiki>|</nowiki> (size<<4)<br />
| This is used for PXI commands input/output buffers. The address written to the destination cmd-buf is a phys-addr for a table located in the BASE memregion. This table contains the phys-addrs for the actual data, the array entries have the following format: {u32 *datachunk_physaddr, u32 datachunk_bytesize}.<br />
|-<br />
| 3<br />
| 0x00000006 | (size<<4)<br />
| Does nothing?<br />
|-<br />
| 4<br />
| 0x00000008<br />
| This command will cause a kernelpanic.<br />
|-<br />
| 5<br />
| <nowiki>0x0000000A | (size<<4)</nowiki><br />
<ptr><br />
| The corresponding value contains a ptr to a buffer of said size. It is mapped R- in the destination process??<br />
|-<br />
| 6<br />
| 0x0000000C <nowiki>|</nowiki> (size<<4)<br />
<ptr><br />
| The corresponding value contains a ptr to a buffer of said size. It is mapped -W in the destination process??<br />
|-<br />
| 7<br />
| 0x0000000E <nowiki>|</nowiki> (size<<4)<br />
<ptr><br />
| The corresponding value contains a ptr to a buffer of said size. It is mapped RW in the destination process??<br />
|}<br />
<br />
Buffers from commands 5,6,7 will get mapped at virtual address 0x04000000+ in destination process.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=KSynchronizationObject&diff=11764
KSynchronizationObject
2015-02-27T15:17:14Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Kernel objects]]<br />
class [[KSynchronizationObject]] extends [[KAutoObject]];<br />
<br />
Size : 0x14 bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x8<br />
| u32<br />
| Count of Threads that wait for this<br />
|-<br />
| 0xC<br />
| KLinkedListNode*<br />
| First<br />
|-<br />
| 0x10<br />
| KLinkedListNode*<br />
| Last<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=KMutex&diff=11762
KMutex
2015-02-27T15:15:04Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Kernel objects]]<br />
class [[KMutex]] extends [[KSynchronizationObject]];<br />
<br />
Size : 0x2C bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x8<br />
| u32<br />
| KLinkedListNode count for object<br />
|-<br />
| 0xC<br />
| u32 <br />
| Pointer to itself + 0x14<br />
|-<br />
| 0x10<br />
| u32 <br />
| Pointer to itself + 0x14<br />
|-<br />
| 0x14<br />
| ?<br />
| ? <br />
|-<br />
| 0x18<br />
| ?<br />
| ?<br />
|-<br />
| 0x1C<br />
| u32<br />
| Unknown maybe number of KThread that wait for this or use this?<br />
|-<br />
| 0x20<br />
| KThread *<br />
| Unknown 1 locked? 0 unlocked? (but it is compared against a KThread* ?)<br />
|-<br />
| 0x24<br />
| u32<br />
| Unknown 0x3F ?maybe priority?<br />
|-<br />
| 0x28<br />
| KProcess*<br />
| Owner<br />
|-</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=KMutex&diff=11756
KMutex
2015-02-27T11:03:16Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Kernel objects]]<br />
class [[KMutex]] extends [[KSynchronizationObject]];<br />
<br />
Size : 0x2C bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x8<br />
| u32<br />
| KLinkedListNode count for object<br />
|-<br />
| 0xC<br />
| u32 <br />
| Pointer to itself + 0x14<br />
|-<br />
| 0x10<br />
| u32 <br />
| Pointer to itself + 0x14<br />
|-<br />
| 0x14<br />
| KLinkedListNode*<br />
| Next <br />
|-<br />
| 0x18<br />
| KLinkedListNode*<br />
| Previous<br />
|-<br />
| 0x1C<br />
| u32<br />
| Unknown maybe number of KThread that wait for this or use this?<br />
|-<br />
| 0x20<br />
| KThread *<br />
| Unknown 1 locked? 0 unlocked? (but it is compared against a KThread* ?)<br />
|-<br />
| 0x24<br />
| u32<br />
| Unknown 0x3F ?maybe priority?<br />
|-<br />
| 0x28<br />
| KProcess*<br />
| Owner<br />
|-</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=KThread&diff=11753
KThread
2015-02-26T19:52:11Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Kernel objects]]<br />
class [[KThread]] extends [[KSynchronizationObject]];<br />
<br />
Size : 0xB0 bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x14<br />
| u32<br />
| Start of 0x10 byte unnamed kernel object in KThread<br />
|-<br />
| 0x24<br />
| u32<br />
| Start of 0x8 byte unnamed kernel object in KThread<br />
|-<br />
| 0x2C<br />
| u32<br />
| Start of unnamed kernel object of undetermined size in KThread<br />
|-<br />
| 0x3C<br />
| u32<br />
| Thread priority<br />
|-<br />
| 0x40<br />
| u32<br />
| Pointer to object the KThread is waiting on- can be a timer, event, session, etc.<br />
|-<br />
| 0x48<br />
| u32<br />
| Double pointer to KThread of unknown use/creation - used in scheduler<br />
|-<br />
| 0x4C<br />
| u32<br />
| Arbitration address<br />
|-<br />
| 0x5C<br />
| KLinkedListNode*<br />
| Objects the Thread waits for?<br />
|-<br />
| 0x6C<br />
| s32<br />
| Thread priority<br />
|-<br />
| 0x70<br />
| s32<br />
| Processor that created the thread<br />
|-<br />
| 0x7E<br />
| u8<br />
| Thread type - kernel threads are 0-2 and are assigned values based on where in the kernel the thread is created. All threads created outside the kernel environment are type 3.<br />
|-<br />
| 0x80<br />
| KProcess*<br />
| Process the thread belongs to (virtual address)<br />
|-<br />
| 0x84<br />
| u32<br />
| Thread id<br />
|-<br />
| 0x88<br />
| u32*<br />
| Ptr to svc mode register storage for KThread.<br />
|-<br />
| 0x8C<br />
| u32*<br />
| End-address of the page for this thread allocated in the [[Memory_layout|0xFF4XX000]] region. Thus, if the beginning of this mapped page is 0xFF401000, this ptr would be 0xFF402000. Thread context page - used for thread svc stack, preserving svc mode registers and VFP exception register for thread.<br />
|-<br />
| 0x90<br />
| s32<br />
| Ideal processor (processorid value from [[SVC|svcCreateThread]])<br />
|-<br />
| 0x94<br />
| void*<br />
| Ptr to threadlocalstorage<br />
|-<br />
| 0x98<br />
| void*<br />
| Ptr to threadlocalstorage in FCRAM via kernel vmem<br />
|-<br />
| 0xA0<br />
| KThread*<br />
| Previous (virtual address)<br />
|-<br />
| 0xA4<br />
| KThread*<br />
| Next (virtual address)<br />
|-<br />
| 0xA8<br />
| struct { KThread* first; KThread* last; } ptr<br />
| Pointer to linked list that has stolen it, or 0 if in normal list<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=KMutex&diff=11752
KMutex
2015-02-26T19:49:54Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Kernel objects]]<br />
class [[KMutex]] extends [[KSynchronizationObject]];<br />
<br />
Size : 0x2C bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x8<br />
| u32<br />
| KLinkedListNode count for object<br />
|-<br />
| 0xC<br />
| u32 <br />
| Pointer to itself + 0x14<br />
|-<br />
| 0x10<br />
| u32 <br />
| Pointer to itself + 0x14<br />
|-<br />
| 0x14<br />
| KLinkedListNode*<br />
| Next <br />
|-<br />
| 0x18<br />
| KLinkedListNode*<br />
| Previous<br />
|-<br />
| 0x1C<br />
| u32<br />
| Unknown 1 locked 0 unlocked?<br />
|-<br />
| 0x20<br />
| u32<br />
| Unknown 1 locked 0 unlocked?<br />
|-<br />
| 0x24<br />
| u32<br />
| Unknown 0x3F ?maybe priority?<br />
|-<br />
| 0x28<br />
| KProcess*<br />
| Owner<br />
|-</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=KMutex&diff=11749
KMutex
2015-02-26T16:52:48Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Kernel objects]]<br />
class [[KMutex]] extends [[KSynchronizationObject]];<br />
<br />
Size : 0x2C bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x8<br />
| u32<br />
| KLinkedListNode count for object<br />
|-<br />
| 0xC<br />
| u32 <br />
| Pointer to itself + 0x14<br />
|-<br />
| 0x10<br />
| u32 <br />
| Pointer to itself + 0x14<br />
|-<br />
| 0x14<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x18<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x1C<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x20<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x24<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x28<br />
| KProcess*<br />
| Owner<br />
|-</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=KCodeSet&diff=11667
KCodeSet
2015-02-13T21:40:28Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Kernel objects]]<br />
<br />
class [[KCodeSet]] extends [[KAutoObject]];<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x8<br />
| Struct size is 0x14<br />
| Memory section info for .text<br />
|-<br />
| 0x1C<br />
| Struct size is 0x14<br />
| Memory section info for .rodata<br />
|-<br />
| 0x30<br />
| Struct size is 0x14<br />
| Memory section info for .data<br />
|-<br />
| 0x44<br />
| u32<br />
| Total .text pages<br />
|-<br />
| 0x48<br />
| u32<br />
| Total .rodata pages<br />
|-<br />
| 0x4C<br />
| u32<br />
| Total RW pages (.bss + .data)<br />
|-<br />
| 0x50<br />
| u64<br />
| Process name as 8-byte string<br />
|-<br />
| 0x58<br />
| u16<br />
| ?<br />
|-<br />
| 0x5A<br />
| u16<br />
| ?<br />
|-<br />
| 0x5C<br />
| u64<br />
| TitleID<br />
|}<br />
<br />
Memory section info struct :<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Start address (virtual)<br />
|-<br />
| 0x4<br />
| u32<br />
| Total pages<br />
|-<br />
| 0x8<br />
| u32<br />
| KBlockInfo count for section <br />
|-<br />
| 0xC<br />
| u32<br />
| Pointer to KLinkedListNode that holds a pointer to the first KBlockInfo object for that section<br />
|-<br />
| 0x10<br />
| u32<br />
| Pointer to KLinkedListNode that holds a pointer to the last KBlockInfo object for that section<br />
|}<br />
<br />
Sections where there isn't a large enough memory block available will be split into with multiple memory blocks with a KBlockInfo class for each.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Services&diff=11657
Services
2015-02-10T12:01:37Z
<p>Ichfly: /* Service Manager Port "srv:" */</p>
<hr />
<div>Services are an abstraction of ports and are the commonly used way of inter-process communication outside of the kernel. While handles of regular ports are retrieved from [[SVC]](svcConnectToPort), service handles are retrieved through the port ''srv:'' ("service manager").<br />
<br />
Processes with PID less than or equal to the number of NATIVE_FIRM built-in modules (fs, sm, pm, pxi, ldr) have access to all services.<br />
<br />
==Service Manager Port "srv:"==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x00010002<br />
| Initialize<br />
|-<br />
| 0x00020000<br />
| GetProcSemaphore() (the handle from this gets signaled when notifications for this process gets triggered)<br />
|-<br />
| 0x00030100<br />
| RegisterService(8-byte servicename, u32 strlen, u32 max_sessions)<br />
|-<br />
| 0x000400C0<br />
| UnregisterService(8-byte servicename, u32 strlen)<br />
|-<br />
| 0x00050100<br />
| GetServiceSessionHandle(8-byte servicename, u32 strlen, u32 flags). Flags bit0: if not set, return port-handle instead of session-handle when session-handle unavailable (max sessions/timeout?).<br />
|-<br />
| 0x000600c2<br />
| RegisterServiceWithHandle(8-byte servicename, u32 strlen, Handle client_port)<br />
|-<br />
| 0x000700C0<br />
| UnregisterServiceWithHandle(8-byte servicename, u32 strlen)<br />
|-<br />
| 0x00080100<br />
| GetServicePortHandle(8-byte servicename, u32 strlen, u32 flags). Bit0: return 0 instead of port handle if port was found.<br />
|-<br />
| 0x00090040<br />
| Subscribe(u32 notification_id). This enables the specified notificationID for the current process.<br />
|-<br />
| 0x000A0040<br />
| Unsubscribe(u32 notification_id). This disables the specified notificationID for the current process.<br />
|-<br />
| 0x000B0000<br />
| ReceiveNotification() This returns the notificationID which was triggered, if any(see GetProcSemaphore).<br />
|-<br />
| 0x000C0080<br />
| PublishToSubscriber(u32 notification_id, u32 flag). This fires an notification. Bit0: only fire if not already fired, bit1: return error if error happens, else it always returns 0.<br />
|-<br />
| 0x000D0040<br />
| This can fire notificationIDs and return the number of fired notificationID<br />
|-<br />
| 0x000E00C0<br />
| HasAccessToService(8-byte servicename, u32 strlen). Returns 1 if your process has access to the service.<br />
|}<br />
<br />
==Service Manager Process-Manager Port "srv:pm"==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header, prior to [[7.0.0-13]]<br />
! Description<br />
|-<br />
| 0x04030082<br />
| RegisterProcess (u32 procid, u32 wordsz, <nowiki>((wordsz<<16) | 2)</nowiki>, serviceaccesscontrol*).<br />
|-<br />
| 0x04040040<br />
| UnregisterProcess (u32 procid).<br />
|}<br />
<br />
The Register command registers a process with the service-manager, which includes registering the serviceaccesscontrol for the process which normally originates from the [[NCCH/Extended_Header|exheader]].<br />
<br />
Prior to to [[7.0.0-13]], the commands listed for "srv:" were also accessible under this port with the same command-headers. Starting with [[7.0.0-13]], the "srv:pm" port was changed to a service. With this change, commandIDs for these commands were changed. "srv:pm" was originally vulnerable, this was fixed with [[7.0.0-13]], see [[3DS_exploits|here]]. Originally any process could use "srv:pm", however starting with [[7.0.0-13]] only the built-in NATIVE_FIRM sysmodules have access to it. The only system title which uses "srv:pm" is the [[Process_Manager_Services|Process Manager]].<br />
<br />
==Notifications==<br />
{| class="wikitable" border="1"<br />
|-<br />
! ID<br />
! Description<br />
|-<br />
| 0x100<br />
| This indicates that all processes must terminate: power-off, reboot, or [[FIRM]]-launch.<br />
|-<br />
| 0x108<br />
| error at boot?<br />
|-<br />
| 0x204<br />
| This indicates that the HOME button was pressed.<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=KProcess&diff=11656
KProcess
2015-02-10T10:40:59Z
<p>Ichfly: update old struct</p>
<hr />
<div>[[Category:Kernel objects]]<br />
class [[KProcess]] extends [[KSynchronizationObject]];<br />
<br />
Size : 0x260 bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x1C<br />
| volatile KThread*<br />
| 0 or pointer to the thread the currently does something with the process object.<br />
|-<br />
| 0x20<br />
| s16<br />
| ?<br />
|-<br />
| 0x30<br />
| KLinkedListNode*<br />
| Pointer to first KLinkedListNode in list of KMemoryBlocks used by the process<br />
|-<br />
| 0x34<br />
| KLinkedListNode*<br />
| Pointer to last KLinkedListNode in list of KMemoryBlocks used by the process <br />
|-<br />
| 0x50<br />
| u32<br />
| Size of the MMU table <br />
|-<br />
| 0x54<br />
| u32<br />
| Virtual address of the MMU table for this process<br />
|-<br />
| 0x58<br />
| u32<br />
| Total size of all thread context pages (0xFF4xxxxx) owned by threads that belong to this process<br />
|-<br />
| 0x5C<br />
| u32<br />
| Number of KThreadLocalPages used by this KProcess<br />
|-<br />
| 0x60<br />
| KLinkedListNode*<br />
| Pointer to first KLinkedListNode in the list of KThreadLocalPages<br />
|-<br />
| 0x64<br />
| KLinkedListNode*<br />
| Pointer to last KLinkedListNode in the list of KThreadLocalPages<br />
|-<br />
| 0x6C<br />
| s32<br />
| Ideal processor<br />
|-<br />
| 0x74<br />
| u32<br />
| Pointer to resource limits for process. <br />
|-<br />
| 0x79<br />
| u8<br />
| Proc affinity mask<br />
|-<br />
| 0x7C<br />
| u32<br />
| Number of threads which belong to this process.<br />
|-<br />
| 0x80<br />
| 0x10-bytes<br />
| SVC access control mask from the exheader kernel descriptors.<br />
|-<br />
| 0x90<br />
| 0x10-bytes<br />
| Interrupt flags- 32 interrupts per word, 4 words, 0x80 interrupts total divided evenly across 4 words<br />
|-<br />
| 0xA0<br />
| u32<br />
| Kernel flags from the exheader kernel descriptors.<br />
|-<br />
| 0xA4<br />
| u16<br />
| Handle table size from the exheader kernel descriptors. When this is 0, handle table is stored in WRAM.<br />
|-<br />
| 0xA6<br />
| u16<br />
| Kernel release version field, from the exheader kernel descriptors.<br />
|-<br />
| 0xA8<br />
| u32<br />
| Pointer to [[KCodeSet]] instance<br />
|-<br />
| 0xAC<br />
| u32<br />
| Process id, this always begins at 0x0 for the first process.<br />
|-<br />
| 0xB8<br />
| KThread*<br />
| Pointer to the process's main (?) thread.<br />
|-<br />
| 0xCC<br />
| KProcessHandleTable <br />
| Pointer to the process's handle table. until 0x1C4 or longer<br />
|-<br />
| 0x224<br />
| u32<br />
| ?<br />
|}<br />
<br />
Structure for [[8.0.0-18]] NATIVE_FIRM:<br />
<br />
Size : 0x268 bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x8<br />
| u32<br />
| KLinkedListNode count for object <br />
|-<br />
| 0x30<br />
| KLinkedListNode*<br />
| Pointer to first KLinkedListNode in list of KMemoryBlocks used by the process<br />
|-<br />
| 0x34<br />
| KLinkedListNode*<br />
| Pointer to last KLinkedListNode in list of KMemoryBlocks used by the process<br />
|-<br />
| 0x4C<br />
| u32<br />
| End of userland virtual memory for the process <br />
|-<br />
| 0x50<br />
| u32*<br />
| [[Memory_layout|LINEAR]] memory virtual address(userland) base for this process.<br />
|-<br />
| 0x58<br />
| u32<br />
| Size of the MMU table<br />
|-<br />
| 0x5C<br />
| u32<br />
| Virtual address of the MMU table for this process<br />
|-<br />
| 0x60<br />
| u32<br />
| Total size of all thread context pages (0xFF4xxxxx) owned by threads that belong to this process<br />
|-<br />
| 0x64<br />
| u32<br />
| Number of KThreadLocalPages used by this KProcess<br />
|-<br />
| 0x68<br />
| KLinkedListNode*<br />
| Pointer to first KLinkedListNode in the list of KThreadLocalPages<br />
|-<br />
| 0x6C<br />
| KLinkedListNode*<br />
| Pointer to last KLinkedListNode in the list of KThreadLocalPages<br />
|-<br />
| 0x74<br />
| s32<br />
| Ideal processor for this process<br />
|-<br />
| 0x7C<br />
| u32<br />
| Pointer to resource limits for process.<br />
|-<br />
| 0x84<br />
| u32<br />
| Number of threads which belong to this process.<br />
|-<br />
| 0x88<br />
| 0x10-bytes<br />
| SVC access control mask from the exheader kernel descriptors.<br />
|-<br />
| 0x98<br />
| u32[4]<br />
| Interrupt flags- 32 interrupts per word, 4 words, 0x80 interrupts total divided evenly across 4 words<br />
|-<br />
| 0xA8<br />
| u32<br />
| Kernel flags from the exheader kernel descriptors.<br />
|-<br />
| 0xAC<br />
| u16<br />
| Handle table size from the exheader kernel descriptors. When this is 0, handle table is stored in WRAM.<br />
|-<br />
| 0xAE<br />
| u16<br />
| Kernel release version field, from the exheader kernel descriptors.<br />
|-<br />
| 0xB0<br />
| u32<br />
| Pointer to [[KCodeSet]] instance<br />
|-<br />
| 0xB4<br />
| u32<br />
| Process id, this always begins at 0x0 for the first process.<br />
|-<br />
| 0xC0<br />
| KThread*<br />
| Pointer to the process's main thread.<br />
|-<br />
| 0xD4<br />
| KProcessHandleTable<br />
| This is the data for tracking and using all of the KProcess's handles.<br />
|}<br />
<br />
<br />
KProcessHandleTable info struct:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| HandleData*<br />
| Pointer to the process's handle table.<br />
|-<br />
| 0x4<br />
| u16<br />
| The max number of handles that can be open at once - usually 0x200.<br />
|-<br />
| 0x6<br />
| u16<br />
| Unknown<br />
|-<br />
| 0x8<br />
| HandleData*<br />
| Pointer to the next open HandleData entry in the handle table. <br />
|-<br />
| 0xC<br />
| u16<br />
| Total handles used by this KProcess.<br />
|-<br />
| 0xE<br />
| u16<br />
| The current number of handles in use.<br />
|-<br />
| 0x10<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x14<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x16<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x18<br />
| HandleData[28]<br />
| This small handle data table internal to the KProcess is only used in certain processes that don't have an external handle data table in FCRAM. It is all zeros in most processes.<br />
|}<br />
<br />
<br />
HandleData struct:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Handle info<br />
|-<br />
| 0x4<br />
| u32<br />
| Pointer to the kernel object that the handle references.<br />
|}<br />
<br />
The handle info u32 works as such:<br />
<br />
The high byte is a remainder from the pointer to the next entry that originally occupied the handle table entry. It is unused. Byte 2 is either the class type token starting with firmware version 9.0 or the lowest byte of the char* that points to the class type name in firmware versions below 9.0. The lower halfword is the handle number of the current handle taken from the total handle count for the KProcess that owns the table.<br />
<br />
On table creation, each entry in the handle data table is populated with a pointer to the next entry in the table. When a new handle is created, that pointer is moved into offset 0x8 of the KProcessHandleTable info struct to use for generation of the next handle.<br />
<br />
The final handle that gets returned when a handle is created is (handle_index | (handle_total << 15)), basically they take the index into the handle data table and OR that with the total handle count << 15. This returned value is the one that gets passed back to the running application and is used to look up the HandleData entry in the table.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=KSharedMemory&diff=11630
KSharedMemory
2015-02-09T17:33:03Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Kernel objects]]<br />
class [[KSharedMemory]] extends [[KAutoObject]];<br />
<br />
Size : 0x28 bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x8<br />
| u32<br />
| Unknown<br />
|-<br />
| 0xC<br />
| u32 <br />
| Pointer to shared memory data node<br />
|-<br />
| 0x10<br />
| u32 <br />
| Pointer to above<br />
|-<br />
| 0x14<br />
| KProcess*<br />
| Owner<br />
|-<br />
| 0x18<br />
| u32<br />
| Owner Permission<br />
|-<br />
| 0x1C<br />
| u32<br />
| otherpermission<br />
|-<br />
| 0x20<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x24<br />
| u32<br />
| Unknown<br />
|-</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=KProcess&diff=11626
KProcess
2015-02-09T13:06:27Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Kernel objects]]<br />
class [[KProcess]] extends [[KSynchronizationObject]];<br />
<br />
Size : 0x260 bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x1C<br />
| volatile Kthread*<br />
| null or pointer to the thread the currently dose something with the process obj.<br />
|-<br />
| 0x20<br />
| s16<br />
| unk.<br />
|-<br />
| 0x30<br />
| KLinkedListNode*<br />
| points to all KMemoryBlock used by this process?<br />
|-<br />
| 0x50<br />
| u32<br />
| Size of the MMU table <br />
|-<br />
| 0x54<br />
| u32<br />
| Virtual address of the MMU table for this process<br />
|-<br />
| 0x58<br />
| u32<br />
| Total size of all thread context pages (0xFF4xxxxx) owned by threads that belong to this process <br />
|-<br />
| 0x6C<br />
| s32<br />
| Ideal processor<br />
|-<br />
| 0x74<br />
| u32<br />
| Pointer to resource limits for process. <br />
|-<br />
| 0x79<br />
| u8<br />
| Proc affinity mask<br />
|-<br />
| 0x7C<br />
| u32<br />
| Number of threads which belong to this process.<br />
|-<br />
| 0x80<br />
| 0x10-bytes<br />
| SVC access control mask from the exheader kernel descriptors.<br />
|-<br />
| 0x90<br />
| 0x10-bytes<br />
| Interrupt flags- 32 interrupts per word, 4 words, 0x80 interrupts total divided evenly across 4 words<br />
|-<br />
| 0xA0<br />
| u32<br />
| Kernel flags from the exheader kernel descriptors.<br />
|-<br />
| 0xA4<br />
| u16<br />
| Handle table size from the exheader kernel descriptors. When this is 0, handle table is stored in WRAM.<br />
|-<br />
| 0xA6<br />
| u16<br />
| Kernel release version field, from the exheader kernel descriptors.<br />
|-<br />
| 0xA8<br />
| u32<br />
| Pointer to [[KCodeSet]] instance<br />
|-<br />
| 0xAC<br />
| u32<br />
| Process id, this always begins at 0x0 for the first process.<br />
|-<br />
| 0xB8<br />
| KThread*<br />
| Pointer to the process's main (?) thread.<br />
|-<br />
| 0xCC<br />
| KProcessHandleTable <br />
| Pointer to the process's handle table. until 0x1C4 or longer<br />
|-<br />
| 0x224<br />
| u32<br />
| ?<br />
|}<br />
<br />
Structure for [[8.0.0-18]] NATIVE_FIRM:<br />
<br />
Size : 0x268 bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x4C<br />
| u32<br />
| End of userland virtual memory for the process <br />
|-<br />
| 0x50<br />
| u32*<br />
| [[Memory_layout|LINEAR]] memory virtual address(userland) base for this process.<br />
|-<br />
| 0x58<br />
| u32<br />
| Size of the MMU table<br />
|-<br />
| 0x5C<br />
| u32<br />
| Virtual address of the MMU table for this process<br />
|-<br />
| 0x60<br />
| u32<br />
| Total size of all thread context pages (0xFF4xxxxx) owned by threads that belong to this process<br />
|-<br />
| 0x74<br />
| s32<br />
| Ideal processor for this process<br />
|-<br />
| 0x7C<br />
| u32<br />
| Pointer to resource limits for process.<br />
|-<br />
| 0x84<br />
| u32<br />
| Number of threads which belong to this process.<br />
|-<br />
| 0x88<br />
| 0x10-bytes<br />
| SVC access control mask from the exheader kernel descriptors.<br />
|-<br />
| 0x98<br />
| u32[4]<br />
| Interrupt flags- 32 interrupts per word, 4 words, 0x80 interrupts total divided evenly across 4 words<br />
|-<br />
| 0xA8<br />
| u32<br />
| Kernel flags from the exheader kernel descriptors.<br />
|-<br />
| 0xAC<br />
| u16<br />
| Handle table size from the exheader kernel descriptors. When this is 0, handle table is stored in WRAM.<br />
|-<br />
| 0xAE<br />
| u16<br />
| Kernel release version field, from the exheader kernel descriptors.<br />
|-<br />
| 0xB0<br />
| u32<br />
| Pointer to [[KCodeSet]] instance<br />
|-<br />
| 0xB4<br />
| u32<br />
| Process id, this always begins at 0x0 for the first process.<br />
|-<br />
| 0xC0<br />
| KThread*<br />
| Pointer to the process's main (?) thread.<br />
|-<br />
| 0xD4<br />
| KProcessHandleTable<br />
| This is the data for tracking and using all of the KProcess's handles.<br />
|}<br />
<br />
<br />
KProcessHandleTable info struct:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| HandleData*<br />
| Pointer to the process's handle table.<br />
|-<br />
| 0x4<br />
| u16<br />
| The max number of handles that can be open at once - usually 0x200.<br />
|-<br />
| 0x6<br />
| u16<br />
| Unknown<br />
|-<br />
| 0x8<br />
| HandleData*<br />
| Pointer to the next open HandleData entry in the handle table. <br />
|-<br />
| 0xC<br />
| u16<br />
| Total handles used by this KProcess.<br />
|-<br />
| 0xE<br />
| u16<br />
| The current number of handles in use.<br />
|-<br />
| 0x10<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x14<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x16<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x18<br />
| HandleData[28]<br />
| This small handle data table internal to the KProcess is only used in certain processes that don't have an external handle data table in FCRAM. It is all zeros in most processes.<br />
|}<br />
<br />
<br />
HandleData struct:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Handle info<br />
|-<br />
| 0x4<br />
| u32<br />
| Pointer to the kernel object that the handle references.<br />
|}<br />
<br />
The handle info u32 works as such:<br />
<br />
The high byte is a remainder from the pointer to the next entry that originally occupied the handle table entry. It is unused. Byte 2 is either the class type token starting with firmware version 9.0 or the lowest byte of the char* that points to the class type name in firmware versions below 9.0. The lower halfword is the handle number of the current handle taken from the total handle count for the KProcess that owns the table.<br />
<br />
On table creation, each entry in the handle data table is populated with a pointer to the next entry in the table. When a new handle is created, that pointer is moved into offset 0x8 of the KProcessHandleTable info struct to use for generation of the next handle.<br />
<br />
The final handle that gets returned when a handle is created is (handle_index | (handle_total << 15)), basically they take the index into the handle data table and OR that with the total handle count << 15. This returned value is the one that gets passed back to the running application and is used to look up the HandleData entry in the table.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=KProcess&diff=11625
KProcess
2015-02-09T12:18:39Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Kernel objects]]<br />
class [[KProcess]] extends [[KSynchronizationObject]];<br />
<br />
Size : 0x260 bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x50<br />
| u32<br />
| Size of the MMU table <br />
|-<br />
| 0x54<br />
| u32<br />
| Virtual address of the MMU table for this process<br />
|-<br />
| 0x58<br />
| u32<br />
| Total size of all thread context pages (0xFF4xxxxx) owned by threads that belong to this process <br />
|-<br />
| 0x6C<br />
| s32<br />
| Ideal processor<br />
|-<br />
| 0x74<br />
| u32<br />
| Pointer to resource limits for process. <br />
|-<br />
| 0x79<br />
| u8<br />
| Proc affinity mask<br />
|-<br />
| 0x7C<br />
| u32<br />
| Number of threads which belong to this process.<br />
|-<br />
| 0x80<br />
| 0x10-bytes<br />
| SVC access control mask from the exheader kernel descriptors.<br />
|-<br />
| 0x90<br />
| 0x10-bytes<br />
| Interrupt flags- 32 interrupts per word, 4 words, 0x80 interrupts total divided evenly across 4 words<br />
|-<br />
| 0xA0<br />
| u32<br />
| Kernel flags from the exheader kernel descriptors.<br />
|-<br />
| 0xA4<br />
| u16<br />
| Handle table size from the exheader kernel descriptors. When this is 0, handle table is stored in WRAM.<br />
|-<br />
| 0xA6<br />
| u16<br />
| Kernel release version field, from the exheader kernel descriptors.<br />
|-<br />
| 0xA8<br />
| u32<br />
| Pointer to [[KCodeSet]] instance<br />
|-<br />
| 0xAC<br />
| u32<br />
| Process id, this always begins at 0x0 for the first process.<br />
|-<br />
| 0xB8<br />
| KThread*<br />
| Pointer to the process's main (?) thread.<br />
|-<br />
| 0xCC<br />
| KProcessHandleTable <br />
| Pointer to the process's handle table. until 0x1C4 or longer<br />
|-<br />
| 0x224<br />
| u32<br />
| ?<br />
|}<br />
<br />
Structure for [[8.0.0-18]] NATIVE_FIRM:<br />
<br />
Size : 0x268 bytes<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Pointer to vtable<br />
|-<br />
| 0x4<br />
| u32<br />
| Reference count<br />
|-<br />
| 0x4C<br />
| u32<br />
| End of userland virtual memory for the process <br />
|-<br />
| 0x50<br />
| u32*<br />
| [[Memory_layout|LINEAR]] memory virtual address(userland) base for this process.<br />
|-<br />
| 0x58<br />
| u32<br />
| Size of the MMU table<br />
|-<br />
| 0x5C<br />
| u32<br />
| Virtual address of the MMU table for this process<br />
|-<br />
| 0x60<br />
| u32<br />
| Total size of all thread context pages (0xFF4xxxxx) owned by threads that belong to this process<br />
|-<br />
| 0x74<br />
| s32<br />
| Ideal processor for this process<br />
|-<br />
| 0x7C<br />
| u32<br />
| Pointer to resource limits for process.<br />
|-<br />
| 0x84<br />
| u32<br />
| Number of threads which belong to this process.<br />
|-<br />
| 0x88<br />
| 0x10-bytes<br />
| SVC access control mask from the exheader kernel descriptors.<br />
|-<br />
| 0x98<br />
| u32[4]<br />
| Interrupt flags- 32 interrupts per word, 4 words, 0x80 interrupts total divided evenly across 4 words<br />
|-<br />
| 0xA8<br />
| u32<br />
| Kernel flags from the exheader kernel descriptors.<br />
|-<br />
| 0xAC<br />
| u16<br />
| Handle table size from the exheader kernel descriptors. When this is 0, handle table is stored in WRAM.<br />
|-<br />
| 0xAE<br />
| u16<br />
| Kernel release version field, from the exheader kernel descriptors.<br />
|-<br />
| 0xB0<br />
| u32<br />
| Pointer to [[KCodeSet]] instance<br />
|-<br />
| 0xB4<br />
| u32<br />
| Process id, this always begins at 0x0 for the first process.<br />
|-<br />
| 0xC0<br />
| KThread*<br />
| Pointer to the process's main (?) thread.<br />
|-<br />
| 0xD4<br />
| KProcessHandleTable<br />
| This is the data for tracking and using all of the KProcess's handles.<br />
|}<br />
<br />
<br />
KProcessHandleTable info struct:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| HandleData*<br />
| Pointer to the process's handle table.<br />
|-<br />
| 0x4<br />
| u16<br />
| The max number of handles that can be open at once - usually 0x200.<br />
|-<br />
| 0x6<br />
| u16<br />
| Unknown<br />
|-<br />
| 0x8<br />
| HandleData*<br />
| Pointer to the next open HandleData entry in the handle table. <br />
|-<br />
| 0xC<br />
| u16<br />
| Total handles used by this KProcess.<br />
|-<br />
| 0xE<br />
| u16<br />
| The current number of handles in use.<br />
|-<br />
| 0x10<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x14<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x16<br />
| u32<br />
| Unknown<br />
|-<br />
| 0x18<br />
| HandleData[28]<br />
| This small handle data table internal to the KProcess is only used in certain processes that don't have an external handle data table in FCRAM. It is all zeros in most processes.<br />
|}<br />
<br />
<br />
HandleData struct:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Type<br />
! Description<br />
|-<br />
| 0x0<br />
| u32<br />
| Handle info<br />
|-<br />
| 0x4<br />
| u32<br />
| Pointer to the kernel object that the handle references.<br />
|}<br />
<br />
The handle info u32 works as such:<br />
<br />
The high byte is a remainder from the pointer to the next entry that originally occupied the handle table entry. It is unused. Byte 2 is either the class type token starting with firmware version 9.0 or the lowest byte of the char* that points to the class type name in firmware versions below 9.0. The lower halfword is the handle number of the current handle taken from the total handle count for the KProcess that owns the table.<br />
<br />
On table creation, each entry in the handle data table is populated with a pointer to the next entry in the table. When a new handle is created, that pointer is moved into offset 0x8 of the KProcessHandleTable info struct to use for generation of the next handle.<br />
<br />
The final handle that gets returned when a handle is created is (handle_index | (handle_total << 15)), basically they take the index into the handle data table and OR that with the total handle count << 15. This returned value is the one that gets passed back to the running application and is used to look up the HandleData entry in the table.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=CSND_Services&diff=11525
CSND Services
2015-01-29T17:55:59Z
<p>Ichfly: Undo revision 11524 by Ichfly (talk)</p>
<hr />
<div>[[Category:Services]]<br />
<br />
The CSND service talks to the DSP using the DSP FIFO to negotiate what CSND channels are allocated to the DSP, and this seems to be channels 0-7 (usually). The rest are dedicated to CSND services.<br />
<br />
= CSND service "csnd:SND" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x00010140<br />
| [[CSND:Initialize|Initialize]]<br />
|-<br />
| 0x00020000<br />
| Shutdown<br />
|-<br />
| 0x00030040<br />
| ExecuteType0Commands<br />
|-<br />
| 0x00040080<br />
| ExecuteType1Commands<br />
|-<br />
| 0x00050000<br />
| AcquireSoundChannels. This function tries to acquire sound channels. Response cmdbuf[2] holds a bitmask to which channels were allocated to this process.<br />
|-<br />
| 0x00060000<br />
| ReleaseSoundChannels.<br />
|-<br />
| 0x00070000<br />
| AcquireCaptureDevice. This function tries to acquire one capture device (max: 2). Returns index of which capture device was acquired.<br />
|-<br />
| 0x00080040<br />
| ReleaseCaptureDevice. This function tries to release the capture device given in cmdbuf[1].<br />
|-<br />
| 0x00090082<br />
| FlushDCache<br />
|-<br />
| 0x000A0082<br />
| StoreDCache<br />
|-<br />
| 0x000B0082<br />
| InvalidateDCache<br />
|-<br />
| 0x000C0000<br />
| <br />
|}<br />
<br />
A maximum of 4 service sessions can be opened at the same time for this service.<br />
<br />
For cache operations addresses must be in 0x14000000-0x1C000000 range. Starting with [[8.0.0-18]] addresses in the range 0x30000000-0x40000000 are also allowed.<br />
<br />
This service is normally used for playing [[BCWAV|CWAVs]]. The audio data must be located in the 0x14000000 virtual memory region, since CSND requires the physical address for playing the audio.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=CSND_Services&diff=11524
CSND Services
2015-01-28T19:52:53Z
<p>Ichfly: /* CSND service "csnd:SND" */</p>
<hr />
<div>[[Category:Services]]<br />
<br />
The CSND service talks to the DSP using the DSP FIFO to negotiate what CSND channels are allocated to the DSP, and this seems to be channels 0-7 (usually). The rest are dedicated to CSND services.<br />
<br />
= CSND service "csnd:SND" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x00010140<br />
| [[CSND:Initialize|Initialize]]<br />
|-<br />
| 0x00020000<br />
| Shutdown<br />
|-<br />
| 0x00030040<br />
| ExecuteType0Commands<br />
|-<br />
| 0x00040080<br />
| ExecuteType1Commands<br />
|-<br />
| 0x00050000<br />
| AcquireSoundChannels. This function tries to acquire sound channels. Response cmdbuf[2] holds a bitmask to which channels were allocated to this process.<br />
|-<br />
| 0x00060000<br />
| ReleaseSoundChannels.<br />
|-<br />
| 0x00070000<br />
| AcquireCaptureDevice. This function tries to acquire one capture device (max: 2). Returns index of which capture device was acquired.<br />
|-<br />
| 0x00080040<br />
| ReleaseCaptureDevice. This function tries to release the capture device given in cmdbuf[1].<br />
|-<br />
| 0x00090082<br />
| FlushDCache<br />
|-<br />
| 0x000A0082<br />
| StoreDCache<br />
|-<br />
| 0x000B0082<br />
| InvalidateDCache<br />
|-<br />
| 0x000C0000<br />
| (dose the same as any other Command Header that is out of range (also returns the same error))<br />
|}<br />
<br />
A maximum of 4 service sessions can be opened at the same time for this service.<br />
<br />
For cache operations addresses must be in 0x14000000-0x1C000000 range. Starting with [[8.0.0-18]] addresses in the range 0x30000000-0x40000000 are also allowed.<br />
<br />
This service is normally used for playing [[BCWAV|CWAVs]]. The audio data must be located in the 0x14000000 virtual memory region, since CSND requires the physical address for playing the audio.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&diff=11483
3DS System Flaws
2015-01-21T19:48:30Z
<p>Ichfly: Undo revision 11482 by Waffles (talk)</p>
<hr />
<div>Exploits are used to execute unofficial code (homebrew) on the Nintendo 3DS. This page is a list of known 3DS-mode exploits.<br />
<br />
==List of 3DS exploits==<br />
<br />
==Current Efforts==<br />
There are people working on finding exploits and documenting the 3DS. Here's a list of some current efforts being made to make homebrew on the 3DS possible:<br />
<br />
* See [[Ninjhax|here]] regarding Ninjhax.<br />
<br />
==Stale / Rejected Efforts==<br />
* Neimod has been working on a RAM dumping setup for a little while now. He's de-soldered the 3DS's RAM chip and hooked it and the RAM pinouts on the 3DS' PCB up to a custom RAM dumping setup. Recent photos show that the setup is working quite well, with the 3DS successfully booting up. Pictures of neimod's work can be found on [http://www.flickr.com/photos/neimod/ his Flickr stream].<br />
<br />
Neimod's flickr stream is now private and his work is considered awesome.<br />
<br />
* A loser (who will remain unnamed) has released CFW and CIA installers along with other stolen and illegal stuff.<br />
<br />
==Failed attempts==<br />
Here are listed all attempts at exploiting 3DS software that have failed so far.<br />
<br />
* Pushmo (3DSWare), QR codes: level name is properly limited to 16 characters, game doesn't crash with a longer name. The only possible crashes are triggered by out-of-bounds array index values, these crashes are not exploitable.<br />
<br />
<br />
* Pyramids (3DSWare), QR codes: no strings. Only crashes are from out-of-bounds values (like background ID) and are not exploitable.<br />
<br />
<br />
* 3DS browser, 2^32 characters long string: this is similar to the vulnerability fixed [http://git.chromium.org/gitweb/?p=external/Webkit.git;a=commitdiff;h=ec471f16fbd1f879cb631f9b022fd16acd75f4d4 here], concat-large-strings-crash2.html triggers a crash which is about the same as the one triggered by a 2^32 string. Most of the time this vulnerability will cause a memory page permissions fault, since the WebKit code attempts to copy the string text data to the output buffer located in read-only [[CRO0|CRO]] heap memory. The only difference between a crash triggered by a 2^32 string and the concat-large-strings-crash2.html crash is at the former copies the string data using the original string length(like 1 text character for "x", 4 for "xxxx") while the latter attempts to copy >12MB. In some ''very'' rare cases a thread separate from the string data-copy thread will crash, this might be exploitable. However, this is mostly useless since it rarely crashes this way.<br />
<br />
==Tips and info==<br />
The 3DS uses the XN feature of the ARM processor, and only apps that have the necessary permissions in their headers can set memory to be executable. This means that although a usable buffer overflow exploit would still be useful, it would not go the entire way towards allowing code to be run in an easy or practical fashion (like an actual homebrew launcher). For that, an exploit in the system is required. A buffer overflow exploit does, however, provide enough wiggle room through the use of return-oriented programming to potentially trigger a system exploit.<br />
<br />
SD card [[extdata]] and SD savegames can be attacked, for consoles where the console-unique [[Nand/private/movable.sed|movable.sed]] was dumped.<br />
<br />
Note that the publicly-available <v5.0 total-control exploits are [[FIRM|Process9]] exploits, not "kernel exploits".<br />
<br />
==System flaws==<br />
<br />
=== [[FIRM]] Process9 ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Summary<br />
! Description<br />
! Successful exploitation result<br />
! Fixed in [[FIRM]] system version<br />
! Last [[FIRM]] system version this flaw was checked for<br />
! Timeframe this was discovered<br />
! Discovered by<br />
|-<br />
| firmlaunch-haxx: FIRM header ToCToU<br />
| This can't be exploited from ARM11 userland.<br />
During [[FIRM]] launch, the only FIRM header the ARM9 uses at all is stored in FCRAM, this is 0x200-bytes(the actual used FIRM RSA signature is read to the Process9 stack however). The ARM9 doesn't expect "anything" besides the ARM9 to access this data.<br />
| ARM9 code execution<br />
| None<br />
| [[9.3.0-21|9.3.0-X]]<br />
| 2012, 3 days after [[User:Yellows8|Yellows8]] started Process9 code RE.<br />
| [[User:Yellows8|Yellows8]]<br />
|-<br />
| Uninitialized data output for PXI command replies<br />
| Various (stubbed?) PXI commands(including some [[Filesystem_services_PXI|here]]) just write uninitialized data (like from ARM registers) to the command reply.<br />
| <br />
| None<br />
| [[9.3.0-21|9.3.0-X]]<br />
| ?<br />
| [[User:Yellows8|Yellows8]]<br />
|-<br />
| [[Filesystem_services_PXI|FSPXI]] OpenArchive SD permissions<br />
| Process9 does not use the exheader ARM9 access-mount permission flag for SD at all.<br />
This would mean ARM11-kernelmode code / fs-module itself could directly use FSPXI to access SD card without ARM9 checking for SD access, but this is rather useless since a process is usually running with SD access(Home Menu for example) anyway.<br />
| <br />
| None<br />
| [[9.3.0-21|9.3.0-X]]<br />
| 2012<br />
| [[User:Yellows8|Yellows8]]<br />
|-<br />
| [[Application_Manager_Services_PXI|PXIAM]] command 0x003D0108(See also [[Application_Manager_Services|this]])<br />
| When handling this command, Process9 allocates a 0x2800-byte heap buffer, then copies the 4 FCRAM input buffers to this heap buffer without checking the sizes at all(only the buffers with non-zero sizes are copied). Starting with [[5.0.0-11|5.0.0-X]], the total combined size of the input data must be <=0x2800.<br />
| ARM9 code execution<br />
| [[5.0.0-11|5.0.0-X]]<br />
| <br />
| May 2013<br />
| [[User:Yellows8|Yellows8]]<br />
|-<br />
| [[Process_Services_PXI|PS RSA]] commands buffer overflows<br />
| pxips9 cmd1(not accessible via ps:ps) and VerifyRsaSha256: unchecked copy to a buffer in Process9's .bss, from the input FCRAM buffer. The buffer is located before the pxi cmdhandler threads' stacks. SignRsaSha256 also has a buf overflow, but this isn't exploitable.<br />
The buffer for this is the buffer for the signature data. With v5.0, the signature buffer was moved to stack, with a check for the signature data size. When the signature data size is too large, Process9 uses [[SVC|svcBreak]].<br />
| ARM9 code execution<br />
| [[5.0.0-11|5.0.0-X]]<br />
| <br />
| 2012<br />
| [[User:Yellows8|Yellows8]]<br />
|}<br />
<br />
=== ARM11 kernel ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Summary<br />
! Description<br />
! Successful exploitation result<br />
! Fixed in [[FIRM]] system version<br />
! Last [[FIRM]] system version this flaw was checked for<br />
! Timeframe this was discovered<br />
! Discovered by<br />
|-<br />
| [[SVC]] table too small<br />
| The table of function pointers for SVC's only contains entries up to 0x7D, but the biggest allowed SVC for the table is 0x7F. Thus, executing SVC7E or SVC7F would make the SVC-handler read after the buffer, and interpret some ARM instructions as function pointers.<br />
<br />
However, this would require patching the kernel .text or modifying SVC-access-control. Even if you could get these to execute, they would still jump to memory that isn't mapped as executable.<br />
| <br />
| None<br />
| [[9.3.0-21|9.3.0-21]]<br />
| 2012<br />
| <br />
|-<br />
| [[SVC|svcBackdoor (0x7B)]]<br />
| This backdoor allows executing SVC-mode code at the user-specified code-address. This is used by Process9, using this on the ARM11(with NATIVE_FIRM) requires patching the kernel .text or modifying SVC-access-control.<br />
| See description<br />
| None<br />
| [[9.3.0-21|9.3.0-21]]<br />
|<br />
| <br />
|-<br />
| [[Memory_layout#ARM11_Detailed_virtual_memory_map|0xEFF00000]] / 0xDFF00000 ARM11 kernel virtual-memory<br />
| The ARM11 kernel-mode 0xEFF00000/0xDFF00000 virtual-memory(size 0x100000) is mapped to phys-mem 0x1FF00000(entire DSP-mem + entire AXIWRAM), with permissions RW-. This is used during ARM11 kernel startup, this never seems to be used after that, however.<br />
| <br />
| None<br />
| [[9.3.0-21|9.3.0-X]]<br />
| <br />
| <br />
|-<br />
| memchunkhax<br />
| The kernel originally did not validate the data stored in the FCRAM kernel heap memchunk-headers for free-memory at all. Exploiting this requires raw R/W access to these memchunk-headers, like physical-memory access with gspwn.<br />
<br />
There are ''multiple'' ways to exploit this, but the end-result for most of these is the same: overwrite code in AXIWRAM via the 0xEFF00000/0xDFF00000 kernel virtual-memory mapping.<br />
<br />
This was fixed in [[9.3.0-21|9.3.0-X]] by checking that the memchunk(including size, next, and prev ptrs) is located within the currently used heap memory. The kernel may also check that the next/prev ptrs are valid compared to other memchunk-headers basically. When any of these checks fail, kernelpanic() is called.<br />
| When combined with other flaws: ARM11-kernelmode code execution<br />
| [[9.3.0-21|9.3.0-21]]<br />
| <br />
| February 2014<br />
| [[User:Yellows8|Yellows8]]<br />
|-<br />
| PXI [[RPC_Command_Structure|Command]] input/output buffer permissions<br />
| Originally the ARM11-kernel didn't check permissions for PXI input/output buffers for commands. Starting with [[6.0.0-11|6.0.0]] PXI input/output buffers must have RW permissions, otherwise kernelpanic is triggered.<br />
| <br />
| [[6.0.0-11|6.0.0-11]]<br />
| <br />
| 2012<br />
| [[User:Yellows8|Yellows8]]<br />
|-<br />
| [[SVC|svcStartInterProcessDma]]<br />
| For svcStartInterProcessDma, the kernel code had the following flaws:<br />
<br />
* Originally the ARM11-kernel read the input DmaConfig structure directly in kernel-mode(ldr(b/h) instructions), without checking whether the DmaConfig address is readable under userland. This was fixed by copying that structure to the SVC-mode stack, using the ldrbt instruction.<br />
<br />
* Integer overflows for srcaddr+size and dstaddr+size are now checked(with [[6.0.0-11]]), which were not checked before.<br />
<br />
* The kernel now also checks whether the srcaddr/dstaddr (+size) is within userland memory (0x20000000), the kernel now (with [[6.0.0-11]]) returns an error when the address is beyond userland memory. Using an address >=0x20000000 would result in the kernel reading from the process L1 MMU table, beyond the memory allocated for that MMU table(for vaddr->physaddr conversion). <br />
| <br />
| [[6.0.0-11]]<br />
| <br />
| DmaConfig issue: unknown. The rest: 2014<br />
| <br />
|-<br />
| [[SVC|svcControlMemory]] Parameter checks<br />
| For svcControlMemory the parameter check had these two flaws:<br />
<br />
* The allowed range for addr0, addr1, size parameters depends on which MemoryOperation is being specified. The limitation for GSP heap was only checked if op=(u32)0x10003. By setting a random bit in op that has no meaning (like bit17?), op would instead be (u32)0x30003, and the range-check would be less strict and not accurate. However, the kernel doesn't actually use the input address for LINEAR memory-mapping at all besides the range-checks, so this isn't actually useful. This was fixed in the kernel by just checking for the LINEAR bit, instead of comparing the entire MemoryOperation value with 0x10003.<br />
<br />
* Integer overflows on (addr0+size) are now checked that previously weren't (this also applies to most other address checks elsewhere in the kernel).<br />
<br />
| <br />
| [[5.0.0-11]]<br />
| <br />
|<br />
| <br />
|-<br />
| [[RPC_Command_Structure|Command]] request/response buffer overflow<br />
| Originally the kernel did not check the word-values from the command-header. Starting with [[5.0.0-11]], the kernel will trigger a kernelpanic() when the total word-size of the entire command(including the cmd-header) is larger than 0x40-words (0x100-bytes). This allows overwriting threadlocalstorage+0x180 in the destination thread. However, since the data written there would be translate parameters (such as header-words + buffer addresses), exploiting this would likely be very difficult, if possible at all.<br />
<br />
If the two words at threadlocalstorage+0x180 could be overwritten with controlled data this way, one could then use a command with a buffer-header of <nowiki>((size<<14) | 2)</nowiki> to write arbitrary memory to any RW userland memory in the destination process.<br />
| <br />
| [[5.0.0-11]]<br />
| <br />
| v4.1 FIRM -> v5.0 code diff<br />
| <br />
|-<br />
| [[SVC|SVC stack allocation overflows]]<br />
| <br />
* Syscalls that allocate a variable-length array on stack, only checked bit31 before multiplying by 4/16 (when calculating how much memory to allocate). If a large integer was passed as input to one of these syscalls, an integer overflow would occur, and too little memory would have been allocated on stack resulting in a buffer overrun. <br />
* The alignment (size+7)&~7 calculation before allocation was not checked for integer overflow.<br />
<br />
This might allow for ARM11 kernel code-execution.<br />
<br />
(Applies to svcSetResourceLimitValues, svcGetThreadList, svcGetProcessList, svcReplyAndReceive, svcWaitSynchronizationN.)<br />
| <br />
| [[5.0.0-11]]<br />
| <br />
| v4.1 FIRM -> v5.0 code diff<br />
| <br />
|-<br />
| [[SVC|svcControlMemory]] MemoryOperation MAP memory-permissions<br />
| svcControlMemory with MemoryOperation=MAP allows mapping the already-mapped process virtual-mem at addr1, to addr0. The lowest address permitted for addr1 is 0x00100000. Originally the ARM11 kernel didn't check memory permissions for addr1. Therefore .text as addr1 could be mapped elsewhere as RW- memory, which allowed ARM11 userland code-execution.<br />
| <br />
| [[4.1.0-8]]<br />
| <br />
| 2012<br />
| [[User:Yellows8|Yellows8]]<br />
|-<br />
| [[RPC_Command_Structure|Command]] input/output buffer permissions<br />
| Originally the ARM11 kernel didn't check memory permissions for the input/output buffers for commands. Starting with [[4.0.0-7]] the ARM11 kernel will trigger a kernelpanic() if the input/output buffers don't have the required memory permissions. For example, this allowed a FSUSER file-read to .text, which therefore allowed ARM11-userland code execution.<br />
| <br />
| [[4.0.0-7]]<br />
| <br />
| 2012<br />
| [[User:Yellows8|Yellows8]]<br />
|-<br />
| [[SVC|svcReadProcessMemory/svcWriteProcessMemory memory]] permissions<br />
| Originally the kernel only checked the first page(0x1000-bytes) of the src/dst buffers, for svcReadProcessMemory and svcWriteProcessMemory. There is no known retail processes which have access to these SVCs.<br />
| <br />
| [[4.0.0-7]]<br />
| <br />
| 2012?<br />
| [[User:Yellows8|Yellows8]]<br />
|}<br />
<br />
=== [[FIRM]] ARM11 modules ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Summary<br />
! Description<br />
! Successful exploitation result<br />
! Fixed in [[FIRM]] system version<br />
! Last [[FIRM]] system version this flaw was checked for<br />
! Timeframe this was discovered<br />
! Discovered by<br />
|-<br />
| [[Services|"srv:pm"]] process registration<br />
| Originally any process had access to the port "srv:pm". The PID's used for the (un)registration commands are not checked either. This allowed any process to re-register itself with "srv:pm", and therefore allowed the process to give itself access to any service, bypassing the exheader service-access-control list.<br />
<br />
This was fixed in [[7.0.0-13]]: starting with [[7.0.0-13]] "srv:pm" is now a service instead of a globally accessible port. Only processes with PID's less than 6 (in other words: fs, ldr, sm, pm, pxi modules) have access to it. With [[7.0.0-13]] there can only be one session for "srv:pm" open at a time(this is used by pm module), svcBreak will be executed if more sessions are opened by the processes which can access this.<br />
<br />
This flaw was needed for exploiting the <=v4.x Process9 PXI vulnerabilities from ARM11 userland ROP, since most applications don't have access to those service(s).<br />
| Access to arbitrary services<br />
| [[7.0.0-13]]<br />
| <br />
| 2012<br />
| [[User:Yellows8|Yellows8]]<br />
|}<br />
<br />
=== ARM11 system modules ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Summary<br />
! Description<br />
! Successful exploitation result<br />
! Fixed in system version<br />
! Last system version this flaw was checked for<br />
! Timeframe this was discovered<br />
! Discovered by<br />
|-<br />
| gspwn<br />
| GSP module does not validate addresses given to the GPU. This allows a user-mode application/applet to read/write to a large part of physical FCRAM using GPU DMA. From this, you can overwrite the .text segment of the application you're running under, and gain real code-execution from a ROP-chain. Normally applets' .text([[Home Menu]], [[Internet Browser]], etc) is located beyond the area accessible by the GPU, except for [[RO_Services|CROs]] used by applets([[Internet Browser]] for example).<br />
| User-mode code execution.<br />
| None<br />
| [[9.4.0-21]]<br />
| <br />
| <br />
|-<br />
| rohax<br />
| Using gspwn, it is possible to overwrite a loaded [[CRO0]]/[[CRR0]] after its RSA-signature has been validated. Badly validated [[CRO0]] header leads to arbitrary read/write of memory in the ro-process. This gives code-execution in the ro module, who has access to [[SVC|syscalls]] 0x70-0x72, 0x7D.<br />
<br />
This was fixed after [[ninjhax]] release by adding checks on [[CRO0]]-based pointers before writing to them.<br />
| Memory-mapping syscalls.<br />
| [[9.3.0-21]]<br />
| [[9.4.0-21]]<br />
| <br />
| <br />
|-<br />
| Region free<br />
| Only [[Home Menu]] itself checks gamecards' region when launching them. Therefore, any application launch that is done directly with [[NS]] without signaling Home Menu to launch the app, will result in region checks being bypassed.<br />
This essentially means launching the gamecard with the [[NS_and_APT_Services|"ns:s"]] service. The main way to exploit this is to trigger a FIRM launch with an application specified, either with a normal FIRM launch or a hardware [[NSS:RebootSystem|reboot]].<br />
| Launching gamecards from any region + bypassing Home Menu gamecard-sysupdate installation<br />
| None<br />
| [[9.4.0-21]]<br />
| June(?) 2014<br />
| [[User:Yellows8|Yellows8]]<br />
|}<br />
<br />
=== ARM11 system applications and applets ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Summary<br />
! Description<br />
! Successful exploitation result<br />
! Fixed in system version<br />
! Last system version this flaw was checked for<br />
! Timeframe this was discovered<br />
! Discovered by<br />
|-<br />
| 3DS [[System Settings]] DS profile string stack-smash<br />
| Too long or corrupted strings (01Ah 2 Nickname length in characters 050h 2 Message length in characters) in the NVRAM DS user settings (System Settings->Other Settings->Profile->Nintendo DS Profile) cause it to crash in 3DS-mode due to a stack-smash. The DSi is not vulnerable to this, DSi launcher(menu) and DSi System Settings will reset the NVRAM user-settings if the length field values are too long(same result as when the CRCs are invalid). TWL_FIRM also resets the NVRAM user-settings when the string-length(s) are too long.<br />
| ROP in mset.<br />
| [[7.0.0-13]]<br />
| [[7.0.0-13]]<br />
| 2012<br />
| [[User:Ichfly|Ichfly]]<br />
|}<br />
<br />
=== General/CTRSDK ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Summary<br />
! Description<br />
! Successful exploitation result<br />
! Fixed in version<br />
! Last version this flaw was checked for<br />
! Timeframe this was discovered<br />
! Discovered by<br />
|-<br />
| [[NWM_Services|UDS]] beacon additional-data buffer overflow<br />
| Originally CTRSDK did not validate the UDS additional-data size before using that size to copy the additional-data to a [[NWM_Services|networkstruct]]. This was eventually fixed.<br />
This was discovered while doing code RE with an old dlp-module version. It's unknown in what specific CTRSDK version this was fixed, or even what system-version updated titles with a fixed version.<br />
<br />
It's unknown if there's any titles using a vulnerable CTRSDK version which are also exploitable with this(dlp module can't be exploited with this).<br />
<br />
The maximum number of bytes that can be written beyond the end of the outbuf is 0x37-bytes, with additionaldata_size=0xFF.<br />
| Perhaps ROP, very difficult if possible with anything at all<br />
| ?<br />
| <br />
| September(?) 2014<br />
| [[User:Yellows8|Yellows8]]<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=DSP:ReadPipeIfPossible&diff=11446
DSP:ReadPipeIfPossible
2015-01-11T20:55:16Z
<p>Ichfly: </p>
<hr />
<div>=Request=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| Header code [0x001000c0]<br />
|-<br />
| 1<br />
| chan (0 - 7 0:Debug from DSP 1:P-DMA 2:audio 3:binary 4-7: free ?)<br />
|-<br />
| 2<br />
| direction? (0 = from DSP 1 = from ARM ??? )<br />
|-<br />
| 3<br />
| ?size? (halfword)<br />
|}<br />
<br />
0x100 byte after the Request header<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| (size <<14) <nowiki>|</nowiki> 0x2<br />
|-<br />
| 1<br />
| buffer<br />
|}<br />
<br />
=Response=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| Header code<br />
|-<br />
| 1<br />
| Resultcode<br />
|-<br />
| 2<br />
| sizeread? (hword)<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=DSP:LoadComponent&diff=11445
DSP:LoadComponent
2015-01-11T19:41:03Z
<p>Ichfly: </p>
<hr />
<div>=Request=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| Header code [0x001100c2]<br />
|-<br />
| 1<br />
| size<br />
|-<br />
| 2<br />
| (halfword) (observed 0x00FF) (Program ram blocks the component should be loaded into)<br />
|-<br />
| 3<br />
| (halfword) (observed 0x00FF) (Data ram blocks the component should be loaded into)<br />
|-<br />
| 4<br />
| (size<<4) <nowiki>|</nowiki> 0xA<br />
|-<br />
| 5<br />
| buffer<br />
|}<br />
=Response=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| Header code<br />
|-<br />
| 1<br />
| Resultcode<br />
|-<br />
| 2<br />
| (Byte)ComponentLoaded (0 is not loaded 1 is loaded)<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Services&diff=11320
Services
2014-12-31T16:44:12Z
<p>Ichfly: </p>
<hr />
<div>Services are an abstraction of ports and are the commonly used way of inter-process communication outside of the kernel. While handles of regular ports are retrieved from [[SVC]](svcConnectToPort), service handles are retrieved through the port ''srv:'' ("service manager").<br />
<br />
Processes with PID less than or equal to the number of NATIVE_FIRM built-in modules (fs, sm, pm, pxi, ldr) have access to all services.<br />
<br />
==Service Manager Port "srv:"==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x00010002<br />
| Initialize<br />
|-<br />
| 0x00020000<br />
| GetProcSemaphore (the handle from this gets signaled when notifications for this process gets triggered)<br />
|-<br />
| 0x00030100<br />
| RegisterService (8-byte servicename, u32 strlen, u32 flags?)<br />
|-<br />
| 0x000400C0<br />
| UnregisterService (8-byte servicename, u32 strlen)<br />
|-<br />
| 0x00050100<br />
| GetServiceHandle (8-byte servicename, u32 strlen, u32 flags?)<br />
|-<br />
| 0x000600c2<br />
| RegisterHandle? (8-byte servicename, u32 strlen, Handle h)<br />
|-<br />
| 0x0007....<br />
| UnregisterHandle? (8-byte servicename, u32 strlen)<br />
|-<br />
| 0x0008....<br />
| IsHandlePresent (8-byte servicename, u32 strlen,u32 flags) if flag is set it returns the handle?<br />
|-<br />
| 0x00090040<br />
| Subscribe () This enables the specified notificationID for the current process.<br />
|-<br />
| 0x000A....<br />
| This disables the specified notificationID for the current process (u32 ID)<br />
|-<br />
| 0x000B0000<br />
| ReceiveNotification This returns the notificationID which was triggered, if any(see GetProcSemaphore).<br />
|-<br />
| 0x000C0080<br />
| PublishToSubscriber(u32 ID,u32 flag) This can fire notificationID (Bit(0) only fire if not already fired, Bit(1) = return error if error happens, else it always returns 0)<br />
|-<br />
| 0x000D....<br />
| This can fire notificationIDs and return the number of fired notificationID<br />
|-<br />
| 0x000E....<br />
| returns 1 if the service is registered. 0 if not (8-byte servicename, u32 strlen)<br />
|}<br />
<br />
==Service Manager Process-Manager Port "srv:pm"==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header, prior to [[7.0.0-13]]<br />
! Description<br />
|-<br />
| 0x04030082<br />
| RegisterProcess (u32 procid, u32 wordsz, <nowiki>((wordsz<<16) | 2)</nowiki>, serviceaccesscontrol*).<br />
|-<br />
| 0x04040040<br />
| UnregisterProcess (u32 procid).<br />
|}<br />
<br />
The Register command registers a process with the service-manager, which includes registering the serviceaccesscontrol for the process which normally originates from the [[NCCH/Extended_Header|exheader]].<br />
<br />
Prior to to [[7.0.0-13]], the commands listed for "srv:" were also accessible under this port with the same command-headers. Starting with [[7.0.0-13]], the "srv:pm" port was changed to a service. With this change, commandIDs for these commands were changed. "srv:pm" was originally vulnerable, this was fixed with [[7.0.0-13]], see [[3DS_exploits|here]]. Originally any process could use "srv:pm", however starting with [[7.0.0-13]] only the built-in NATIVE_FIRM sysmodules have access to it. The only system title which uses "srv:pm" is the [[Process_Manager_Services|Process Manager]].<br />
<br />
==Notifications==<br />
{| class="wikitable" border="1"<br />
|-<br />
! ID<br />
! Description<br />
|-<br />
| 0x100<br />
| This indicates that all processes must terminate: power-off, reboot, or [[FIRM]]-launch.<br />
|-<br />
| 0x108<br />
| error at boot?<br />
|-<br />
| 0x204<br />
| This indicates that the HOME button was pressed.<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Services&diff=11319
Services
2014-12-31T16:34:53Z
<p>Ichfly: /* Notifications */</p>
<hr />
<div>Services are an abstraction of ports and are the commonly used way of inter-process communication outside of the kernel. While handles of regular ports are retrieved from [[SVC]](svcConnectToPort), service handles are retrieved through the port ''srv:'' ("service manager").<br />
<br />
Processes with PID less than or equal to the number of NATIVE_FIRM built-in modules (fs, sm, pm, pxi, ldr) have access to all services.<br />
<br />
==Service Manager Port "srv:"==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x00010002<br />
| Initialize<br />
|-<br />
| 0x00020000<br />
| GetProcSemaphore (the handle from this gets signaled when notifications for this process gets triggered)<br />
|-<br />
| 0x00030100<br />
| RegisterService (8-byte servicename, u32 strlen, u32 flags?)<br />
|-<br />
| 0x000400C0<br />
| UnregisterService (8-byte servicename, u32 strlen)<br />
|-<br />
| 0x00050100<br />
| GetServiceHandle (8-byte servicename, u32 strlen, u32 flags?)<br />
|-<br />
| 0x000600c2<br />
| RegisterHandle? (8-byte servicename, u32 strlen, Handle h)<br />
|-<br />
| 0x0007....<br />
| UnregisterHandle? (8-byte servicename, u32 strlen)<br />
|-<br />
| 0x0008....<br />
| IsHandlePresent (8-byte servicename, u32 strlen,u32 flags) if flag is set it returns the handle?<br />
|-<br />
| 0x00090040<br />
| Subscribe () This enables the specified notificationID for the current process.<br />
|-<br />
| 0x000A....<br />
| This disables the specified notificationID for the current process (u32 ID)<br />
|-<br />
| 0x000B0000<br />
| ReceiveNotification This returns the notificationID which was triggered, if any(see GetProcSemaphore).<br />
|-<br />
| 0x000C0080<br />
| PublishToSubscriber(u32 ID,u32 flag) This can fire notificationID (Bit(0) only fire if not already fired, Bit(1) = return error if error happens, else it always returns 0)<br />
|-<br />
| 0x000D....<br />
| This can fire notificationIDs and return the number of fired notificationID<br />
|-<br />
| 0x000E....<br />
| returns 1 if the service is registered. 0 if not (8-byte servicename, u32 strlen)<br />
|}<br />
<br />
==Service Manager Process-Manager Port "srv:pm"==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header, prior to [[7.0.0-13]]<br />
! Description<br />
|-<br />
| 0x04030082<br />
| RegisterProcess (u32 procid, u32 wordsz, <nowiki>((wordsz<<16) | 2)</nowiki>, serviceaccesscontrol*).<br />
|-<br />
| 0x04040040<br />
| UnregisterProcess (u32 procid).<br />
|}<br />
<br />
The Register command registers a process with the service-manager, which includes registering the serviceaccesscontrol for the process which normally originates from the [[NCCH/Extended_Header|exheader]].<br />
<br />
Prior to to [[7.0.0-13]], the commands listed for "srv:" were also accessible under this port with the same command-headers. Starting with [[7.0.0-13]], the "srv:pm" port was changed to a service. With this change, commandIDs for these commands were changed. "srv:pm" was originally vulnerable, this was fixed with [[7.0.0-13]], see [[3DS_exploits|here]]. Originally any process could use "srv:pm", however starting with [[7.0.0-13]] only the built-in NATIVE_FIRM sysmodules have access to it. The only system title which uses "srv:pm" is the [[Process_Manager_Services|Process Manager]].<br />
<br />
==Notifications==<br />
{| class="wikitable" border="1"<br />
|-<br />
! ID<br />
! Description<br />
|-<br />
| 0x100<br />
| This indicates that all processes must terminate: power-off, reboot, or [[FIRM]]-launch.<br />
|-<br />
| 0x108<br />
| Send at last during startup after some mcu::RTC call<br />
|-<br />
| 0x204<br />
| This indicates that the HOME button was pressed.<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=GSPGPU:SetBufferSwap&diff=11165
GSPGPU:SetBufferSwap
2014-12-15T15:23:59Z
<p>Ichfly: /* Request */</p>
<hr />
<div>=Request=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| Header code [0x00050200]<br />
|-<br />
| 1<br />
| Screen ID: 0=main, 1=sub<br />
|-<br />
| 2-7<br />
| Framebuffer info structure<br />
|-<br />
| 8<br />
| unk signed byte<br />
|}<br />
<br />
=Response=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| Header code<br />
|-<br />
| 1<br />
| Result code<br />
|}<br />
<br />
=Framebuffer info structure=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| Active framebuffer: 0=first, 1=second<br />
|-<br />
| 1<br />
| [[LCD#Framebuffers|Framebuffer]] virtual address, for the main screen this is the 3D left framebuffer<br />
|-<br />
| 2<br />
| For the main screen: 3D right framebuffer address<br />
|-<br />
| 3<br />
| Value for [[LCD|0x1EF00X90]], controls framebuffer width<br />
|-<br />
| 4<br />
| Framebuffer [[LCD|format]], this u16 is written to the low u16 for LCD register 0x1EF00X70.<br />
|-<br />
| 5<br />
| Value for [[LCD|0x1EF00X78]], controls which framebuffer is displayed<br />
|-<br />
| 6<br />
| ?<br />
|}<br />
<br />
=Description=<br />
This sets GSP state for the LCD framebuffers, and other state as well. When the value of [[LCD]] register 0x1EF00X54 is >0x54, the GSP state for the specified screenID is immediately written to the LCD registers. This command should only be used when directly writing to the framebuffers, otherwise when rendering to the framebuffers with the [[GPU]] the framebuffer info stored in [[GSP_Shared_Memory|GSP shared memory]] should be used instead.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Phtcache.bin&diff=11053
Phtcache.bin
2014-12-11T17:10:29Z
<p>Ichfly: /* File Header */</p>
<hr />
<div>== File Header ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size <br />
! Description<br />
|-<br />
| 0x0<br />
| 0x8<br />
| Always "1UJQ00_1"<br />
|-<br />
| 0x8<br />
| 0x4<br />
| Number of Pictures + 1<br />
|-<br />
| 0xC<br />
| 0x2<br />
| Total number of photo entries(including unused entries) stored here, this is normally value 3000 (500 on NAND).<br />
|-<br />
| 0xE<br />
| 0x2<br />
| This u16 must be < 2, this is normally value 1 (0 for NAND).<br />
|-<br />
| 0x10<br />
| 0x2<br />
| Unknown, normally value zero.<br />
|-<br />
| 0x12<br />
| 0x2<br />
| Total number of photos(used entries), excluding 2D dups.<br />
|-<br />
| 0x14<br />
| 0x2<br />
| CRC16 over the entire file with this CRC field set to zero when calculating the CRC, with initialval=0 and polynomial=0xA001.<br />
|-<br />
| 0x16<br />
| 0x2<br />
| Size of this header, must be >=0x18(this is always value 0x18).<br />
|-<br />
| 0x18<br />
| 0x98 * Number of Pictures<br />
| Pictures Property, index refereed by 3DS Camera<br />
|}<br />
<br />
The phtcache.bin actual filesize must be at least the following size: hdrsizefield + totalstoredentries*0x98.<br />
<br />
== Pictures Property ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size <br />
! Description<br />
|-<br />
| 0x0<br />
| 0x04<br />
| Null-terminated file extension: MPO, JPG, or AVI.<br />
|-<br />
| 0x4<br />
| 0x8<br />
| Image file name, without the extension.<br />
|-<br />
| 0xC<br />
| 0x8<br />
| Directory name under the DCIM directory.<br />
|-<br />
| 0x14<br />
| 0x4<br />
| Time taken based on "DS epoch" (start of 1/1/2000) (UNIX+946684800)<br />
|-<br />
| 0x1C<br />
| 0x4<br />
| Time last viewed?<br />
|-<br />
| 0x24<br />
| 0x4<br />
| ?<br />
|-<br />
| 0x28<br />
| 0x4<br />
| ?<br />
|-<br />
| 0x2C<br />
| 0x4<br />
| ?<br />
|-<br />
| 0x30<br />
| 0x4<br />
| ?<br />
|-<br />
| 0x34<br />
| 0x4<br />
| ?<br />
|-<br />
| 0x38<br />
| 0x4<br />
| ?<br />
|-<br />
| 0x3C<br />
| 0x4<br />
| ?<br />
|-<br />
| 0x40<br />
| 0x4<br />
| File size<br />
|-<br />
| 0x50<br />
| 0x18*4<br />
| 4 blocks, where each block is 0x18-bytes.<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Homebrew_Applications&diff=10949
Homebrew Applications
2014-12-06T11:19:20Z
<p>Ichfly: /* List */</p>
<hr />
<div>==Installing==<br />
Applications are installed by copying the necessary files to the 3ds/ folder in the root of the SD-card. Most applications come with two files:<br />
* boot.3dsx: The executable.<br />
* icon.bin: The icon/metadata.<br />
<br />
The [[Homebrew Launcher]] will scan the sdcard for all .3dsx files, but will only display an icon for those who have one according to the format described above.<br />
<br />
==List==<br />
{| class="wikitable" border="1"<br />
! Category<br />
! Name<br />
! Description<br />
! Author<br />
! Download<br />
! Open-Source<br />
|-<br />
| Demo<br />
| cubedemo<br />
| <br />
| [[User:plutoo|plutoo]]<br />
| [https://mega.co.nz/#!KUQFiQYA!pv8HDEyrmuX6Eyw2hW0opL7gf9Ztmjd9J5pPsvs_rD4 Here]<br />
| No<br />
|-<br />
| Game<br />
| [https://github.com/smealum/yeti3DS Yeti3DS]<br />
| A quick and dirty port of Derek Evans' Yeti3D software rendering engine.<br />
| [[User:smea|smea]]<br />
| N/A<br />
| Yes<br />
|-<br />
| Game<br />
| [https://github.com/smealum/3dscraft 3DSCraft]<br />
| Minecraft clone.<br />
| [[User:smea|smea]]<br />
| N/A<br />
| Yes<br />
|-<br />
| Game<br />
| [https://github.com/Steveice10/WorldOf3DSand World of 3DSand]<br />
| World of Sand clone.<br />
| [[User:Steveice10|Steveice10]]<br />
| [https://www.dropbox.com/s/91tqtydxpny9p1g/WorldOf3DSand.zip?dl=0 Here]<br />
| Yes<br />
|-<br />
| Emulator<br />
| [https://github.com/StapleButter/blargSnes blargSnes]<br />
| A Super Nintendo emulator.<br />
| StapleButter<br />
| [http://blargsnes.kuribo64.net/download/blargSnes_1.2.zip Here]<br />
| Yes<br />
|-<br />
| Emulator<br />
| [https://github.com/Drenn1/GameYob/tree/master/platform/3ds GameYob]<br />
| A Game Boy (Color) emulator.<br />
| Drenn<br />
| [https://dl.dropboxusercontent.com/u/100702766/gameyob/gameyob_3ds.zip Here]<br />
| Yes<br />
|-<br />
| Emulator<br />
| [https://github.com/st4rk/3DNES 3DNES]<br />
| An NES emulator.<br />
| St4rk<br />
| N/A<br />
| Yes<br />
|-<br />
|-<br />
| Emulator<br />
| [https://github.com/xerpi/CHIP-3DS CHIP-3DS]<br />
| A simple and slow CHIP-8 emulator.<br />
| xerpi<br />
| [https://www.mediafire.com/?y94yjhzf70fsfsi Here]<br />
| Yes<br />
|-<br />
| Application<br />
| [https://github.com/smealum/ftPONY ftPONY]<br />
| A basic FTP server, useful for testing new homebrew versions without swapping the SD card.<br />
| [[User:smea|smea]]<br />
| [https://mega.co.nz/#!nchBkL7B!T3vXnX4q8Uwp6APYYTDSZi2bkm25la-Qyz6j4CjsllI Here]<br />
| Yes<br />
|-<br />
| Application<br />
| [https://github.com/mtheall/ftbrony ftBRONY]<br />
| An FTP server.<br />
| [[User:mtheall|mtheall]]<br />
| N/A<br />
| Yes<br />
|-<br />
| Application<br />
| [https://github.com/plutooo/ctrrpc ctrrpc]<br />
| A small and easily extensible RPC server/client written in C/Python. Allows you to quickly poke service-commands and syscalls over wifi from a Python shell on your PC. Useful during reverse-engineering.<br />
| [[User:plutooo|plutoo]]<br />
| N/A<br />
| Yes<br />
|-<br />
| Application<br />
| [https://github.com/yellows8/ctr-streaming-server ctr-streaming-server]<br />
| This is a server which runs on a 3DS, which receives audio/video for playback. This can also send [[HID_Shared_Memory|HID]] state to the client (see the README) when enabled. The included parse_hidstream tool can be used to parse that HID data to simulate keyboard/mouse input events, via Linux uinput.<br />
| [[User:yellows8|yellows8]]<br />
| N/A<br />
| Yes<br />
|-<br />
| Application<br />
| [https://github.com/DownloadMii/DownloadMii DownloadMii]<br />
| This is a WIP homebrew online store.<br />
| [[User:filfat|filfat]]<br />
| N/A<br />
| Yes<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=3DSX_Format&diff=10663
3DSX Format
2014-11-14T17:41:44Z
<p>Ichfly: fixed size</p>
<hr />
<div>The 3DSX format is an executable file-format designed for homebrew applications on the 3DS.<br />
<br />
The file is structured like this:<br />
* Header<br />
* Code segment<br />
* Rodata segment<br />
* Data segment<br />
* Relocation Header for code<br />
* Relocation Header for rodata<br />
* Relocation Header for data<br />
<br />
== Header ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 4<br />
| Magic (3DSX)<br />
|-<br />
| 0x4<br />
| 2<br />
| Header size<br />
|-<br />
| 0x6<br />
| 2<br />
| Relocation Header size<br />
|-<br />
| 0x8<br />
| 4<br />
| Format version<br />
|-<br />
| 0xC<br />
| 4<br />
| Flags<br />
|-<br />
| 0x10<br />
| 4<br />
| Code segment size<br />
|-<br />
| 0x14<br />
| 4<br />
| Rodata segment size<br />
|-<br />
| 0x18<br />
| 4<br />
| Data segment size (including bss)<br />
|-<br />
| 0x1C<br />
| 4<br />
| Bss segment size<br />
|}<br />
<br />
== Relocation Header ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 4<br />
| Number of absolute relocations<br />
|-<br />
| 0x4<br />
| 4<br />
| Number of relative relocations<br />
|}<br />
<br />
== Relocation ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 2<br />
| Number of words to skip<br />
|-<br />
| 0x2<br />
| 2<br />
| Number of words to patch<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Mode_Control_Services_PXI&diff=10389
Mode Control Services PXI
2014-11-01T21:41:24Z
<p>Ichfly: /* "pxi:mc" service */</p>
<hr />
<div>="pxi:mc" service=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Available since system version<br />
! Description<br />
|-<br />
| 0x000101c2<br />
| [[1.0.0-0]]<br />
| ? (don't send with zero params, freezes)<br />
|-<br />
| 0x0002....<br />
| [[1.0.0-0]]<br />
| Stubbed, does nothing<br />
|-<br />
| 0x0003....<br />
| [[1.0.0-0]]<br />
| Stubbed, does nothing<br />
|-<br />
| 0x0004....<br />
| [[1.0.0-0]]<br />
| Stubbed, does nothing<br />
|-<br />
| 0x0005....<br />
| [[1.0.0-0]]<br />
| ?<br />
|-<br />
| 0x0006....<br />
| [[1.0.0-0]]<br />
| Stubbed, does nothing<br />
|-<br />
| 0x00070000<br />
| [[1.0.0-0]]<br />
| Stubbed, writes uninitialized stack byte to (u8*)(cmdbuf+4)<br />
|-<br />
| 0x0008....<br />
| [[1.0.0-0]]<br />
| Stubbed, returns 0xE0C0EC03<br />
|-<br />
| 0x0009....<br />
| [[1.0.0-0]]<br />
| Stubbed, returns 0xE0C0EC03<br />
|-<br />
| 0x000A....<br />
| [[1.0.0-0]]<br />
| ?<br />
|-<br />
| 0x000B....<br />
| [[1.0.0-0]]<br />
| Stubbed, does some unnecessary copying to stack<br />
|-<br />
| 0x000C....<br />
| [[1.0.0-0]]<br />
| Stubbed, does some unnecessary copying to stack<br />
|}<br />
<br />
Back to↓<br />
<br />
[[Services API]]</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Mode_Control_Services_PXI&diff=10388
Mode Control Services PXI
2014-11-01T19:07:30Z
<p>Ichfly: </p>
<hr />
<div>="pxi:mc" service=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Available since system version<br />
! Description<br />
|-<br />
| 000101c2<br />
| [[1.0.0-0]]<br />
| ? (don't send with zero params, freezes)<br />
|-<br />
| 0x0002....<br />
| [[1.0.0-0]]<br />
| Stubbed, does nothing<br />
|-<br />
| 0x0003....<br />
| [[1.0.0-0]]<br />
| Stubbed, does nothing<br />
|-<br />
| 0x0004....<br />
| [[1.0.0-0]]<br />
| Stubbed, does nothing<br />
|-<br />
| 0x0005....<br />
| [[1.0.0-0]]<br />
| ?<br />
|-<br />
| 0x0006....<br />
| [[1.0.0-0]]<br />
| Stubbed, does nothing<br />
|-<br />
| 0x00070000<br />
| [[1.0.0-0]]<br />
| Stubbed, writes uninitialized stack byte to (u8*)(cmdbuf+4)<br />
|-<br />
| 0x0008....<br />
| [[1.0.0-0]]<br />
| Stubbed, returns 0xE0C0EC03<br />
|-<br />
| 0x0009....<br />
| [[1.0.0-0]]<br />
| Stubbed, returns 0xE0C0EC03<br />
|-<br />
| 0x000A....<br />
| [[1.0.0-0]]<br />
| ?<br />
|-<br />
| 0x000B....<br />
| [[1.0.0-0]]<br />
| Stubbed, does some unnecessary copying to stack<br />
|-<br />
| 0x000C....<br />
| [[1.0.0-0]]<br />
| Stubbed, does some unnecessary copying to stack<br />
|}<br />
<br />
Back to↓<br />
<br />
[[Services API]]</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Config_Savegame&diff=10297
Config Savegame
2014-10-22T10:17:42Z
<p>Ichfly: </p>
<hr />
<div>This page describes the format of the [[Config_Services|Cfg]] [[System_SaveData|NAND]] savegame. These blocks can be accessed with the Cfg service commands.<br />
<br />
==Structure of save-file "/config"==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x2<br />
| Total entries<br />
|-<br />
| 0x2<br />
| 0x2<br />
| Data entries offset<br />
|-<br />
| 0x4<br />
| 0x4558<br />
| Block entries<br />
|-<br />
| 0x455C<br />
| <br />
| Data for the entries<br />
|}<br />
<br />
The filesize for this /config file is 0x8000-bytes.<br />
<br />
==Configuration block entry ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x4<br />
| BlkID<br />
|-<br />
| 0x4<br />
| 0x4<br />
| Offset to the data for this block when size is >4, otherwise this word is the data for this block.<br />
|-<br />
| 0x8<br />
| 0x2<br />
| Size<br />
|-<br />
| 0xA<br />
| 0x2<br />
| Flags<br />
|}<br />
<br />
==Configuration blocks==<br />
{| class="wikitable" border="1"<br />
|-<br />
! BlkID<br />
! Size<br />
! Flags<br />
! Description<br />
|-<br />
| 0x00050005<br />
| 0x20<br />
| ?<br />
| Stereo camera settings?<br />
|-<br />
| 0x00070001<br />
| 0x1<br />
| ?<br />
| Sound output mode?<br />
|-<br />
| 0x00080000<br />
| 0xC00<br />
| 0x2?<br />
| Wifi configuration slot0.<br />
|-<br />
| 0x00080001<br />
| 0xC00<br />
| 0x2?<br />
| Wifi configuration slot1.<br />
|-<br />
| 0x00080002<br />
| 0xC00<br />
| 0x2?<br />
| Wifi configuration slot2.<br />
|-<br />
| 0x00090000<br />
| 0x8<br />
| 0x2?<br />
| This contains a u64 ID, used by processes using [[NWMUDS:Initialize]]. The first word is the same as [[CfgS:GetLocalFriendCodeSeed|LocalFriendCodeSeed]], while the latter is a separate random word.<br />
|-<br />
| 0x00090001<br />
| 0x8<br />
| 0xE<br />
| This console-unique u64 used by [[Cfg:GenHashConsoleUnique|GenHashConsoleUnique]] is generated with the LocalFriendCodeSeed and with random data.<br />
|-<br />
| 0x000A0000<br />
| 0x1C<br />
| 0xE<br />
| Username<br />
|-<br />
| 0x000A0002<br />
| 0x1<br />
| 0xA<br />
| Language<br />
|-<br />
| 0x000B0000<br />
| 0x4<br />
| 0x8<br />
| CountryInfo<br />
|-<br />
| 0x000B0001<br />
| 0x800<br />
| 0x2?<br />
| Country name in UTF-16, every 0x80-bytes is an entry for each language(not all entries are set).<br />
|-<br />
| 0x000B0002<br />
| 0x800<br />
| 0x2?<br />
| State name in UTF-16, every 0x80-bytes is an entry for each language.<br />
|-<br />
| 0x000C0000<br />
| 0xC0<br />
| ?<br />
| Restricted photo exchange data, and other info.<br />
|-<br />
| 0x000C0001<br />
| 0x14<br />
| ?<br />
| Same as above?<br />
|-<br />
| 0x000D0000<br />
| 0x4<br />
| ?<br />
| u16 at offset 0x0: [[SMDH#EULA_Version|EULA Version]] which was agreed to.<br />
|-<br />
| 0x000F0000<br />
| 0x10<br />
| 0x8?<br />
| Unknown, used by [[NS]] on dev-units for [[SVC|svcKernelSetState]], where Type is 6. During NS startup on debug-units, NS compares the u32 from +8 in this config-block with the [[Configuration_Memory#APPMEMTYPE|APPMEMTYPE]]. When those don't match NS starts a FIRM-launch(with the same FIRM titleID as the currently running one) to boot into a FIRM with the APPMEMTYPE value from this config-block.<br />
|-<br />
| 0x000F0004<br />
| 0x4<br />
| 0x8?<br />
| The first u8 is the System-Model [[Cfg:GetSystemModel|value]], the last 3-bytes are unknown.<br />
|-<br />
| 0x00110000<br />
| 0x4<br />
| ?<br />
| The low u16 indicates whether the system setup is required, such as when the system is booted for the first time or after doing a [[System Settings|System Format]]: 0 = setup required, non-zero = no setup required.<br />
|-<br />
| 0x00110001<br />
| 0x8<br />
| 0xA?<br />
| TitleID of the menu to launch, used by [[NS]] on dev units. (This block can be edited on dev units with [[3DS Development Unit Software#Config|Config]])<br />
|-<br />
| 0x00130000<br />
| 0x4<br />
| ?<br />
| If response is 0x100 then debug mode is enabled.<br />
|-<br />
| 0x00160000<br />
| 0x4<br />
| 0x8?<br />
| Unknown, first byte is used by config service-cmd [[Config_Services|0x00070040]]. (Unknown whether the last 3-bytes are used)<br />
|}<br />
<br />
The dev unit TID block only exists on dev units.<br />
<br />
===Languages===<br />
{| class="wikitable" border="1"<br />
|-<br />
! ID<br />
! Description<br />
|-<br />
| 0<br />
| ja<br />
|-<br />
| 1<br />
| en<br />
|-<br />
| 2<br />
| fr<br />
|-<br />
| 3<br />
| de<br />
|-<br />
| 4<br />
| it<br />
|-<br />
| 5<br />
| es<br />
|-<br />
| 6<br />
| zh<br />
|-<br />
| 7<br />
| ko<br />
|-<br />
| 8<br />
| nl<br />
|-<br />
| 9<br />
| pt<br />
|-<br />
| 10<br />
| ru<br />
|}<br />
<br />
===CountryInfo===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Byte<br />
! Description<br />
|-<br />
| 0<br />
| ?<br />
|-<br />
| 1<br />
| ?<br />
|-<br />
| 2<br />
| ?<br />
|-<br />
| 3<br />
| Country code, same as DSi/Wii country codes. Value 0xff is invalid.<br />
|}<br />
<br />
===0x000A0000 Block===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Byte<br />
! Description<br />
|-<br />
| 0x0-0x13<br />
| UTF-16 username, with no NULL-terminator.<br />
|-<br />
| 0x14-17<br />
| Usually zero?<br />
|-<br />
| 0x18-0x1B<br />
| u32 NGWord version the username was last checked with. If this value is less than the u32 stored in the NGWord CFA "romfs:/version.dat", the system then checks the username string with the bad-word list CFA again, then updates this field with the value from the CFA.<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=GPIO_Services&diff=9833
GPIO Services
2014-09-12T14:23:21Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Services]]<br />
= GPIO Service Names =<br />
* "gpio:CDC"<br />
* "gpio:MCU"<br />
* "gpio:HID"<br />
* "gpio:NWM"<br />
* "gpio:IR"<br />
<br />
<br />
= I2C Service =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x0001....<br />
| ?(u32 unk1,u32* ret) //reads from 0x1ec47020<br />
|-<br />
| 0x0002....<br />
| ?(u32 unk1,u32 unk2)<br />
|-<br />
| 0x0003....<br />
| ?(u32 unk1,u32* ret)<br />
|-<br />
| 0x0004....<br />
| ?(u32 unk1,u32 unk2)<br />
|-<br />
| 0x0005....<br />
| ?(u32 unk1,u32* ret)<br />
|-<br />
| 0x0006....<br />
| ?(u32 unk1,u32 unk2)<br />
|-<br />
| 0x0007....<br />
| ?(u32 unk1,u32* ret)<br />
|-<br />
| 0x0008....<br />
| ?(u32 unk1,u32 unk2)<br />
|-<br />
| 0x00090082<br />
| ?(u32 unk1,u32 unk2,HANDEL unk3)<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=GPIO_Services&diff=9832
GPIO Services
2014-09-12T13:50:19Z
<p>Ichfly: Created page with "Category:Services = GPIO Service Names = * "gpio:CDC" * "gpio:MCU" * "gpio:HID" * "gpio:NWM" * "gpio:IR""</p>
<hr />
<div>[[Category:Services]]<br />
= GPIO Service Names =<br />
* "gpio:CDC"<br />
* "gpio:MCU"<br />
* "gpio:HID"<br />
* "gpio:NWM"<br />
* "gpio:IR"</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=DSP_Services&diff=9745
DSP Services
2014-09-04T18:30:22Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Services]]<br />
= DSP service "dsp::DSP" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x00010040<br />
| RecvData(chan 0-3)<br />
|-<br />
| 0x00020040<br />
| RecvDataIsReady(chan 0-3)<br />
|-<br />
| 0x00030080<br />
| SendData(chan 0-3)<br />
|-<br />
| 0x00040040<br />
| SendDataIsEmpty(chan 0-3)<br />
|-<br />
| 0x0005...<br />
| ?<br />
|-<br />
| 0x0006...<br />
| ?<br />
|-<br />
| 0x0007....<br />
| [[DSP:WriteReg0x10|WriteReg0x10]] SetSemaphore<br />
|-<br />
| 0x00080000<br />
| GetSemaphore<br />
|-<br />
| 0x00090040<br />
| ClearSemaphore<br />
|-<br />
| 0x000A....<br />
| WriteReg0x18<br />
|-<br />
| 0x000B0000<br />
| CheckSemaphoreRequest<br />
|-<br />
| 0x000C0040<br />
| [[DSP:ConvertProcessAddressFromDspDram|ConvertProcessAddressFromDspDram]]<br />
|-<br />
| 0x000D0082<br />
| [[DSP:WriteProcessPipe|WriteProcessPipe]]<br />
|-<br />
| 0x001000C0<br />
| [[DSP:ReadPipeIfPossible|ReadPipeIfPossible]]<br />
|-<br />
| 0x001100C2<br />
| [[DSP:LoadComponent|LoadComponent]]. This requires RSA-signed DSP firmware specified via the input buffer for this command, the firmware data is eventually written to DSPmem+0(0x1FF00000).<br />
|-<br />
| 0x00120000<br />
| UnloadComponent<br />
|-<br />
| 0x00130082<br />
| FlushDataCache (The buffer must be located in the 0x14000000 region)<br />
| <br />
|-<br />
| 0x00140082<br />
| InvalidateDCache (The buffer must be located in either the 0x14000000 region, or the DSP memory region)<br />
|-<br />
| 0x00150082<br />
| [[DSP:RegisterInterruptEvents|RegisterInterruptEvents(param0, param1, 0, eventhandle)]]<br />
|-<br />
| 0x00160000<br />
| [[DSP:GetSemaphoreEventHandle|GetSemaphoreEventHandle]]<br />
|-<br />
| 0x00170040<br />
| [[DSP:SetSemaphoreMask|SetSemaphoreMask]]<br />
|-<br />
| 0x00180040<br />
| GetPhysicalAddress (0x14000000+ -> 0x20000000+, 0x1FF00000+ -> 0x1FF00000+, 0x08000000-0x0E000000 -> 0x00000000+, 0 otherwise)<br />
|-<br />
| 0x00190040<br />
| GetVirtualAddress (0x20000000+ -> 0x14000000+, 0x1FF00000+ -> 0x1FF00000+, 0 otherwise)<br />
|-<br />
| 0x001A0042<br />
| SetIirFilterI2S1. Wrapper for cdc:DSP cmd 1<br />
|-<br />
| 0x001B0042<br />
| SetIirFilterI2S1. Wrapper for cdc:DSP cmd 2<br />
|-<br />
| 0x001C0082<br />
| SetIirFilterEQ. Wrapper for cdc:DSP cmd 3<br />
|-<br />
| 0x001D....<br />
| Wrapper for cdc:DSP cmd 4<br />
|-<br />
| 0x001E....<br />
| Wrapper for cdc:DSP cmd 5<br />
|-<br />
| 0x001F0000<br />
| GetHeadphoneStatus. Wrapper for cdc:DSP cmd 6<br />
|-<br />
| 0x0020....<br />
| Wrapper for cdc:DSP cmd 8<br />
|-<br />
| 0x00210000<br />
| GetIsDspOccupied returns a byte (can be 1 or 0) can be set to 1 in LoadComponent<br />
|}<br />
<br />
This is the main service for playing audio. The [[CSND_Services|CSND]] service can be used for playing audio as well, however most processes use this DSP service for playing audio. The DSP and CSND hardware can play audio simultaneously.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=DSP_Services&diff=9743
DSP Services
2014-09-04T18:23:46Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Services]]<br />
= DSP service "dsp::DSP" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x00010040<br />
| RecvData(chan 0-5)<br />
|-<br />
| 0x00020040<br />
| RecvDataIsReady(chan 0-5)<br />
|-<br />
| 0x00030080<br />
| SendData(chan 0-2)<br />
|-<br />
| 0x00040040<br />
| SendDataIsEmpty(chan 0-2)<br />
|-<br />
| 0x0005...<br />
| ?<br />
|-<br />
| 0x0006...<br />
| ?<br />
|-<br />
| 0x0007....<br />
| [[DSP:WriteReg0x10|WriteReg0x10]] SetSemaphore<br />
|-<br />
| 0x00080000<br />
| GetSemaphore<br />
|-<br />
| 0x00090040<br />
| ClearSemaphore<br />
|-<br />
| 0x000A....<br />
| WriteReg0x18<br />
|-<br />
| 0x000B0000<br />
| CheckSemaphoreRequest<br />
|-<br />
| 0x000C0040<br />
| [[DSP:ConvertProcessAddressFromDspDram|ConvertProcessAddressFromDspDram]]<br />
|-<br />
| 0x000D0082<br />
| [[DSP:WriteProcessPipe|WriteProcessPipe]]<br />
|-<br />
| 0x001000C0<br />
| [[DSP:ReadPipeIfPossible|ReadPipeIfPossible]]<br />
|-<br />
| 0x001100C2<br />
| [[DSP:LoadComponent|LoadComponent]]. This requires RSA-signed DSP firmware specified via the input buffer for this command, the firmware data is eventually written to DSPmem+0(0x1FF00000).<br />
|-<br />
| 0x00120000<br />
| UnloadComponent<br />
|-<br />
| 0x00130082<br />
| FlushDataCache (The buffer must be located in the 0x14000000 region)<br />
| <br />
|-<br />
| 0x00140082<br />
| InvalidateDCache (The buffer must be located in either the 0x14000000 region, or the DSP memory region)<br />
|-<br />
| 0x00150082<br />
| [[DSP:RegisterInterruptEvents|RegisterInterruptEvents(param0, param1, 0, eventhandle)]]<br />
|-<br />
| 0x00160000<br />
| [[DSP:GetSemaphoreEventHandle|GetSemaphoreEventHandle]]<br />
|-<br />
| 0x00170040<br />
| [[DSP:SetSemaphoreMask|SetSemaphoreMask]]<br />
|-<br />
| 0x00180040<br />
| GetPhysicalAddress (0x14000000+ -> 0x20000000+, 0x1FF00000+ -> 0x1FF00000+, 0x08000000-0x0E000000 -> 0x00000000+, 0 otherwise)<br />
|-<br />
| 0x00190040<br />
| GetVirtualAddress (0x20000000+ -> 0x14000000+, 0x1FF00000+ -> 0x1FF00000+, 0 otherwise)<br />
|-<br />
| 0x001A0042<br />
| SetIirFilterI2S1. Wrapper for cdc:DSP cmd 1<br />
|-<br />
| 0x001B0042<br />
| SetIirFilterI2S1. Wrapper for cdc:DSP cmd 2<br />
|-<br />
| 0x001C0082<br />
| SetIirFilterEQ. Wrapper for cdc:DSP cmd 3<br />
|-<br />
| 0x001D....<br />
| Wrapper for cdc:DSP cmd 4<br />
|-<br />
| 0x001E....<br />
| Wrapper for cdc:DSP cmd 5<br />
|-<br />
| 0x001F0000<br />
| GetHeadphoneStatus. Wrapper for cdc:DSP cmd 6<br />
|-<br />
| 0x0020....<br />
| Wrapper for cdc:DSP cmd 8<br />
|-<br />
| 0x00210000<br />
| GetIsDspOccupied returns a byte (can be 1 or 0) can be set to 1 in LoadComponent<br />
|}<br />
<br />
This is the main service for playing audio. The [[CSND_Services|CSND]] service can be used for playing audio as well, however most processes use this DSP service for playing audio. The DSP and CSND hardware can play audio simultaneously.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=DSP_Services&diff=9742
DSP Services
2014-09-04T18:18:48Z
<p>Ichfly: /* DSP service "dsp::DSP" */</p>
<hr />
<div>[[Category:Services]]<br />
= DSP service "dsp::DSP" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x00010040<br />
| RecvData(chan 0-5)<br />
|-<br />
| 0x00020040<br />
| RecvDataIsReady(chan 0-5)<br />
|-<br />
| 0x00030080<br />
| SendData(chan 0-5)<br />
|-<br />
| 0x00040040<br />
| SendDataIsEmpty(chan 0-5)<br />
|-<br />
| 0x0005...<br />
| ?<br />
|-<br />
| 0x0006...<br />
| ?<br />
|-<br />
| 0x0007....<br />
| [[DSP:WriteReg0x10|WriteReg0x10]] SetSemaphore<br />
|-<br />
| 0x00080000<br />
| GetSemaphore<br />
|-<br />
| 0x00090040<br />
| ClearSemaphore<br />
|-<br />
| 0x000A....<br />
| WriteReg0x18<br />
|-<br />
| 0x000B0000<br />
| CheckSemaphoreRequest<br />
|-<br />
| 0x000C0040<br />
| [[DSP:ConvertProcessAddressFromDspDram|ConvertProcessAddressFromDspDram]]<br />
|-<br />
| 0x000D0082<br />
| [[DSP:WriteProcessPipe|WriteProcessPipe]]<br />
|-<br />
| 0x001000C0<br />
| [[DSP:ReadPipeIfPossible|ReadPipeIfPossible]]<br />
|-<br />
| 0x001100C2<br />
| [[DSP:LoadComponent|LoadComponent]]. This requires RSA-signed DSP firmware specified via the input buffer for this command, the firmware data is eventually written to DSPmem+0(0x1FF00000).<br />
|-<br />
| 0x00120000<br />
| UnloadComponent<br />
|-<br />
| 0x00130082<br />
| FlushDataCache (The buffer must be located in the 0x14000000 region)<br />
| <br />
|-<br />
| 0x00140082<br />
| InvalidateDCache (The buffer must be located in either the 0x14000000 region, or the DSP memory region)<br />
|-<br />
| 0x00150082<br />
| [[DSP:RegisterInterruptEvents|RegisterInterruptEvents(param0, param1, 0, eventhandle)]]<br />
|-<br />
| 0x00160000<br />
| [[DSP:GetSemaphoreEventHandle|GetSemaphoreEventHandle]]<br />
|-<br />
| 0x00170040<br />
| [[DSP:SetSemaphoreMask|SetSemaphoreMask]]<br />
|-<br />
| 0x00180040<br />
| GetPhysicalAddress (0x14000000+ -> 0x20000000+, 0x1FF00000+ -> 0x1FF00000+, 0x08000000-0x0E000000 -> 0x00000000+, 0 otherwise)<br />
|-<br />
| 0x00190040<br />
| GetVirtualAddress (0x20000000+ -> 0x14000000+, 0x1FF00000+ -> 0x1FF00000+, 0 otherwise)<br />
|-<br />
| 0x001A0042<br />
| SetIirFilterI2S1. Wrapper for cdc:DSP cmd 1<br />
|-<br />
| 0x001B0042<br />
| SetIirFilterI2S1. Wrapper for cdc:DSP cmd 2<br />
|-<br />
| 0x001C0082<br />
| SetIirFilterEQ. Wrapper for cdc:DSP cmd 3<br />
|-<br />
| 0x001D....<br />
| Wrapper for cdc:DSP cmd 4<br />
|-<br />
| 0x001E....<br />
| Wrapper for cdc:DSP cmd 5<br />
|-<br />
| 0x001F0000<br />
| GetHeadphoneStatus. Wrapper for cdc:DSP cmd 6<br />
|-<br />
| 0x0020....<br />
| Wrapper for cdc:DSP cmd 8<br />
|-<br />
| 0x00210000<br />
| GetIsDspOccupied returns a byte (can be 1 or 0) can be set to 1 in LoadComponent<br />
|}<br />
<br />
This is the main service for playing audio. The [[CSND_Services|CSND]] service can be used for playing audio as well, however most processes use this DSP service for playing audio. The DSP and CSND hardware can play audio simultaneously.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=DSP_Binary&diff=9741
DSP Binary
2014-09-04T18:09:09Z
<p>Ichfly: </p>
<hr />
<div>[[Category:File formats]]<br />
<br />
{| class="wikitable" border="1"<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x100<br />
| RSA Signature<br />
|-<br />
| 0x100<br />
| 4<br />
| Magic ('DSP1')<br />
|-<br />
| 0x104<br />
| 4<br />
| DSP Binary size<br />
|-<br />
| 0x108<br />
| 2<br />
| Memory layout (bits 0-7: Program ram, 8-15: Data ram). Each bit represents a memory region. The region is always 0x8000 bytes in size (the first region starts at 0x1FF00000; the next is a 0x1FF08000 and so on). The HW registers for DSP memory configuration are (u8*)(0x1EC40000 + bit position) (?).<br />
|-<br />
| 0x10C<br />
| 1<br />
| ?<br />
|-<br />
| 0x10D<br />
| 1<br />
| Special segment Mem type (0=1=0x1FF00000(Program ram)+,2=0x1FF40000(Dataram)+)<br />
|-<br />
| 0x10E<br />
| 1<br />
| Num segments (must be 1..10)<br />
|-<br />
| 0x10F<br />
| 1<br />
| Flags (bit0=??, bit1=load special segment)<br />
|-<br />
| 0x110<br />
| 4<br />
| Special segment Start addr in 16-bit words<br />
|-<br />
| 0x114<br />
| 4<br />
| Special segment Size in bytes<br />
|-<br />
| 0x118<br />
| 8<br />
| Zero<br />
|-<br />
| 0x120<br />
| 0x30*10<br />
| Segment records<br />
|}<br />
<br />
If "special segment" flag is set, 0x214 bytes are read from [[CfgS:GetConfigInfoBlk8]] block 0x70000, and then copied to the special segment given. If the reading fails, zeroes are written in its place. The purpose of this segment is currently unknown. <br />
<br />
Each segment record:<br />
<br />
{| class="wikitable" border="1"<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0<br />
| 4<br />
| Offset data<br />
|-<br />
| 4<br />
| 4<br />
| Start addr in 16-bit words (must be < 0x20000 for type 0, < 0x10000 for type 1,2)<br />
|-<br />
| 8<br />
| 4<br />
| Size in bytes<br />
|-<br />
| 15<br />
| 1<br />
| Mem type (0=1=0x1FF00000(Program ram)+,2=0x1FF40000(Data ram)+)<br />
|-<br />
| 16<br />
| 32<br />
| SHA256 hash of segment<br />
|}<br />
<br />
The normal ending of this files is *.cdc</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=DSP_Binary&diff=9740
DSP Binary
2014-09-04T18:07:57Z
<p>Ichfly: </p>
<hr />
<div>[[Category:File formats]]<br />
<br />
{| class="wikitable" border="1"<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x100<br />
| RSA Signature<br />
|-<br />
| 0x100<br />
| 4<br />
| Magic ('DSP1')<br />
|-<br />
| 0x104<br />
| 4<br />
| DSP Binary size<br />
|-<br />
| 0x108<br />
| 2<br />
| Memory layout (bits 0-7: ???, 8-15: ???). Each bit represents a memory region. The region is always 0x8000 bytes in size (the first region starts at 0x1FF00000; the next is a 0x1FF08000 and so on). The HW registers for DSP memory configuration are (u8*)(0x1EC40000 + bit position) (?).<br />
|-<br />
| 0x10C<br />
| 1<br />
| ?<br />
|-<br />
| 0x10D<br />
| 1<br />
| Special segment Mem type (0=1=0x1FF00000+,2=0x1FF40000+)<br />
|-<br />
| 0x10E<br />
| 1<br />
| Num segments (must be 1..10)<br />
|-<br />
| 0x10F<br />
| 1<br />
| Flags (bit0=??, bit1=load special segment)<br />
|-<br />
| 0x110<br />
| 4<br />
| Special segment Start addr in 16-bit words<br />
|-<br />
| 0x114<br />
| 4<br />
| Special segment Size in bytes<br />
|-<br />
| 0x118<br />
| 8<br />
| Zero<br />
|-<br />
| 0x120<br />
| 0x30*10<br />
| Segment records<br />
|}<br />
<br />
If "special segment" flag is set, 0x214 bytes are read from [[CfgS:GetConfigInfoBlk8]] block 0x70000, and then copied to the special segment given. If the reading fails, zeroes are written in its place. The purpose of this segment is currently unknown. <br />
<br />
Each segment record:<br />
<br />
{| class="wikitable" border="1"<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0<br />
| 4<br />
| Offset data<br />
|-<br />
| 4<br />
| 4<br />
| Start addr in 16-bit words (must be < 0x20000 for type 0, < 0x10000 for type 1,2)<br />
|-<br />
| 8<br />
| 4<br />
| Size in bytes<br />
|-<br />
| 15<br />
| 1<br />
| Mem type (0=1=0x1FF00000(Program ram)+,2=0x1FF40000(Data ram)+)<br />
|-<br />
| 16<br />
| 32<br />
| SHA256 hash of segment<br />
|}<br />
<br />
The normal ending of this files is *.cdc</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Services&diff=9639
Services
2014-08-22T19:40:48Z
<p>Ichfly: /* Service Manager Port "srv:" */</p>
<hr />
<div>Handles for services are retrieved from the service manager port, "srv:". Services are an abstraction of ports, they operate the same way except regular ports can have their handles retrieved directly from a [[SVC]](svcConnectToPort).<br />
<br />
Processes with PID less than or equal to the number of NATIVE_FIRM built-in modules (fs, sm, pm, pxi, ldr) have access to all services.<br />
<br />
==Service Manager Port "srv:"==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x00010002<br />
| Initialize<br />
|-<br />
| 0x00020000<br />
| GetProcSemaphore (the handle from this gets signaled when notifications for this process gets triggered)<br />
|-<br />
| 0x00030100<br />
| RegisterService (8-byte servicename, u32 strlen, u32 flags?)<br />
|-<br />
| 0x000400C0<br />
| UnregisterService (8-byte servicename, u32 strlen)<br />
|-<br />
| 0x00050100<br />
| GetServiceHandle (same input as RegisterService)<br />
|-<br />
| 0x000600c2<br />
| RegisterHandle? (8-byte servicename, u32 strlen,Handel h)<br />
|-<br />
| 0x0007....<br />
| UnregisterHandle? (same input as UnregisterService)<br />
|-<br />
| 0x0008....<br />
| ishandlepresent (8-byte servicename, u32 strlen,u32 flags) if flag is set it returns the handle?<br />
|-<br />
| 0x00090040<br />
| IsRegistered This enables the specified notificationID for the current process.<br />
|-<br />
| 0x000A....<br />
| This disable the specified notificationID for the current process (u32 ID)<br />
|-<br />
| 0x000B0000<br />
| ReceiveNotification This returns the notificationID which was triggered, if any(see GetProcSemaphore).<br />
|-<br />
| 0x000C0080<br />
| PublishToSubscriber(u32 ID,u32 flag) ?fire notificationID (Bit(0) only fire if not already fired,Bit(1) = return error if error happen else it always returns 0)<br />
|-<br />
| 0x000D....<br />
| ?can fire notificationIDs and return the number of fired notificationID<br />
|-<br />
| 0x000E....<br />
| returns 1 if the service is registered. 0 if not (8-byte servicename, u32 strlen)<br />
|}<br />
<br />
==Service Manager Process-Manager Port "srv:pm"==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header, prior to [[7.0.0-13]]<br />
! Description<br />
|-<br />
| 0x04030082<br />
| RegisterProcess (u32 procid, u32 wordsz, <nowiki>((wordsz<<16) | 2)</nowiki>, serviceaccesscontrol*).<br />
|-<br />
| 0x04040040<br />
| UnregisterProcess (u32 procid).<br />
|}<br />
<br />
The Register command registers a process with the service-manager, which includes registering the serviceaccesscontrol for the process which normally originates from the [[NCCH/Extended_Header|exheader]].<br />
<br />
Prior to to [[7.0.0-13]], the commands listed for "srv:" were also accessible under this port with the same command-headers. Starting with [[7.0.0-13]], the "srv:pm" port was changed to a service. With this change, commandIDs for these commands were changed. "srv:pm" was originally vulnerable, this was fixed with [[7.0.0-13]], see [[3DS_exploits|here]]. Originally any process could use "srv:pm", however starting with [[7.0.0-13]] only the built-in NATIVE_FIRM sysmodules have access to it. The only system title which uses "srv:pm" is the [[Process_Manager_Services|Process Manager]].<br />
<br />
==Notifications==<br />
{| class="wikitable" border="1"<br />
|-<br />
! ID<br />
! Description<br />
|-<br />
| 0x100<br />
| This indicates that all processes must terminate: power-off, reboot, or [[FIRM]]-launch.<br />
|-<br />
| 0x204<br />
| This indicates that the HOME button was pressed.<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=GSP_Shared_Memory&diff=9601
GSP Shared Memory
2014-08-19T19:10:54Z
<p>Ichfly: </p>
<hr />
<div>This page describes the structure of the GSP [[GSPGPU:RegisterInterruptRelayQueue|shared]] memory. GX commands and framebuffer info is stored here, and other unknown data.<br />
<br />
<br />
=Interrupt info=<br />
The Interrupt info structure is located at sharedmemvadr + process_gsp_index*0x40.<br />
<br />
It is a list of interrupts (id's 0-6 exist).<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Byte<br />
! Description<br />
|-<br />
| 0x0<br />
| Index of the last processed data (field size is 0x33) (must be updated manually)<br />
|-<br />
| 0x1<br />
| To be processed datafields, (max 0x20 for PDC interrupts else the missed PDC filds are used,max 0x34 for all other if more interrupts happen and the Errorflag is 0 the Errorflag is set to 1)<br />
|-<br />
| 0x2<br />
| Errorflag (if the first bit of Errorflag is set future PDC interrupts are ignored)<br />
|-<br />
| 0x3<br />
| not used<br />
|-<br />
| 0x4-0x7<br />
| missed PDC0<br />
|-<br />
| 0x8-0xB<br />
| missed PDC1<br />
|-<br />
| 0xC-0x3F<br />
| u8 Interrupttypefield (0=PSC0, 1=PSC1, 2=PDC0/VBlank1(send to all threads), 3=PDC1/VBlank2 (send to all threads), 4=PPF, 5=P3D, 6=DMA)<br />
|}<br />
<br />
=Framebuffer info=<br />
The framebuffer info structure for the main LCD is located at sharedmemvadr + 0x200 + threadindex*0x80. The framebuffer info structure for the sub LCD is located at sharedmemvadr + 0x240 + threadindex*0x80.<br />
<br />
==Framebuffer info header==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Byte<br />
! Description<br />
|-<br />
| 0<br />
| Framebuffer info [[GSPGPU:SetBufferSwap|entry]] index<br />
|-<br />
| 1<br />
| Flag<br />
|-<br />
| 3-2<br />
| Padding<br />
|}<br />
<br />
When a process sets this framebuffer info, it sets index to <nowiki>(index+1) & 1</nowiki>. Then it writes the framebuffer info entry, and sets flag to value 1. The GSP module loads this framebuffer info entry data into GSP state once the [[GPU]] finishes processing GX commands 3 or 4. Once the GSP module finishes loading this framebuffer info, it sets flag to value 0, then it will not load the framebuffer info again until flag is value 1. After loading this entry data into GSP state, the GSP module then writes this framebuffer state to the [[LCD]] registers. GSP module automatically updates the LCD framebuffer registers each time GX commands 3 or 4 finish, even when this shared memory data was not updated by the application.(GSP module toggles the active framebuffer register when automatically updating LCD registers, when shared memory data is not used)<br />
<br />
The two 0x1C-byte framebuffer info entries are located at framebufferinfo+4.<br />
<br />
=3D Slider and 3D [[GSPGPU:SetLedForceOff|LED]]=<br />
See [[Configuration Memory]].<br />
<br />
=Command Buffer Header=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Byte<br />
! Description<br />
|-<br />
| 0<br />
| Current command index. This index is updated by GSP module after loading the command data, right before the command is processed. When this index is updated by GSP module, the total commands field is decreased by one as well.<br />
|-<br />
| 1<br />
| Total commands to process, must not be value 0 when GSP module handles commands. This must be <=15 when writing a command to shared memory. This is incremented by the application when writing a command to shared memory, after increasing this value [[GSPGPU:TriggerCmdReqQueue|TriggerCmdReqQueue]] is only used if this field is value 1.<br />
|-<br />
| 2<br />
| Must not be value 1. When the error-code u32 is set, this u8 is set to value 0x80.<br />
|-<br />
| 3<br />
| Bit0 must not be set<br />
|-<br />
| 4<br />
| u32 Error code for the last GX command which failed<br />
|}<br />
<br />
The command buffer is located at sharedmem + 0x800 + [[GSPGPU:RegisterInterruptRelayQueue|threadindex]]*0x200. After writing the command data to shared memory, [[GSPGPU:TriggerCmdReqQueue|TriggerCmdReqQueue]] must be used to trigger GSP processing for the command when the total commands field is value 1.<br />
<br />
=Command Header=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Byte<br />
! Description<br />
|-<br />
| 0<br />
| Command ID<br />
|-<br />
| 2-1<br />
| ?<br />
|-<br />
| 3<br />
| When non-zero GSP module may check flags for the specified cmdID, command handling is aborted when the flags are set. The corresponding flag for each CmdID is set once the command is handled by GSP module, this flag is likely cleared once the GPU finishes processing the command.<br />
|}<br />
<br />
The command is located at cmdbuf + 0x20 + cmdindex*0x20, the size of each command is 0x20-bytes. The command parameters are located at command+4. Addresses specified in parameters are application vaddrs, these are usually located in either the process GSP [[Memory_layout|heap]] or VRAM. For applications these addresses are normally located in the GSP heap, while for other processes these addresses are located in VRAM. Addresses/sizes specified in parameters except for cmd0 and cmd5 must be 8-byte [[GPU|aligned]].<br />
<br />
=Commands=<br />
<br />
==GX RequestDma==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| u8 CommandID is 0x00<br />
|-<br />
| 1<br />
| Source address<br />
|-<br />
| 2<br />
| Destination address<br />
|-<br />
| 3<br />
| Size<br />
|-<br />
| 6-4<br />
| Unused<br />
|-<br />
| 7<br />
| Flag: when source buffer is not located in VRAM and this flag is non-zero, svcFlushProcessDataCache is used with the source buffer.<br />
|}<br />
<br />
This command is normally used to DMA data from the application GSP [[Memory_layout|heap]] to VRAM.<br />
<br />
==GX SetCommandList Last==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| u8 CommandID is 0x01<br />
|-<br />
| 1<br />
| Buffer address<br />
|-<br />
| 2<br />
| Buffer size<br />
|-<br />
| 3<br />
| Flag, bit0 is written to GSP module state<br />
|-<br />
| 6-4<br />
| Unused<br />
|-<br />
| 7<br />
| When non-zero, call svcFlushProcessDataCache() with the specified buffer<br />
|}<br />
<br />
This command converts the specified address to a physical address, then writes the physical address and size to the [[GPU]] registers at 0x1EF018E0. This buffer contains [[GPU_Commands|GPU commands]].<br />
<br />
==GX SetMemoryFill==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| u8 CommandID is 0x02<br />
|-<br />
| 1<br />
| Buf0 start address<br />
|-<br />
| 2<br />
| Buf0 value<br />
|-<br />
| 3<br />
| Buf0 end address<br />
|-<br />
| 4<br />
| Buf1 start address<br />
|-<br />
| 5<br />
| Buf1 value<br />
|-<br />
| 6<br />
| Buf1 end address<br />
|-<br />
| 7<br />
| The low u16 is width0, while the high u16 is width1 (?)<br />
|}<br />
<br />
This commands converts the specified addresses to physical addresses, then writes these addresses and the specified parameters to the [[GPU]] registers at 0x1EF00010 and 0x1EF00020. Doing so fills the specified buffers with the associated 4-byte value. This is used to clear GPU framebuffers.<br />
The associated buffer address must not be <= to the main buffer address, thus the associated buffer address must not be zero as well. When the bufX address is zero, processing for the bufX parameters is skipped.<br />
<br />
==GX SetDisplayTransfer==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| u8 CommandID is 0x03<br />
|-<br />
| 1<br />
| Input framebuffer address<br />
|-<br />
| 2<br />
| Output framebuffer address<br />
|-<br />
| 3<br />
| Input framebuffer [[GPU|dimensions]]<br />
|-<br />
| 4<br />
| Output framebuffer dimensions<br />
|-<br />
| 5<br />
| [[GPU|Flags]], for applications this is 0x1001000 for the main screen, and 0x1000 for the sub screen.<br />
|-<br />
| 7-6<br />
| Unused<br />
|}<br />
<br />
This command converts the specified addresses to physical addresses, then writes these physical addresses and parameters to the [[GPU]] registers at 0x1EF00C00. This GPU command copies the already rendered framebuffer data from the input GPU framebuffer address to the specified output LCD framebuffer. The input framebuffer is normally located in VRAM. Note that unlike the LCD framebuffers, the GPU framebuffer seems to use fixed-point/floats for the color format.<br />
<br />
==GX SetTextureCopy==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| u8 CommandID is 0x04<br />
|-<br />
| 1<br />
| Input buffer address<br />
|-<br />
| 2<br />
| Output buffer address<br />
|-<br />
| 3<br />
| Size<br />
|-<br />
| 4<br />
| Input [[GPU|dimensions]]?<br />
|-<br />
| 5<br />
| Output dimensions?<br />
|-<br />
| 6<br />
| Flags, normally this is 0x8, with bit2 optionally set when either of the dimensions fields are set.<br />
|-<br />
| 7<br />
| Unused<br />
|}<br />
<br />
This command is similar to cmd3, this command also writes to the [[GPU]] registers at 0x1EF00C00.<br />
<br />
==GX SetCommandList First ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| u8 CommandID is 0x05<br />
|-<br />
| 1<br />
| Buf0 address<br />
|-<br />
| 2<br />
| Buf0 size<br />
|-<br />
| 3<br />
| Buf1 address<br />
|-<br />
| 4<br />
| Buf1 size<br />
|-<br />
| 5<br />
| Buf2 address<br />
|-<br />
| 6<br />
| Buf2 size<br />
|-<br />
| 7<br />
| Unused<br />
|}<br />
<br />
The application buffer addresses specified in the parameters are used with [[SVC|svcFlushProcessDataCache]]. The input buf0 size must not be zero. When buf1 size is zero, svcFlushProcessDataCache() for buf1 and buf2 are skipped. When buf2 size is zero, svcFlushProcessDataCache() for buf2 is skipped.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=GSP_Shared_Memory&diff=9599
GSP Shared Memory
2014-08-19T17:47:41Z
<p>Ichfly: </p>
<hr />
<div>This page describes the structure of the GSP [[GSPGPU:RegisterInterruptRelayQueue|shared]] memory. GX commands and framebuffer info is stored here, and other unknown data.<br />
<br />
<br />
=Interrupt info=<br />
The Interrupt info structure is located at sharedmemvadr + process_gsp_index*0x40.<br />
<br />
It is a list of interrupts (id's 0-6 exist).<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Byte<br />
! Description<br />
|-<br />
| 0x0<br />
| Index of the last processed data (field size is 0x33) (must be updated manually)<br />
|-<br />
| 0x1<br />
| To be processed datafields, (max 0x20 for PDC interrupts else the missed PDC filds are used,max 0x34 for all other if more interrupts happen and the Errorflag is 0 the Errorflag is set to 1)<br />
|-<br />
| 0x2<br />
| Errorflag (if the first bit of Errorflag is set future PDC interrupts are ignored)<br />
|-<br />
| 0x3<br />
| not used<br />
|-<br />
| 0x4-0x7<br />
| missed PDC0<br />
|-<br />
| 0x8-0xB<br />
| missed PDC1<br />
|-<br />
| 0xC-0x3F<br />
| u8 Interrupttypefild (0=PSC0, 1=PSC1, 2=PDC0/VBlank1(send to all threads), 3=PDC1/VBlank2 (send to all threads), 4=PPF, 5=P3D, 6=DMA)<br />
|}<br />
<br />
=Framebuffer info=<br />
The framebuffer info structure for the main LCD is located at sharedmemvadr + 0x200 + threadindex*0x80. The framebuffer info structure for the sub LCD is located at sharedmemvadr + 0x240 + threadindex*0x80.<br />
<br />
==Framebuffer info header==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Byte<br />
! Description<br />
|-<br />
| 0<br />
| Framebuffer info [[GSPGPU:SetBufferSwap|entry]] index<br />
|-<br />
| 1<br />
| Flag<br />
|-<br />
| 3-2<br />
| Padding<br />
|}<br />
<br />
When a process sets this framebuffer info, it sets index to <nowiki>(index+1) & 1</nowiki>. Then it writes the framebuffer info entry, and sets flag to value 1. The GSP module loads this framebuffer info entry data into GSP state once the [[GPU]] finishes processing GX commands 3 or 4. Once the GSP module finishes loading this framebuffer info, it sets flag to value 0, then it will not load the framebuffer info again until flag is value 1. After loading this entry data into GSP state, the GSP module then writes this framebuffer state to the [[LCD]] registers. GSP module automatically updates the LCD framebuffer registers each time GX commands 3 or 4 finish, even when this shared memory data was not updated by the application.(GSP module toggles the active framebuffer register when automatically updating LCD registers, when shared memory data is not used)<br />
<br />
The two 0x1C-byte framebuffer info entries are located at framebufferinfo+4.<br />
<br />
=3D Slider and 3D [[GSPGPU:SetLedForceOff|LED]]=<br />
See [[Configuration Memory]].<br />
<br />
=Command Buffer Header=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Byte<br />
! Description<br />
|-<br />
| 0<br />
| Current command index. This index is updated by GSP module after loading the command data, right before the command is processed. When this index is updated by GSP module, the total commands field is decreased by one as well.<br />
|-<br />
| 1<br />
| Total commands to process, must not be value 0 when GSP module handles commands. This must be <=15 when writing a command to shared memory. This is incremented by the application when writing a command to shared memory, after increasing this value [[GSPGPU:TriggerCmdReqQueue|TriggerCmdReqQueue]] is only used if this field is value 1.<br />
|-<br />
| 2<br />
| Must not be value 1. When the error-code u32 is set, this u8 is set to value 0x80.<br />
|-<br />
| 3<br />
| Bit0 must not be set<br />
|-<br />
| 4<br />
| u32 Error code for the last GX command which failed<br />
|}<br />
<br />
The command buffer is located at sharedmem + 0x800 + [[GSPGPU:RegisterInterruptRelayQueue|threadindex]]*0x200. After writing the command data to shared memory, [[GSPGPU:TriggerCmdReqQueue|TriggerCmdReqQueue]] must be used to trigger GSP processing for the command when the total commands field is value 1.<br />
<br />
=Command Header=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Byte<br />
! Description<br />
|-<br />
| 0<br />
| Command ID<br />
|-<br />
| 2-1<br />
| ?<br />
|-<br />
| 3<br />
| When non-zero GSP module may check flags for the specified cmdID, command handling is aborted when the flags are set. The corresponding flag for each CmdID is set once the command is handled by GSP module, this flag is likely cleared once the GPU finishes processing the command.<br />
|}<br />
<br />
The command is located at cmdbuf + 0x20 + cmdindex*0x20, the size of each command is 0x20-bytes. The command parameters are located at command+4. Addresses specified in parameters are application vaddrs, these are usually located in either the process GSP [[Memory_layout|heap]] or VRAM. For applications these addresses are normally located in the GSP heap, while for other processes these addresses are located in VRAM. Addresses/sizes specified in parameters except for cmd0 and cmd5 must be 8-byte [[GPU|aligned]].<br />
<br />
=Commands=<br />
<br />
==GX RequestDma==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| u8 CommandID is 0x00<br />
|-<br />
| 1<br />
| Source address<br />
|-<br />
| 2<br />
| Destination address<br />
|-<br />
| 3<br />
| Size<br />
|-<br />
| 6-4<br />
| Unused<br />
|-<br />
| 7<br />
| Flag: when source buffer is not located in VRAM and this flag is non-zero, svcFlushProcessDataCache is used with the source buffer.<br />
|}<br />
<br />
This command is normally used to DMA data from the application GSP [[Memory_layout|heap]] to VRAM.<br />
<br />
==GX SetCommandList Last==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| u8 CommandID is 0x01<br />
|-<br />
| 1<br />
| Buffer address<br />
|-<br />
| 2<br />
| Buffer size<br />
|-<br />
| 3<br />
| Flag, bit0 is written to GSP module state<br />
|-<br />
| 6-4<br />
| Unused<br />
|-<br />
| 7<br />
| When non-zero, call svcFlushProcessDataCache() with the specified buffer<br />
|}<br />
<br />
This command converts the specified address to a physical address, then writes the physical address and size to the [[GPU]] registers at 0x1EF018E0. This buffer contains [[GPU_Commands|GPU commands]].<br />
<br />
==GX SetMemoryFill==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| u8 CommandID is 0x02<br />
|-<br />
| 1<br />
| Buf0 start address<br />
|-<br />
| 2<br />
| Buf0 value<br />
|-<br />
| 3<br />
| Buf0 end address<br />
|-<br />
| 4<br />
| Buf1 start address<br />
|-<br />
| 5<br />
| Buf1 value<br />
|-<br />
| 6<br />
| Buf1 end address<br />
|-<br />
| 7<br />
| The low u16 is width0, while the high u16 is width1 (?)<br />
|}<br />
<br />
This commands converts the specified addresses to physical addresses, then writes these addresses and the specified parameters to the [[GPU]] registers at 0x1EF00010 and 0x1EF00020. Doing so fills the specified buffers with the associated 4-byte value. This is used to clear GPU framebuffers.<br />
The associated buffer address must not be <= to the main buffer address, thus the associated buffer address must not be zero as well. When the bufX address is zero, processing for the bufX parameters is skipped.<br />
<br />
==GX SetDisplayTransfer==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| u8 CommandID is 0x03<br />
|-<br />
| 1<br />
| Input framebuffer address<br />
|-<br />
| 2<br />
| Output framebuffer address<br />
|-<br />
| 3<br />
| Input framebuffer [[GPU|dimensions]]<br />
|-<br />
| 4<br />
| Output framebuffer dimensions<br />
|-<br />
| 5<br />
| [[GPU|Flags]], for applications this is 0x1001000 for the main screen, and 0x1000 for the sub screen.<br />
|-<br />
| 7-6<br />
| Unused<br />
|}<br />
<br />
This command converts the specified addresses to physical addresses, then writes these physical addresses and parameters to the [[GPU]] registers at 0x1EF00C00. This GPU command copies the already rendered framebuffer data from the input GPU framebuffer address to the specified output LCD framebuffer. The input framebuffer is normally located in VRAM. Note that unlike the LCD framebuffers, the GPU framebuffer seems to use fixed-point/floats for the color format.<br />
<br />
==GX SetTextureCopy==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| u8 CommandID is 0x04<br />
|-<br />
| 1<br />
| Input buffer address<br />
|-<br />
| 2<br />
| Output buffer address<br />
|-<br />
| 3<br />
| Size<br />
|-<br />
| 4<br />
| Input [[GPU|dimensions]]?<br />
|-<br />
| 5<br />
| Output dimensions?<br />
|-<br />
| 6<br />
| Flags, normally this is 0x8, with bit2 optionally set when either of the dimensions fields are set.<br />
|-<br />
| 7<br />
| Unused<br />
|}<br />
<br />
This command is similar to cmd3, this command also writes to the [[GPU]] registers at 0x1EF00C00.<br />
<br />
==GX SetCommandList First ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| u8 CommandID is 0x05<br />
|-<br />
| 1<br />
| Buf0 address<br />
|-<br />
| 2<br />
| Buf0 size<br />
|-<br />
| 3<br />
| Buf1 address<br />
|-<br />
| 4<br />
| Buf1 size<br />
|-<br />
| 5<br />
| Buf2 address<br />
|-<br />
| 6<br />
| Buf2 size<br />
|-<br />
| 7<br />
| Unused<br />
|}<br />
<br />
The application buffer addresses specified in the parameters are used with [[SVC|svcFlushProcessDataCache]]. The input buf0 size must not be zero. When buf1 size is zero, svcFlushProcessDataCache() for buf1 and buf2 are skipped. When buf2 size is zero, svcFlushProcessDataCache() for buf2 is skipped.</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Filesystem_services&diff=9459
Filesystem services
2014-07-29T11:31:31Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Services]]<br />
<br />
= Filesystem service "fs:USER" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Available since system version <br />
! Description<br />
! Required [[NCCH/Extended_Header|exheader]] accessinfo bitmask<br />
|-<br />
| 0x000100C6<br />
| <br />
| Dummy1<br />
| None<br />
|-<br />
| 0x040100C4<br />
| <br />
| Control<br />
| None<br />
|-<br />
| 0x08010002<br />
| <br />
| [[FS:Initialize|Initialize]]<br />
| None<br />
|-<br />
| 0x080201C2<br />
| <br />
| [[FS:OpenFile|OpenFile]]<br />
| None<br />
|-<br />
| 0x08030204<br />
| <br />
| [[FS:OpenFileDirectly|OpenFileDirectly]]<br />
| None<br />
|-<br />
| 0x08040142<br />
| <br />
| [[FS:DeleteFile|DeleteFile]]<br />
| None<br />
|-<br />
| 0x08050244<br />
| <br />
| RenameFile<br />
| None<br />
|-<br />
| 0x08060142<br />
| <br />
| DeleteDirectory<br />
| None<br />
|-<br />
| 0x08070142<br />
| <br />
| DeleteDirectoryRecursively<br />
| None<br />
|-<br />
| 0x08080202<br />
| <br />
| CreateFile<br />
| None<br />
|-<br />
| 0x08090182<br />
| <br />
| [[FS:CreateDirectory|CreateDirectory]]<br />
| None<br />
|-<br />
| 0x080A0244<br />
| <br />
| RenameDirectory<br />
| None<br />
|-<br />
| 0x080B0102<br />
| <br />
| [[FS:OpenDirectory|OpenDirectory]]<br />
| None<br />
|-<br />
| 0x080C00C2<br />
| <br />
| [[FS:OpenArchive|OpenArchive]]<br />
| Each archive idcode has separate accessinfo bitmasks, if any.<br />
|-<br />
| 0x080D0144<br />
| <br />
| ControlArchive<br />
| None<br />
|-<br />
| 0x080E0080<br />
| <br />
| [[FS:CloseArchive|CloseArchive]]<br />
| None<br />
|-<br />
| 0x080F0180<br />
| <br />
| FormatThisUserSaveData<br />
| None<br />
|-<br />
| 0x08100200<br />
| <br />
| CreateSystemSaveData<br />
| 0x4, for when the input saveID doesn't match the exheader saveID.<br />
|-<br />
| 0x08110040<br />
| <br />
| DeleteSystemSaveData<br />
| 0x1004, for when the input saveID doesn't match the exheader saveID.<br />
|-<br />
| 0x08120080<br />
| <br />
| GetFreeBytes<br />
| None<br />
|-<br />
| 0x08130000<br />
| <br />
| GetCardType<br />
| 0x1017<br />
|-<br />
| 0x08140000<br />
| <br />
| [[FS:GetSdmcArchiveResource|GetSdmcArchiveResource]]<br />
| None<br />
|-<br />
| 0x08150000<br />
| <br />
| [[FS:GetNandArchiveResource|GetNandArchiveResource]]<br />
| None<br />
|-<br />
| 0x08160000<br />
| <br />
| GetSdmcFatfsError<br />
| 0x2<br />
|-<br />
| 0x08170000<br />
| <br />
| IsSdmcDetected<br />
| None<br />
|-<br />
| 0x08180000<br />
| <br />
| IsSdmcWritable<br />
| None<br />
|-<br />
| 0x08190042<br />
| <br />
| GetSdmcCid<br />
| 0x2<br />
|-<br />
| 0x081A0042<br />
| <br />
| GetNandCid<br />
| 0x2<br />
|-<br />
| 0x081B0000<br />
| <br />
| GetSdmcSpeedInfo<br />
| 0x2<br />
|-<br />
| 0x081C0000<br />
| <br />
| GetNandSpeedInfo<br />
| 0x2<br />
|-<br />
| 0x081D0042<br />
| <br />
| GetSdmcLog<br />
| 0x2<br />
|-<br />
| 0x081E0042<br />
| <br />
| GetNandLog<br />
| 0x2<br />
|-<br />
| 0x081F0000<br />
| <br />
| ClearSdmcLog<br />
| 0x2<br />
|-<br />
| 0x08200000<br />
| <br />
| ClearNandLog<br />
| 0x2<br />
|-<br />
| 0x08210000<br />
| <br />
| CardSlotIsInserted<br />
| 0x1017<br />
|-<br />
| 0x08220000<br />
| <br />
| CardSlotPowerOn<br />
| 0x2<br />
|-<br />
| 0x08230000<br />
| <br />
| CardSlotPowerOff<br />
| 0x2<br />
|-<br />
| 0x08240000<br />
| <br />
| CardSlotGetCardIFPowerStatus<br />
| 0x2<br />
|-<br />
| 0x08250040<br />
| <br />
| CardNorDirectCommand<br />
| 0x2<br />
|-<br />
| 0x08260080<br />
| <br />
| CardNorDirectCommandWithAddress<br />
| 0x2<br />
|-<br />
| 0x08270082<br />
| <br />
| CardNorDirectRead<br />
| 0x2<br />
|-<br />
| 0x082800C2<br />
| <br />
| CardNorDirectReadWithAddress<br />
| 0x2<br />
|-<br />
| 0x08290082<br />
| <br />
| CardNorDirectWrite<br />
| 0x2<br />
|-<br />
| 0x082A00C2<br />
| <br />
| CardNorDirectWriteWithAddress<br />
| 0x2<br />
|-<br />
| 0x082B00C2<br />
| <br />
| CardNorDirectRead_4xIO<br />
| 0x2<br />
|-<br />
| 0x082C0082<br />
| <br />
| CardNorDirectCpuWriteWithoutVerify<br />
| 0x2<br />
|-<br />
| 0x082D0040<br />
| <br />
| CardNorDirectSectorEraseWithoutVerify<br />
| 0x2<br />
|-<br />
| 0x082E0040<br />
| <br />
| [[FS:GetProductInfo|GetProductInfo]]<br />
| 0x1005<br />
|-<br />
| 0x082F0040<br />
| <br />
| [[FS:GetProgramLaunchInfo|GetProgramLaunchInfo]]<br />
| 0x1005<br />
|-<br />
| 0x08300182<br />
| <br />
| CreateExtSaveData<br />
| 0xC, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08310180<br />
| <br />
| CreateSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08320102<br />
| <br />
| [[FS:ReadExtSaveDataIcon|ReadExtSaveDataIcon]]<br />
| 0x100D, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08330082<br />
| <br />
| EnumerateExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08340082<br />
| <br />
| EnumerateSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08350080<br />
| <br />
| DeleteExtSaveData<br />
| 0x100D, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08360080<br />
| <br />
| DeleteSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08370040<br />
| <br />
| SetCardSpiBaudRate<br />
| 0x2<br />
|-<br />
| 0x08380040<br />
| <br />
| SetCardSpiBusMode<br />
| 0x2<br />
|-<br />
| 0x08390000<br />
| <br />
| SendInitializeInfoTo9<br />
| None<br />
|-<br />
| 0x083A0100<br />
| <br />
| GetSpecialContentIndex<br />
| 0x1005<br />
|-<br />
| 0x083B00C2<br />
| <br />
| GetLegacyRomHeader<br />
| 0x1015<br />
|-<br />
| 0x083C00C2<br />
| <br />
| GetLegacyBannerData<br />
| 0x1015<br />
|-<br />
| 0x083D0100<br />
| <br />
| CheckAuthorityToAccessExtSaveData<br />
| 0x44<br />
|-<br />
| 0x083E00C2<br />
| <br />
| QueryTotalQuotaSize<br />
| None<br />
|-<br />
| 0x083F00C0<br />
| <br />
| GetExtDataBlockSize<br />
| None<br />
|-<br />
| 0x08400040<br />
| <br />
| AbnegateAccessRight<br />
| <br />
|-<br />
| 0x08410000<br />
| <br />
| DeleteSdmcRoot<br />
| 0x1005<br />
|-<br />
| 0x08420040<br />
| <br />
| DeleteAllExtSaveDataOnNand<br />
| 0x1005<br />
|-<br />
| 0x08430000<br />
| <br />
| [[FS:InitializeCtrFileSystem|InitializeCtrFileSystem]]<br />
| None<br />
|-<br />
| 0x08440000<br />
| <br />
| CreateSeed<br />
| 0x2<br />
|-<br />
| 0x084500C2<br />
| <br />
| GetFormatInfo<br />
| ?<br />
|-<br />
| 0x08460102<br />
| <br />
| GetLegacyRomHeader2<br />
| 0x1015<br />
|-<br />
| 0x08470180<br />
| <br />
| FormatCtrCardUserSaveData<br />
| 0x6<br />
|-<br />
| 0x08480042<br />
| <br />
| GetSdmcCtrRootPath<br />
| 0x100D<br />
|-<br />
| 0x08490040<br />
| <br />
| GetArchiveResource<br />
| ?<br />
|-<br />
| 0x084A0002<br />
| <br />
| ExportIntegrityVerificationSeed<br />
| 0x4000<br />
|-<br />
| 0x084B0002<br />
| <br />
| ImportIntegrityVerificationSeed<br />
| 0x4000<br />
|-<br />
| 0x084C0242<br />
| <br />
| FormatSaveData<br />
| 0x6, in some cases this right isn't needed however.<br />
|-<br />
| 0x084D0102<br />
| <br />
| GetLegacySubBannerData<br />
| 0x1015<br />
|-<br />
| 0x084E0342<br />
| <br />
| [[FS:UpdateSha256Context|UpdateSha256Context]]<br />
| 0x5<br />
|-<br />
| 0x084F0102<br />
| <br />
| ReadSpecialFile<br />
| None<br />
|-<br />
| 0x08500040<br />
| <br />
| GetSpecialFileSize<br />
| None<br />
|-<br />
| 0x08510242<br />
| [[3.0.0-5]]<br />
| ?<br />
| Shared extdata: 0x101005. Regular extdata in certain cases: 0xC.<br />
|-<br />
| 0x08520100<br />
| [[3.0.0-5]]<br />
| Unknown (u32 flags, u64 extdataID)<br />
| Shared extdata: 0x101005. Regular extdata in certain cases: 0x10100D.<br />
|-<br />
| 0x08530142<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x10100D(this doesn't apply in certain cases however)<br />
|-<br />
| 0x085400C0<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x10100D(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08550102<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x101005<br />
|-<br />
| 0x08560200<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x4(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08570080<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x1004(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08580000<br />
| [[3.0.0-5]]<br />
| [[FS:GetMovableSedHashedKeyYRandomData|GetMovableSedHashedKeyYRandomData]]<br />
| 0x2004<br />
|-<br />
| 0x08590200<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x2004<br />
|-<br />
| 0x085A00C0<br />
| [[3.0.0-5]]<br />
| ?(u64 ID?,u32 unk)<br />
| None<br />
|-<br />
| 0x085B0040?<br />
| [[3.0.0-5]]<br />
| ?(u64 ID?,u32 *ret)<br />
| None<br />
|-<br />
| 0x085C00C0<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x085D0180<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x100001<br />
|-<br />
| 0x085E0040<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x085F0040<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x12004<br />
|-<br />
| 0x08600042<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x2004<br />
|-<br />
| 0x08610042<br />
| [[3.0.0-5]]<br />
| InitializeWithSdkVersion<br />
| None<br />
|-<br />
| 0x08620040<br />
| [[3.0.0-5]]<br />
| SetPriority<br />
| None<br />
|-<br />
| 0x08630000<br />
| [[3.0.0-5]]<br />
| GetPriority<br />
| None<br />
|-<br />
| 0x08640000<br />
| [[3.0.0-5]]<br />
| Stubbed, this returns an error.<br />
| None<br />
|-<br />
| 0x08650140<br />
| [[4.0.0-7]]<br />
| Unknown, this is used with [[Anti Savegame Restore]].<br />
| 0x121004(in certain cases this doesn't apply however)<br />
|-<br />
| 0x086600C0<br />
| [[4.0.0-7]]<br />
| Unknown, this is used with [[Anti Savegame Restore]].<br />
| 0x121004(in certain cases this doesn't apply however)<br />
|-<br />
| 0x086700C4<br />
| [[4.0.0-7]]<br />
| ?<br />
| 0x121004<br />
|-<br />
| 0x08680000<br />
| [[4.0.0-7]]<br />
| This loads the u8 mediatype for the current application from already initialized state, this u8 was originally loaded from the same data used by [[FS:GetProgramLaunchInfo|GetProgramLaunchInfo]]. This then writes the u8 to response-word[2]. This is used with [[Anti Savegame Restore]].<br />
| None<br />
|-<br />
| 0x08690000<br />
| [[4.0.0-7]]<br />
| Stubbed, this returns an error.<br />
| None<br />
|-<br />
| 0x086A0082<br />
| [[4.0.0-7]]<br />
| This is a wrapper for [[Filesystem_services_PXI|FSPXI]] command 0x00550082.<br />
| None<br />
|-<br />
| 0x086B00C2<br />
| ?<br />
| ?<br />
| 00121004<br />
|-<br />
| 0x086C00C2<br />
| ?<br />
| ?<br />
| 00121004<br />
|-<br />
| 0x086D0040<br />
| ?<br />
| ?<br />
| 00020004<br />
|-<br />
| 0x086E00C0<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x086F0040<br />
| ?<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x087000C2<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x08710100<br />
| ?<br />
| ?<br />
| 0xC<br />
|-<br />
| 0x087201C0<br />
| ?<br />
| ?<br />
| 00080004<br />
|-<br />
| 0x087300C0<br />
| ?<br />
| ?<br />
| 00080004<br />
|-<br />
| 0x08740000<br />
| ?<br />
| ?<br />
| 00080004<br />
|-<br />
| 0x08750140<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x087600C0<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x08770100<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x087800C0<br />
| ?<br />
| ?<br />
| ?<br />
|}<br />
<br />
When access rights are required for a command, at least one of the bits in the process accessinfo specified in the above table for the command must be set. Error 0xD9004676 is returned when a process attempts to use a command which it doesn't have access rights for the command. The exheader accessinfo field is all-zero for most applications. Note that the permissions listed in the above table is for system-version v2.x, therefore permission bit(s) added with newer FIRM may be missing from this.<br />
<br />
Each session for fs:USER has separate permissions, initially these are set to all-zero for new fs:USER sessions. The permissions/etc for fs:USER sessions are initialized via [[FS:Initialize]](loaded from the user process exheader).<br />
<br />
=File service=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040100C4<br />
| Control<br />
|-<br />
| 0x08010100<br />
| OpenSubFile<br />
|-<br />
| 0x080200C2<br />
| [[FSFile:Read|Read]]<br />
|-<br />
| 0x08030102<br />
| [[FSFile:Write|Write]]<br />
|-<br />
| 0x08040000<br />
| [[FSFile:GetSize|GetSize]]<br />
|-<br />
| 0x08050080<br />
| [[FSFile:SetSize|SetSize]]<br />
|-<br />
| 0x08060000<br />
| GetAttributes<br />
|-<br />
| 0x08070040<br />
| SetAttributes<br />
|-<br />
| 0x08080000<br />
| [[FSFile:Close|Close]]<br />
|-<br />
| 0x08090000<br />
| Flush<br />
|}<br />
<br />
=Directory service=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040100C4<br />
| Control<br />
|-<br />
| 0x08010042<br />
| [[FSDir:Read|Read]]<br />
|-<br />
| 0x08020000<br />
| [[FSDir:Close|Close]]<br />
|}<br />
<br />
= Filesystem service "fs:LDR" =<br />
This service is identical to fs:USER, except [[FS:OpenArchive]] archive 0x2345678E can only be accessed with fs:LDR.<br />
<br />
= ProgramRegistry service "fs:REG" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040103C0<br />
| Register<br />
|-<br />
| 0x04020040<br />
| Unregister<br />
|-<br />
| 0x040300C0<br />
| GetProgramInfo<br />
|-<br />
| 0x04040100<br />
| LoadProgram<br />
|-<br />
| 0x04050080<br />
| UnloadProgram<br />
|-<br />
| 0x04060080<br />
| CheckHostLoadId<br />
|}<br />
<br />
=Errors=<br />
See [[Filesystem_services_PXI]].</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Filesystem_services&diff=9458
Filesystem services
2014-07-29T11:14:42Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Services]]<br />
<br />
= Filesystem service "fs:USER" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Available since system version <br />
! Description<br />
! Required [[NCCH/Extended_Header|exheader]] accessinfo bitmask<br />
|-<br />
| 0x000100C6<br />
| <br />
| Dummy1<br />
| None<br />
|-<br />
| 0x040100C4<br />
| <br />
| Control<br />
| None<br />
|-<br />
| 0x08010002<br />
| <br />
| [[FS:Initialize|Initialize]]<br />
| None<br />
|-<br />
| 0x080201C2<br />
| <br />
| [[FS:OpenFile|OpenFile]]<br />
| None<br />
|-<br />
| 0x08030204<br />
| <br />
| [[FS:OpenFileDirectly|OpenFileDirectly]]<br />
| None<br />
|-<br />
| 0x08040142<br />
| <br />
| [[FS:DeleteFile|DeleteFile]]<br />
| None<br />
|-<br />
| 0x08050244<br />
| <br />
| RenameFile<br />
| None<br />
|-<br />
| 0x08060142<br />
| <br />
| DeleteDirectory<br />
| None<br />
|-<br />
| 0x08070142<br />
| <br />
| DeleteDirectoryRecursively<br />
| None<br />
|-<br />
| 0x08080202<br />
| <br />
| CreateFile<br />
| None<br />
|-<br />
| 0x08090182<br />
| <br />
| [[FS:CreateDirectory|CreateDirectory]]<br />
| None<br />
|-<br />
| 0x080A0244<br />
| <br />
| RenameDirectory<br />
| None<br />
|-<br />
| 0x080B0102<br />
| <br />
| [[FS:OpenDirectory|OpenDirectory]]<br />
| None<br />
|-<br />
| 0x080C00C2<br />
| <br />
| [[FS:OpenArchive|OpenArchive]]<br />
| Each archive idcode has separate accessinfo bitmasks, if any.<br />
|-<br />
| 0x080D0144<br />
| <br />
| ControlArchive<br />
| None<br />
|-<br />
| 0x080E0080<br />
| <br />
| [[FS:CloseArchive|CloseArchive]]<br />
| None<br />
|-<br />
| 0x080F0180<br />
| <br />
| FormatThisUserSaveData<br />
| None<br />
|-<br />
| 0x08100200<br />
| <br />
| CreateSystemSaveData<br />
| 0x4, for when the input saveID doesn't match the exheader saveID.<br />
|-<br />
| 0x08110040<br />
| <br />
| DeleteSystemSaveData<br />
| 0x1004, for when the input saveID doesn't match the exheader saveID.<br />
|-<br />
| 0x08120080<br />
| <br />
| GetFreeBytes<br />
| None<br />
|-<br />
| 0x08130000<br />
| <br />
| GetCardType<br />
| 0x1017<br />
|-<br />
| 0x08140000<br />
| <br />
| [[FS:GetSdmcArchiveResource|GetSdmcArchiveResource]]<br />
| None<br />
|-<br />
| 0x08150000<br />
| <br />
| [[FS:GetNandArchiveResource|GetNandArchiveResource]]<br />
| None<br />
|-<br />
| 0x08160000<br />
| <br />
| GetSdmcFatfsError<br />
| 0x2<br />
|-<br />
| 0x08170000<br />
| <br />
| IsSdmcDetected<br />
| None<br />
|-<br />
| 0x08180000<br />
| <br />
| IsSdmcWritable<br />
| None<br />
|-<br />
| 0x08190042<br />
| <br />
| GetSdmcCid<br />
| 0x2<br />
|-<br />
| 0x081A0042<br />
| <br />
| GetNandCid<br />
| 0x2<br />
|-<br />
| 0x081B0000<br />
| <br />
| GetSdmcSpeedInfo<br />
| 0x2<br />
|-<br />
| 0x081C0000<br />
| <br />
| GetNandSpeedInfo<br />
| 0x2<br />
|-<br />
| 0x081D0042<br />
| <br />
| GetSdmcLog<br />
| 0x2<br />
|-<br />
| 0x081E0042<br />
| <br />
| GetNandLog<br />
| 0x2<br />
|-<br />
| 0x081F0000<br />
| <br />
| ClearSdmcLog<br />
| 0x2<br />
|-<br />
| 0x08200000<br />
| <br />
| ClearNandLog<br />
| 0x2<br />
|-<br />
| 0x08210000<br />
| <br />
| CardSlotIsInserted<br />
| 0x1017<br />
|-<br />
| 0x08220000<br />
| <br />
| CardSlotPowerOn<br />
| 0x2<br />
|-<br />
| 0x08230000<br />
| <br />
| CardSlotPowerOff<br />
| 0x2<br />
|-<br />
| 0x08240000<br />
| <br />
| CardSlotGetCardIFPowerStatus<br />
| 0x2<br />
|-<br />
| 0x08250040<br />
| <br />
| CardNorDirectCommand<br />
| 0x2<br />
|-<br />
| 0x08260080<br />
| <br />
| CardNorDirectCommandWithAddress<br />
| 0x2<br />
|-<br />
| 0x08270082<br />
| <br />
| CardNorDirectRead<br />
| 0x2<br />
|-<br />
| 0x082800C2<br />
| <br />
| CardNorDirectReadWithAddress<br />
| 0x2<br />
|-<br />
| 0x08290082<br />
| <br />
| CardNorDirectWrite<br />
| 0x2<br />
|-<br />
| 0x082A00C2<br />
| <br />
| CardNorDirectWriteWithAddress<br />
| 0x2<br />
|-<br />
| 0x082B00C2<br />
| <br />
| CardNorDirectRead_4xIO<br />
| 0x2<br />
|-<br />
| 0x082C0082<br />
| <br />
| CardNorDirectCpuWriteWithoutVerify<br />
| 0x2<br />
|-<br />
| 0x082D0040<br />
| <br />
| CardNorDirectSectorEraseWithoutVerify<br />
| 0x2<br />
|-<br />
| 0x082E0040<br />
| <br />
| [[FS:GetProductInfo|GetProductInfo]]<br />
| 0x1005<br />
|-<br />
| 0x082F0040<br />
| <br />
| [[FS:GetProgramLaunchInfo|GetProgramLaunchInfo]]<br />
| 0x1005<br />
|-<br />
| 0x08300182<br />
| <br />
| CreateExtSaveData<br />
| 0xC, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08310180<br />
| <br />
| CreateSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08320102<br />
| <br />
| [[FS:ReadExtSaveDataIcon|ReadExtSaveDataIcon]]<br />
| 0x100D, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08330082<br />
| <br />
| EnumerateExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08340082<br />
| <br />
| EnumerateSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08350080<br />
| <br />
| DeleteExtSaveData<br />
| 0x100D, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08360080<br />
| <br />
| DeleteSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08370040<br />
| <br />
| SetCardSpiBaudRate<br />
| 0x2<br />
|-<br />
| 0x08380040<br />
| <br />
| SetCardSpiBusMode<br />
| 0x2<br />
|-<br />
| 0x08390000<br />
| <br />
| SendInitializeInfoTo9<br />
| None<br />
|-<br />
| 0x083A0100<br />
| <br />
| GetSpecialContentIndex<br />
| 0x1005<br />
|-<br />
| 0x083B00C2<br />
| <br />
| GetLegacyRomHeader<br />
| 0x1015<br />
|-<br />
| 0x083C00C2<br />
| <br />
| GetLegacyBannerData<br />
| 0x1015<br />
|-<br />
| 0x083D0100<br />
| <br />
| CheckAuthorityToAccessExtSaveData<br />
| 0x44<br />
|-<br />
| 0x083E00C2<br />
| <br />
| QueryTotalQuotaSize<br />
| None<br />
|-<br />
| 0x083F00C0<br />
| <br />
| GetExtDataBlockSize<br />
| None<br />
|-<br />
| 0x08400040<br />
| <br />
| AbnegateAccessRight<br />
| <br />
|-<br />
| 0x08410000<br />
| <br />
| DeleteSdmcRoot<br />
| 0x1005<br />
|-<br />
| 0x08420040<br />
| <br />
| DeleteAllExtSaveDataOnNand<br />
| 0x1005<br />
|-<br />
| 0x08430000<br />
| <br />
| [[FS:InitializeCtrFileSystem|InitializeCtrFileSystem]]<br />
| None<br />
|-<br />
| 0x08440000<br />
| <br />
| CreateSeed<br />
| 0x2<br />
|-<br />
| 0x084500C2<br />
| <br />
| GetFormatInfo<br />
| ?<br />
|-<br />
| 0x08460102<br />
| <br />
| GetLegacyRomHeader2<br />
| 0x1015<br />
|-<br />
| 0x08470180<br />
| <br />
| FormatCtrCardUserSaveData<br />
| 0x6<br />
|-<br />
| 0x08480042<br />
| <br />
| GetSdmcCtrRootPath<br />
| 0x100D<br />
|-<br />
| 0x08490040<br />
| <br />
| GetArchiveResource<br />
| ?<br />
|-<br />
| 0x084A0002<br />
| <br />
| ExportIntegrityVerificationSeed<br />
| 0x4000<br />
|-<br />
| 0x084B0002<br />
| <br />
| ImportIntegrityVerificationSeed<br />
| 0x4000<br />
|-<br />
| 0x084C0242<br />
| <br />
| FormatSaveData<br />
| 0x6, in some cases this right isn't needed however.<br />
|-<br />
| 0x084D0102<br />
| <br />
| GetLegacySubBannerData<br />
| 0x1015<br />
|-<br />
| 0x084E0342<br />
| <br />
| [[FS:UpdateSha256Context|UpdateSha256Context]]<br />
| 0x5<br />
|-<br />
| 0x084F0102<br />
| <br />
| ReadSpecialFile<br />
| None<br />
|-<br />
| 0x08500040<br />
| <br />
| GetSpecialFileSize<br />
| None<br />
|-<br />
| 0x08510242<br />
| [[3.0.0-5]]<br />
| ?<br />
| Shared extdata: 0x101005. Regular extdata in certain cases: 0xC.<br />
|-<br />
| 0x08520100<br />
| [[3.0.0-5]]<br />
| Unknown (u32 flags, u64 extdataID)<br />
| Shared extdata: 0x101005. Regular extdata in certain cases: 0x10100D.<br />
|-<br />
| 0x08530142<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x10100D(this doesn't apply in certain cases however)<br />
|-<br />
| 0x085400C0<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x10100D(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08550102<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x101005<br />
|-<br />
| 0x08560200<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x4(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08570080<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x1004(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08580000<br />
| [[3.0.0-5]]<br />
| [[FS:GetMovableSedHashedKeyYRandomData|GetMovableSedHashedKeyYRandomData]]<br />
| 0x2004<br />
|-<br />
| 0x08590200<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x2004<br />
|-<br />
| 0x085A00C0<br />
| [[3.0.0-5]]<br />
| ?setOpenFlags?(u64 ID?,u32 unk)<br />
| None<br />
|-<br />
| 0x085B0040?<br />
| [[3.0.0-5]]<br />
| ?getOpenFlags?(u64 ID?,u32 *ret)<br />
| None<br />
|-<br />
| 0x085C00C0<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x085D0180<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x100001<br />
|-<br />
| 0x085E0040<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x085F0040<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x12004<br />
|-<br />
| 0x08600042<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x2004<br />
|-<br />
| 0x08610042<br />
| [[3.0.0-5]]<br />
| InitializeWithSdkVersion<br />
| None<br />
|-<br />
| 0x08620040<br />
| [[3.0.0-5]]<br />
| SetPriority<br />
| None<br />
|-<br />
| 0x08630000<br />
| [[3.0.0-5]]<br />
| GetPriority<br />
| None<br />
|-<br />
| 0x08640000<br />
| [[3.0.0-5]]<br />
| Stubbed, this returns an error.<br />
| None<br />
|-<br />
| 0x08650140<br />
| [[4.0.0-7]]<br />
| Unknown, this is used with [[Anti Savegame Restore]].<br />
| 0x121004(in certain cases this doesn't apply however)<br />
|-<br />
| 0x086600C0<br />
| [[4.0.0-7]]<br />
| Unknown, this is used with [[Anti Savegame Restore]].<br />
| 0x121004(in certain cases this doesn't apply however)<br />
|-<br />
| 0x086700C4<br />
| [[4.0.0-7]]<br />
| ?<br />
| 0x121004<br />
|-<br />
| 0x08680000<br />
| [[4.0.0-7]]<br />
| This loads the u8 mediatype for the current application from already initialized state, this u8 was originally loaded from the same data used by [[FS:GetProgramLaunchInfo|GetProgramLaunchInfo]]. This then writes the u8 to response-word[2]. This is used with [[Anti Savegame Restore]].<br />
| None<br />
|-<br />
| 0x08690000<br />
| [[4.0.0-7]]<br />
| Stubbed, this returns an error.<br />
| None<br />
|-<br />
| 0x086A0082<br />
| [[4.0.0-7]]<br />
| This is a wrapper for [[Filesystem_services_PXI|FSPXI]] command 0x00550082.<br />
| None<br />
|-<br />
| 0x086B00C2<br />
| ?<br />
| ?<br />
| 00121004<br />
|-<br />
| 0x086C00C2<br />
| ?<br />
| ?<br />
| 00121004<br />
|-<br />
| 0x086D0040<br />
| ?<br />
| ?<br />
| 00020004<br />
|-<br />
| 0x086E00C0<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x086F0040<br />
| ?<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x087000C2<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x08710100<br />
| ?<br />
| ?<br />
| 0xC<br />
|-<br />
| 0x087201C0<br />
| ?<br />
| ?<br />
| 00080004<br />
|-<br />
| 0x087300C0<br />
| ?<br />
| ?<br />
| 00080004<br />
|-<br />
| 0x08740000<br />
| ?<br />
| ?<br />
| 00080004<br />
|-<br />
| 0x08750140<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x087600C0<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x08770100<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x087800C0<br />
| ?<br />
| ?<br />
| ?<br />
|}<br />
<br />
When access rights are required for a command, at least one of the bits in the process accessinfo specified in the above table for the command must be set. Error 0xD9004676 is returned when a process attempts to use a command which it doesn't have access rights for the command. The exheader accessinfo field is all-zero for most applications. Note that the permissions listed in the above table is for system-version v2.x, therefore permission bit(s) added with newer FIRM may be missing from this.<br />
<br />
Each session for fs:USER has separate permissions, initially these are set to all-zero for new fs:USER sessions. The permissions/etc for fs:USER sessions are initialized via [[FS:Initialize]](loaded from the user process exheader).<br />
<br />
=File service=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040100C4<br />
| Control<br />
|-<br />
| 0x08010100<br />
| OpenSubFile<br />
|-<br />
| 0x080200C2<br />
| [[FSFile:Read|Read]]<br />
|-<br />
| 0x08030102<br />
| [[FSFile:Write|Write]]<br />
|-<br />
| 0x08040000<br />
| [[FSFile:GetSize|GetSize]]<br />
|-<br />
| 0x08050080<br />
| [[FSFile:SetSize|SetSize]]<br />
|-<br />
| 0x08060000<br />
| GetAttributes<br />
|-<br />
| 0x08070040<br />
| SetAttributes<br />
|-<br />
| 0x08080000<br />
| [[FSFile:Close|Close]]<br />
|-<br />
| 0x08090000<br />
| Flush<br />
|}<br />
<br />
=Directory service=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040100C4<br />
| Control<br />
|-<br />
| 0x08010042<br />
| [[FSDir:Read|Read]]<br />
|-<br />
| 0x08020000<br />
| [[FSDir:Close|Close]]<br />
|}<br />
<br />
= Filesystem service "fs:LDR" =<br />
This service is identical to fs:USER, except [[FS:OpenArchive]] archive 0x2345678E can only be accessed with fs:LDR.<br />
<br />
= ProgramRegistry service "fs:REG" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040103C0<br />
| Register<br />
|-<br />
| 0x04020040<br />
| Unregister<br />
|-<br />
| 0x040300C0<br />
| GetProgramInfo<br />
|-<br />
| 0x04040100<br />
| LoadProgram<br />
|-<br />
| 0x04050080<br />
| UnloadProgram<br />
|-<br />
| 0x04060080<br />
| CheckHostLoadId<br />
|}<br />
<br />
=Errors=<br />
See [[Filesystem_services_PXI]].</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Filesystem_services&diff=9457
Filesystem services
2014-07-29T11:13:11Z
<p>Ichfly: /* Filesystem service "fs:USER" */</p>
<hr />
<div>[[Category:Services]]<br />
<br />
= Filesystem service "fs:USER" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Available since system version <br />
! Description<br />
! Required [[NCCH/Extended_Header|exheader]] accessinfo bitmask<br />
|-<br />
| 0x000100C6<br />
| <br />
| Dummy1<br />
| None<br />
|-<br />
| 0x040100C4<br />
| <br />
| Control<br />
| None<br />
|-<br />
| 0x08010002<br />
| <br />
| [[FS:Initialize|Initialize]]<br />
| None<br />
|-<br />
| 0x080201C2<br />
| <br />
| [[FS:OpenFile|OpenFile]]<br />
| None<br />
|-<br />
| 0x08030204<br />
| <br />
| [[FS:OpenFileDirectly|OpenFileDirectly]]<br />
| None<br />
|-<br />
| 0x08040142<br />
| <br />
| [[FS:DeleteFile|DeleteFile]]<br />
| None<br />
|-<br />
| 0x08050244<br />
| <br />
| RenameFile<br />
| None<br />
|-<br />
| 0x08060142<br />
| <br />
| DeleteDirectory<br />
| None<br />
|-<br />
| 0x08070142<br />
| <br />
| DeleteDirectoryRecursively<br />
| None<br />
|-<br />
| 0x08080202<br />
| <br />
| CreateFile<br />
| None<br />
|-<br />
| 0x08090182<br />
| <br />
| [[FS:CreateDirectory|CreateDirectory]]<br />
| None<br />
|-<br />
| 0x080A0244<br />
| <br />
| RenameDirectory<br />
| None<br />
|-<br />
| 0x080B0102<br />
| <br />
| [[FS:OpenDirectory|OpenDirectory]]<br />
| None<br />
|-<br />
| 0x080C00C2<br />
| <br />
| [[FS:OpenArchive|OpenArchive]]<br />
| Each archive idcode has separate accessinfo bitmasks, if any.<br />
|-<br />
| 0x080D0144<br />
| <br />
| ControlArchive<br />
| None<br />
|-<br />
| 0x080E0080<br />
| <br />
| [[FS:CloseArchive|CloseArchive]]<br />
| None<br />
|-<br />
| 0x080F0180<br />
| <br />
| FormatThisUserSaveData<br />
| None<br />
|-<br />
| 0x08100200<br />
| <br />
| CreateSystemSaveData<br />
| 0x4, for when the input saveID doesn't match the exheader saveID.<br />
|-<br />
| 0x08110040<br />
| <br />
| DeleteSystemSaveData<br />
| 0x1004, for when the input saveID doesn't match the exheader saveID.<br />
|-<br />
| 0x08120080<br />
| <br />
| GetFreeBytes<br />
| None<br />
|-<br />
| 0x08130000<br />
| <br />
| GetCardType<br />
| 0x1017<br />
|-<br />
| 0x08140000<br />
| <br />
| [[FS:GetSdmcArchiveResource|GetSdmcArchiveResource]]<br />
| None<br />
|-<br />
| 0x08150000<br />
| <br />
| [[FS:GetNandArchiveResource|GetNandArchiveResource]]<br />
| None<br />
|-<br />
| 0x08160000<br />
| <br />
| GetSdmcFatfsError<br />
| 0x2<br />
|-<br />
| 0x08170000<br />
| <br />
| IsSdmcDetected<br />
| None<br />
|-<br />
| 0x08180000<br />
| <br />
| IsSdmcWritable<br />
| None<br />
|-<br />
| 0x08190042<br />
| <br />
| GetSdmcCid<br />
| 0x2<br />
|-<br />
| 0x081A0042<br />
| <br />
| GetNandCid<br />
| 0x2<br />
|-<br />
| 0x081B0000<br />
| <br />
| GetSdmcSpeedInfo<br />
| 0x2<br />
|-<br />
| 0x081C0000<br />
| <br />
| GetNandSpeedInfo<br />
| 0x2<br />
|-<br />
| 0x081D0042<br />
| <br />
| GetSdmcLog<br />
| 0x2<br />
|-<br />
| 0x081E0042<br />
| <br />
| GetNandLog<br />
| 0x2<br />
|-<br />
| 0x081F0000<br />
| <br />
| ClearSdmcLog<br />
| 0x2<br />
|-<br />
| 0x08200000<br />
| <br />
| ClearNandLog<br />
| 0x2<br />
|-<br />
| 0x08210000<br />
| <br />
| CardSlotIsInserted<br />
| 0x1017<br />
|-<br />
| 0x08220000<br />
| <br />
| CardSlotPowerOn<br />
| 0x2<br />
|-<br />
| 0x08230000<br />
| <br />
| CardSlotPowerOff<br />
| 0x2<br />
|-<br />
| 0x08240000<br />
| <br />
| CardSlotGetCardIFPowerStatus<br />
| 0x2<br />
|-<br />
| 0x08250040<br />
| <br />
| CardNorDirectCommand<br />
| 0x2<br />
|-<br />
| 0x08260080<br />
| <br />
| CardNorDirectCommandWithAddress<br />
| 0x2<br />
|-<br />
| 0x08270082<br />
| <br />
| CardNorDirectRead<br />
| 0x2<br />
|-<br />
| 0x082800C2<br />
| <br />
| CardNorDirectReadWithAddress<br />
| 0x2<br />
|-<br />
| 0x08290082<br />
| <br />
| CardNorDirectWrite<br />
| 0x2<br />
|-<br />
| 0x082A00C2<br />
| <br />
| CardNorDirectWriteWithAddress<br />
| 0x2<br />
|-<br />
| 0x082B00C2<br />
| <br />
| CardNorDirectRead_4xIO<br />
| 0x2<br />
|-<br />
| 0x082C0082<br />
| <br />
| CardNorDirectCpuWriteWithoutVerify<br />
| 0x2<br />
|-<br />
| 0x082D0040<br />
| <br />
| CardNorDirectSectorEraseWithoutVerify<br />
| 0x2<br />
|-<br />
| 0x082E0040<br />
| <br />
| [[FS:GetProductInfo|GetProductInfo]]<br />
| 0x1005<br />
|-<br />
| 0x082F0040<br />
| <br />
| [[FS:GetProgramLaunchInfo|GetProgramLaunchInfo]]<br />
| 0x1005<br />
|-<br />
| 0x08300182<br />
| <br />
| CreateExtSaveData<br />
| 0xC, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08310180<br />
| <br />
| CreateSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08320102<br />
| <br />
| [[FS:ReadExtSaveDataIcon|ReadExtSaveDataIcon]]<br />
| 0x100D, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08330082<br />
| <br />
| EnumerateExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08340082<br />
| <br />
| EnumerateSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08350080<br />
| <br />
| DeleteExtSaveData<br />
| 0x100D, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08360080<br />
| <br />
| DeleteSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08370040<br />
| <br />
| SetCardSpiBaudRate<br />
| 0x2<br />
|-<br />
| 0x08380040<br />
| <br />
| SetCardSpiBusMode<br />
| 0x2<br />
|-<br />
| 0x08390000<br />
| <br />
| SendInitializeInfoTo9<br />
| None<br />
|-<br />
| 0x083A0100<br />
| <br />
| GetSpecialContentIndex<br />
| 0x1005<br />
|-<br />
| 0x083B00C2<br />
| <br />
| GetLegacyRomHeader<br />
| 0x1015<br />
|-<br />
| 0x083C00C2<br />
| <br />
| GetLegacyBannerData<br />
| 0x1015<br />
|-<br />
| 0x083D0100<br />
| <br />
| CheckAuthorityToAccessExtSaveData<br />
| 0x44<br />
|-<br />
| 0x083E00C2<br />
| <br />
| QueryTotalQuotaSize<br />
| None<br />
|-<br />
| 0x083F00C0<br />
| <br />
| GetExtDataBlockSize<br />
| None<br />
|-<br />
| 0x08400040<br />
| <br />
| AbnegateAccessRight<br />
| <br />
|-<br />
| 0x08410000<br />
| <br />
| DeleteSdmcRoot<br />
| 0x1005<br />
|-<br />
| 0x08420040<br />
| <br />
| DeleteAllExtSaveDataOnNand<br />
| 0x1005<br />
|-<br />
| 0x08430000<br />
| <br />
| [[FS:InitializeCtrFileSystem|InitializeCtrFileSystem]]<br />
| None<br />
|-<br />
| 0x08440000<br />
| <br />
| CreateSeed<br />
| 0x2<br />
|-<br />
| 0x084500C2<br />
| <br />
| GetFormatInfo<br />
| ?<br />
|-<br />
| 0x08460102<br />
| <br />
| GetLegacyRomHeader2<br />
| 0x1015<br />
|-<br />
| 0x08470180<br />
| <br />
| FormatCtrCardUserSaveData<br />
| 0x6<br />
|-<br />
| 0x08480042<br />
| <br />
| GetSdmcCtrRootPath<br />
| 0x100D<br />
|-<br />
| 0x08490040<br />
| <br />
| GetArchiveResource<br />
| ?<br />
|-<br />
| 0x084A0002<br />
| <br />
| ExportIntegrityVerificationSeed<br />
| 0x4000<br />
|-<br />
| 0x084B0002<br />
| <br />
| ImportIntegrityVerificationSeed<br />
| 0x4000<br />
|-<br />
| 0x084C0242<br />
| <br />
| FormatSaveData<br />
| 0x6, in some cases this right isn't needed however.<br />
|-<br />
| 0x084D0102<br />
| <br />
| GetLegacySubBannerData<br />
| 0x1015<br />
|-<br />
| 0x084E0342<br />
| <br />
| [[FS:UpdateSha256Context|UpdateSha256Context]]<br />
| 0x5<br />
|-<br />
| 0x084F0102<br />
| <br />
| ReadSpecialFile<br />
| None<br />
|-<br />
| 0x08500040<br />
| <br />
| GetSpecialFileSize<br />
| None<br />
|-<br />
| 0x08510242<br />
| [[3.0.0-5]]<br />
| ?<br />
| Shared extdata: 0x101005. Regular extdata in certain cases: 0xC.<br />
|-<br />
| 0x08520100<br />
| [[3.0.0-5]]<br />
| Unknown (u32 flags, u64 extdataID)<br />
| Shared extdata: 0x101005. Regular extdata in certain cases: 0x10100D.<br />
|-<br />
| 0x08530142<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x10100D(this doesn't apply in certain cases however)<br />
|-<br />
| 0x085400C0<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x10100D(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08550102<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x101005<br />
|-<br />
| 0x08560200<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x4(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08570080<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x1004(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08580000<br />
| [[3.0.0-5]]<br />
| [[FS:GetMovableSedHashedKeyYRandomData|GetMovableSedHashedKeyYRandomData]]<br />
| 0x2004<br />
|-<br />
| 0x08590200<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x2004<br />
|-<br />
| 0x085A00C0<br />
| [[3.0.0-5]]<br />
| ? ?setOpenFlags?(u64 ID?,u32 unk)<br />
| None<br />
|-<br />
| 0x085B0040?<br />
| [[3.0.0-5]]<br />
| ?getOpenFlags?(u64 ID?,u32 *ret)<br />
| None<br />
|-<br />
| 0x085C00C0<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x085D0180<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x100001<br />
|-<br />
| 0x085E0040<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x085F0040<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x12004<br />
|-<br />
| 0x08600042<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x2004<br />
|-<br />
| 0x08610042<br />
| [[3.0.0-5]]<br />
| InitializeWithSdkVersion<br />
| None<br />
|-<br />
| 0x08620040<br />
| [[3.0.0-5]]<br />
| SetPriority<br />
| None<br />
|-<br />
| 0x08630000<br />
| [[3.0.0-5]]<br />
| GetPriority<br />
| None<br />
|-<br />
| 0x08640000<br />
| [[3.0.0-5]]<br />
| Stubbed, this returns an error.<br />
| None<br />
|-<br />
| 0x08650140<br />
| [[4.0.0-7]]<br />
| Unknown, this is used with [[Anti Savegame Restore]].<br />
| 0x121004(in certain cases this doesn't apply however)<br />
|-<br />
| 0x086600C0<br />
| [[4.0.0-7]]<br />
| Unknown, this is used with [[Anti Savegame Restore]].<br />
| 0x121004(in certain cases this doesn't apply however)<br />
|-<br />
| 0x086700C4<br />
| [[4.0.0-7]]<br />
| ?<br />
| 0x121004<br />
|-<br />
| 0x08680000<br />
| [[4.0.0-7]]<br />
| This loads the u8 mediatype for the current application from already initialized state, this u8 was originally loaded from the same data used by [[FS:GetProgramLaunchInfo|GetProgramLaunchInfo]]. This then writes the u8 to response-word[2]. This is used with [[Anti Savegame Restore]].<br />
| None<br />
|-<br />
| 0x08690000<br />
| [[4.0.0-7]]<br />
| Stubbed, this returns an error.<br />
| None<br />
|-<br />
| 0x086A0082<br />
| [[4.0.0-7]]<br />
| This is a wrapper for [[Filesystem_services_PXI|FSPXI]] command 0x00550082.<br />
| None<br />
|-<br />
| 0x086B00C2<br />
| ?<br />
| ?<br />
| 00121004<br />
|-<br />
| 0x086C00C2<br />
| ?<br />
| ?<br />
| 00121004<br />
|-<br />
| 0x086D0040<br />
| ?<br />
| ?<br />
| 00020004<br />
|-<br />
| 0x086E00C0<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x086F0040<br />
| ?<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x087000C2<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x08710100<br />
| ?<br />
| ?<br />
| 0xC<br />
|-<br />
| 0x087201C0<br />
| ?<br />
| ?<br />
| 00080004<br />
|-<br />
| 0x087300C0<br />
| ?<br />
| ?<br />
| 00080004<br />
|-<br />
| 0x08740000<br />
| ?<br />
| ?<br />
| 00080004<br />
|-<br />
| 0x08750140<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x087600C0<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x08770100<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x087800C0<br />
| ?<br />
| ?<br />
| ?<br />
|}<br />
<br />
When access rights are required for a command, at least one of the bits in the process accessinfo specified in the above table for the command must be set. Error 0xD9004676 is returned when a process attempts to use a command which it doesn't have access rights for the command. The exheader accessinfo field is all-zero for most applications. Note that the permissions listed in the above table is for system-version v2.x, therefore permission bit(s) added with newer FIRM may be missing from this.<br />
<br />
Each session for fs:USER has separate permissions, initially these are set to all-zero for new fs:USER sessions. The permissions/etc for fs:USER sessions are initialized via [[FS:Initialize]](loaded from the user process exheader).<br />
<br />
=File service=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040100C4<br />
| Control<br />
|-<br />
| 0x08010100<br />
| OpenSubFile<br />
|-<br />
| 0x080200C2<br />
| [[FSFile:Read|Read]]<br />
|-<br />
| 0x08030102<br />
| [[FSFile:Write|Write]]<br />
|-<br />
| 0x08040000<br />
| [[FSFile:GetSize|GetSize]]<br />
|-<br />
| 0x08050080<br />
| [[FSFile:SetSize|SetSize]]<br />
|-<br />
| 0x08060000<br />
| GetAttributes<br />
|-<br />
| 0x08070040<br />
| SetAttributes<br />
|-<br />
| 0x08080000<br />
| [[FSFile:Close|Close]]<br />
|-<br />
| 0x08090000<br />
| Flush<br />
|}<br />
<br />
=Directory service=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040100C4<br />
| Control<br />
|-<br />
| 0x08010042<br />
| [[FSDir:Read|Read]]<br />
|-<br />
| 0x08020000<br />
| [[FSDir:Close|Close]]<br />
|}<br />
<br />
= Filesystem service "fs:LDR" =<br />
This service is identical to fs:USER, except [[FS:OpenArchive]] archive 0x2345678E can only be accessed with fs:LDR.<br />
<br />
= ProgramRegistry service "fs:REG" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040103C0<br />
| Register<br />
|-<br />
| 0x04020040<br />
| Unregister<br />
|-<br />
| 0x040300C0<br />
| GetProgramInfo<br />
|-<br />
| 0x04040100<br />
| LoadProgram<br />
|-<br />
| 0x04050080<br />
| UnloadProgram<br />
|-<br />
| 0x04060080<br />
| CheckHostLoadId<br />
|}<br />
<br />
=Errors=<br />
See [[Filesystem_services_PXI]].</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Filesystem_services&diff=9413
Filesystem services
2014-07-27T17:00:48Z
<p>Ichfly: </p>
<hr />
<div>[[Category:Services]]<br />
<br />
= Filesystem service "fs:USER" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Available since system version <br />
! Description<br />
! Required [[NCCH/Extended_Header|exheader]] accessinfo bitmask<br />
|-<br />
| 0x000100C6<br />
| <br />
| Dummy1<br />
| None<br />
|-<br />
| 0x040100C4<br />
| <br />
| Control<br />
| None<br />
|-<br />
| 0x08010002<br />
| <br />
| [[FS:Initialize|Initialize]]<br />
| None<br />
|-<br />
| 0x080201C2<br />
| <br />
| [[FS:OpenFile|OpenFile]]<br />
| None<br />
|-<br />
| 0x08030204<br />
| <br />
| [[FS:OpenFileDirectly|OpenFileDirectly]]<br />
| None<br />
|-<br />
| 0x08040142<br />
| <br />
| [[FS:DeleteFile|DeleteFile]]<br />
| None<br />
|-<br />
| 0x08050244<br />
| <br />
| RenameFile<br />
| None<br />
|-<br />
| 0x08060142<br />
| <br />
| DeleteDirectory<br />
| None<br />
|-<br />
| 0x08070142<br />
| <br />
| DeleteDirectoryRecursively<br />
| None<br />
|-<br />
| 0x08080202<br />
| <br />
| CreateFile<br />
| None<br />
|-<br />
| 0x08090182<br />
| <br />
| [[FS:CreateDirectory|CreateDirectory]]<br />
| None<br />
|-<br />
| 0x080A0244<br />
| <br />
| RenameDirectory<br />
| None<br />
|-<br />
| 0x080B0102<br />
| <br />
| [[FS:OpenDirectory|OpenDirectory]]<br />
| None<br />
|-<br />
| 0x080C00C2<br />
| <br />
| [[FS:OpenArchive|OpenArchive]]<br />
| Each archive idcode has separate accessinfo bitmasks, if any.<br />
|-<br />
| 0x080D0144<br />
| <br />
| ControlArchive<br />
| None<br />
|-<br />
| 0x080E0080<br />
| <br />
| [[FS:CloseArchive|CloseArchive]]<br />
| None<br />
|-<br />
| 0x080F0180<br />
| <br />
| FormatThisUserSaveData<br />
| None<br />
|-<br />
| 0x08100200<br />
| <br />
| CreateSystemSaveData<br />
| 0x4, for when the input saveID doesn't match the exheader saveID.<br />
|-<br />
| 0x08110040<br />
| <br />
| DeleteSystemSaveData<br />
| 0x1004, for when the input saveID doesn't match the exheader saveID.<br />
|-<br />
| 0x08120080<br />
| <br />
| GetFreeBytes<br />
| None<br />
|-<br />
| 0x08130000<br />
| <br />
| GetCardType<br />
| 0x1017<br />
|-<br />
| 0x08140000<br />
| <br />
| [[FS:GetSdmcArchiveResource|GetSdmcArchiveResource]]<br />
| None<br />
|-<br />
| 0x08150000<br />
| <br />
| [[FS:GetNandArchiveResource|GetNandArchiveResource]]<br />
| None<br />
|-<br />
| 0x08160000<br />
| <br />
| GetSdmcFatfsError<br />
| 0x2<br />
|-<br />
| 0x08170000<br />
| <br />
| IsSdmcDetected<br />
| None<br />
|-<br />
| 0x08180000<br />
| <br />
| IsSdmcWritable<br />
| None<br />
|-<br />
| 0x08190042<br />
| <br />
| GetSdmcCid<br />
| 0x2<br />
|-<br />
| 0x081A0042<br />
| <br />
| GetNandCid<br />
| 0x2<br />
|-<br />
| 0x081B0000<br />
| <br />
| GetSdmcSpeedInfo<br />
| 0x2<br />
|-<br />
| 0x081C0000<br />
| <br />
| GetNandSpeedInfo<br />
| 0x2<br />
|-<br />
| 0x081D0042<br />
| <br />
| GetSdmcLog<br />
| 0x2<br />
|-<br />
| 0x081E0042<br />
| <br />
| GetNandLog<br />
| 0x2<br />
|-<br />
| 0x081F0000<br />
| <br />
| ClearSdmcLog<br />
| 0x2<br />
|-<br />
| 0x08200000<br />
| <br />
| ClearNandLog<br />
| 0x2<br />
|-<br />
| 0x08210000<br />
| <br />
| CardSlotIsInserted<br />
| 0x1017<br />
|-<br />
| 0x08220000<br />
| <br />
| CardSlotPowerOn<br />
| 0x2<br />
|-<br />
| 0x08230000<br />
| <br />
| CardSlotPowerOff<br />
| 0x2<br />
|-<br />
| 0x08240000<br />
| <br />
| CardSlotGetCardIFPowerStatus<br />
| 0x2<br />
|-<br />
| 0x08250040<br />
| <br />
| CardNorDirectCommand<br />
| 0x2<br />
|-<br />
| 0x08260080<br />
| <br />
| CardNorDirectCommandWithAddress<br />
| 0x2<br />
|-<br />
| 0x08270082<br />
| <br />
| CardNorDirectRead<br />
| 0x2<br />
|-<br />
| 0x082800C2<br />
| <br />
| CardNorDirectReadWithAddress<br />
| 0x2<br />
|-<br />
| 0x08290082<br />
| <br />
| CardNorDirectWrite<br />
| 0x2<br />
|-<br />
| 0x082A00C2<br />
| <br />
| CardNorDirectWriteWithAddress<br />
| 0x2<br />
|-<br />
| 0x082B00C2<br />
| <br />
| CardNorDirectRead_4xIO<br />
| 0x2<br />
|-<br />
| 0x082C0082<br />
| <br />
| CardNorDirectCpuWriteWithoutVerify<br />
| 0x2<br />
|-<br />
| 0x082D0040<br />
| <br />
| CardNorDirectSectorEraseWithoutVerify<br />
| 0x2<br />
|-<br />
| 0x082E0040<br />
| <br />
| [[FS:GetProductInfo|GetProductInfo]]<br />
| 0x1005<br />
|-<br />
| 0x082F0040<br />
| <br />
| [[FS:GetProgramLaunchInfo|GetProgramLaunchInfo]]<br />
| 0x1005<br />
|-<br />
| 0x08300182<br />
| <br />
| CreateExtSaveData<br />
| 0xC, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08310180<br />
| <br />
| CreateSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08320102<br />
| <br />
| [[FS:ReadExtSaveDataIcon|ReadExtSaveDataIcon]]<br />
| 0x100D, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08330082<br />
| <br />
| EnumerateExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08340082<br />
| <br />
| EnumerateSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08350080<br />
| <br />
| DeleteExtSaveData<br />
| 0x100D, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08360080<br />
| <br />
| DeleteSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08370040<br />
| <br />
| SetCardSpiBaudRate<br />
| 0x2<br />
|-<br />
| 0x08380040<br />
| <br />
| SetCardSpiBusMode<br />
| 0x2<br />
|-<br />
| 0x08390000<br />
| <br />
| SendInitializeInfoTo9<br />
| None<br />
|-<br />
| 0x083A0100<br />
| <br />
| GetSpecialContentIndex<br />
| 0x1005<br />
|-<br />
| 0x083B00C2<br />
| <br />
| GetLegacyRomHeader<br />
| 0x1015<br />
|-<br />
| 0x083C00C2<br />
| <br />
| GetLegacyBannerData<br />
| 0x1015<br />
|-<br />
| 0x083D0100<br />
| <br />
| CheckAuthorityToAccessExtSaveData<br />
| 0x44<br />
|-<br />
| 0x083E00C2<br />
| <br />
| QueryTotalQuotaSize<br />
| None<br />
|-<br />
| 0x083F00C0<br />
| <br />
| GetExtDataBlockSize<br />
| None<br />
|-<br />
| 0x08400040<br />
| <br />
| AbnegateAccessRight<br />
| <br />
|-<br />
| 0x08410000<br />
| <br />
| DeleteSdmcRoot<br />
| 0x1005<br />
|-<br />
| 0x08420040<br />
| <br />
| DeleteAllExtSaveDataOnNand<br />
| 0x1005<br />
|-<br />
| 0x08430000<br />
| <br />
| [[FS:InitializeCtrFileSystem|InitializeCtrFileSystem]]<br />
| None<br />
|-<br />
| 0x08440000<br />
| <br />
| CreateSeed<br />
| 0x2<br />
|-<br />
| 0x084500C2<br />
| <br />
| GetFormatInfo<br />
| ?<br />
|-<br />
| 0x08460102<br />
| <br />
| GetLegacyRomHeader2<br />
| 0x1015<br />
|-<br />
| 0x08470180<br />
| <br />
| FormatCtrCardUserSaveData<br />
| 0x6<br />
|-<br />
| 0x08480042<br />
| <br />
| GetSdmcCtrRootPath<br />
| 0x100D<br />
|-<br />
| 0x08490040<br />
| <br />
| GetArchiveResource<br />
| ?<br />
|-<br />
| 0x084A0002<br />
| <br />
| ExportIntegrityVerificationSeed<br />
| 0x4000<br />
|-<br />
| 0x084B0002<br />
| <br />
| ImportIntegrityVerificationSeed<br />
| 0x4000<br />
|-<br />
| 0x084C0242<br />
| <br />
| FormatSaveData<br />
| 0x6, in some cases this right isn't needed however.<br />
|-<br />
| 0x084D0102<br />
| <br />
| GetLegacySubBannerData<br />
| 0x1015<br />
|-<br />
| 0x084E0342<br />
| <br />
| [[FS:UpdateSha256Context|UpdateSha256Context]]<br />
| 0x5<br />
|-<br />
| 0x084F0102<br />
| <br />
| ReadSpecialFile<br />
| None<br />
|-<br />
| 0x08500040<br />
| <br />
| GetSpecialFileSize<br />
| None<br />
|-<br />
| 0x08510242<br />
| [[3.0.0-5]]<br />
| ?<br />
| Shared extdata: 0x101005. Regular extdata in certain cases: 0xC.<br />
|-<br />
| 0x08520100<br />
| [[3.0.0-5]]<br />
| Unknown (u32 flags, u64 extdataID)<br />
| Shared extdata: 0x101005. Regular extdata in certain cases: 0x10100D.<br />
|-<br />
| 0x08530142<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x10100D(this doesn't apply in certain cases however)<br />
|-<br />
| 0x085400C0<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x10100D(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08550102<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x101005<br />
|-<br />
| 0x08560200<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x4(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08570080<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x1004(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08580000<br />
| [[3.0.0-5]]<br />
| [[FS:GetMovableSedHashedKeyYRandomData|GetMovableSedHashedKeyYRandomData]]<br />
| 0x2004<br />
|-<br />
| 0x08590200<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x2004<br />
|-<br />
| 0x085A00C0<br />
| [[3.0.0-5]]<br />
| ? (u64 ID?,u32 unk)<br />
| None<br />
|-<br />
| 0x085B0040?<br />
| [[3.0.0-5]]<br />
| ?(u64 ID?,u32 *ret)<br />
| None<br />
|-<br />
| 0x085C00C0<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x085D0180<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x100001<br />
|-<br />
| 0x085E0040<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x085F0040<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x12004<br />
|-<br />
| 0x08600042<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x2004<br />
|-<br />
| 0x08610042<br />
| [[3.0.0-5]]<br />
| InitializeWithSdkVersion<br />
| None<br />
|-<br />
| 0x08620040<br />
| [[3.0.0-5]]<br />
| SetPriority<br />
| None<br />
|-<br />
| 0x08630000<br />
| [[3.0.0-5]]<br />
| GetPriority<br />
| None<br />
|-<br />
| 0x08640000<br />
| [[3.0.0-5]]<br />
| Stubbed, this returns an error.<br />
| None<br />
|-<br />
| 0x08650140<br />
| [[4.0.0-7]]<br />
| Unknown, this is used with [[Anti Savegame Restore]].<br />
| 0x121004(in certain cases this doesn't apply however)<br />
|-<br />
| 0x086600C0<br />
| [[4.0.0-7]]<br />
| Unknown, this is used with [[Anti Savegame Restore]].<br />
| 0x121004(in certain cases this doesn't apply however)<br />
|-<br />
| 0x086700C4<br />
| [[4.0.0-7]]<br />
| ?<br />
| 0x121004<br />
|-<br />
| 0x08680000<br />
| [[4.0.0-7]]<br />
| This loads the u8 mediatype for the current application from already initialized state, this u8 was originally loaded from the same data used by [[FS:GetProgramLaunchInfo|GetProgramLaunchInfo]]. This then writes the u8 to response-word[2]. This is used with [[Anti Savegame Restore]].<br />
| None<br />
|-<br />
| 0x08690000<br />
| [[4.0.0-7]]<br />
| Stubbed, this returns an error.<br />
| None<br />
|-<br />
| 0x086A0082<br />
| [[4.0.0-7]]<br />
| This is a wrapper for [[Filesystem_services_PXI|FSPXI]] command 0x00550082.<br />
| None<br />
|-<br />
| 0x086B00C2<br />
| ?<br />
| ?<br />
| 00121004<br />
|-<br />
| 0x086C00C2<br />
| ?<br />
| ?<br />
| 00121004<br />
|-<br />
| 0x086D0040<br />
| ?<br />
| ?<br />
| 00020004<br />
|-<br />
| 0x086E00C0<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x086F0040<br />
| ?<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x087000C2<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x08710100<br />
| ?<br />
| ?<br />
| 0xC<br />
|-<br />
| 0x087201C0<br />
| ?<br />
| ?<br />
| 00080004<br />
|-<br />
| 0x087300C0<br />
| ?<br />
| ?<br />
| 00080004<br />
|-<br />
| 0x08740000<br />
| ?<br />
| ?<br />
| 00080004<br />
|-<br />
| 0x08750140<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x087600C0<br />
| ?<br />
| ?<br />
| ?None?<br />
|-<br />
| 0x08770100<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x087800C0<br />
| ?<br />
| ?<br />
| ?<br />
|}<br />
<br />
When access rights are required for a command, at least one of the bits in the process accessinfo specified in the above table for the command must be set. Error 0xD9004676 is returned when a process attempts to use a command which it doesn't have access rights for the command. The exheader accessinfo field is all-zero for most applications. Note that the permissions listed in the above table is for system-version v2.x, therefore permission bit(s) added with newer FIRM may be missing from this.<br />
<br />
Each session for fs:USER has separate permissions, initially these are set to all-zero for new fs:USER sessions. The permissions/etc for fs:USER sessions are initialized via [[FS:Initialize]](loaded from the user process exheader).<br />
<br />
=File service=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040100C4<br />
| Control<br />
|-<br />
| 0x08010100<br />
| OpenSubFile<br />
|-<br />
| 0x080200C2<br />
| [[FSFile:Read|Read]]<br />
|-<br />
| 0x08030102<br />
| [[FSFile:Write|Write]]<br />
|-<br />
| 0x08040000<br />
| [[FSFile:GetSize|GetSize]]<br />
|-<br />
| 0x08050080<br />
| [[FSFile:SetSize|SetSize]]<br />
|-<br />
| 0x08060000<br />
| GetAttributes<br />
|-<br />
| 0x08070040<br />
| SetAttributes<br />
|-<br />
| 0x08080000<br />
| [[FSFile:Close|Close]]<br />
|-<br />
| 0x08090000<br />
| Flush<br />
|}<br />
<br />
=Directory service=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040100C4<br />
| Control<br />
|-<br />
| 0x08010042<br />
| [[FSDir:Read|Read]]<br />
|-<br />
| 0x08020000<br />
| [[FSDir:Close|Close]]<br />
|}<br />
<br />
= Filesystem service "fs:LDR" =<br />
This service is identical to fs:USER, except [[FS:OpenArchive]] archive 0x2345678E can only be accessed with fs:LDR.<br />
<br />
= ProgramRegistry service "fs:REG" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040103C0<br />
| Register<br />
|-<br />
| 0x04020040<br />
| Unregister<br />
|-<br />
| 0x040300C0<br />
| GetProgramInfo<br />
|-<br />
| 0x04040100<br />
| LoadProgram<br />
|-<br />
| 0x04050080<br />
| UnloadProgram<br />
|-<br />
| 0x04060080<br />
| CheckHostLoadId<br />
|}<br />
<br />
=Errors=<br />
See [[Filesystem_services_PXI]].</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=Filesystem_services&diff=9412
Filesystem services
2014-07-27T16:22:09Z
<p>Ichfly: /* Filesystem service "fs:USER" */</p>
<hr />
<div>[[Category:Services]]<br />
<br />
= Filesystem service "fs:USER" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Available since system version <br />
! Description<br />
! Required [[NCCH/Extended_Header|exheader]] accessinfo bitmask<br />
|-<br />
| 0x000100C6<br />
| <br />
| Dummy1<br />
| None<br />
|-<br />
| 0x040100C4<br />
| <br />
| Control<br />
| None<br />
|-<br />
| 0x08010002<br />
| <br />
| [[FS:Initialize|Initialize]]<br />
| None<br />
|-<br />
| 0x080201C2<br />
| <br />
| [[FS:OpenFile|OpenFile]]<br />
| None<br />
|-<br />
| 0x08030204<br />
| <br />
| [[FS:OpenFileDirectly|OpenFileDirectly]]<br />
| None<br />
|-<br />
| 0x08040142<br />
| <br />
| [[FS:DeleteFile|DeleteFile]]<br />
| None<br />
|-<br />
| 0x08050244<br />
| <br />
| RenameFile<br />
| None<br />
|-<br />
| 0x08060142<br />
| <br />
| DeleteDirectory<br />
| None<br />
|-<br />
| 0x08070142<br />
| <br />
| DeleteDirectoryRecursively<br />
| None<br />
|-<br />
| 0x08080202<br />
| <br />
| CreateFile<br />
| None<br />
|-<br />
| 0x08090182<br />
| <br />
| [[FS:CreateDirectory|CreateDirectory]]<br />
| None<br />
|-<br />
| 0x080A0244<br />
| <br />
| RenameDirectory<br />
| None<br />
|-<br />
| 0x080B0102<br />
| <br />
| [[FS:OpenDirectory|OpenDirectory]]<br />
| None<br />
|-<br />
| 0x080C00C2<br />
| <br />
| [[FS:OpenArchive|OpenArchive]]<br />
| Each archive idcode has separate accessinfo bitmasks, if any.<br />
|-<br />
| 0x080D0144<br />
| <br />
| ControlArchive<br />
| None<br />
|-<br />
| 0x080E0080<br />
| <br />
| [[FS:CloseArchive|CloseArchive]]<br />
| None<br />
|-<br />
| 0x080F0180<br />
| <br />
| FormatThisUserSaveData<br />
| None<br />
|-<br />
| 0x08100200<br />
| <br />
| CreateSystemSaveData<br />
| 0x4, for when the input saveID doesn't match the exheader saveID.<br />
|-<br />
| 0x08110040<br />
| <br />
| DeleteSystemSaveData<br />
| 0x1004, for when the input saveID doesn't match the exheader saveID.<br />
|-<br />
| 0x08120080<br />
| <br />
| GetFreeBytes<br />
| None<br />
|-<br />
| 0x08130000<br />
| <br />
| GetCardType<br />
| 0x1017<br />
|-<br />
| 0x08140000<br />
| <br />
| [[FS:GetSdmcArchiveResource|GetSdmcArchiveResource]]<br />
| None<br />
|-<br />
| 0x08150000<br />
| <br />
| [[FS:GetNandArchiveResource|GetNandArchiveResource]]<br />
| None<br />
|-<br />
| 0x08160000<br />
| <br />
| GetSdmcFatfsError<br />
| 0x2<br />
|-<br />
| 0x08170000<br />
| <br />
| IsSdmcDetected<br />
| None<br />
|-<br />
| 0x08180000<br />
| <br />
| IsSdmcWritable<br />
| None<br />
|-<br />
| 0x08190042<br />
| <br />
| GetSdmcCid<br />
| 0x2<br />
|-<br />
| 0x081A0042<br />
| <br />
| GetNandCid<br />
| 0x2<br />
|-<br />
| 0x081B0000<br />
| <br />
| GetSdmcSpeedInfo<br />
| 0x2<br />
|-<br />
| 0x081C0000<br />
| <br />
| GetNandSpeedInfo<br />
| 0x2<br />
|-<br />
| 0x081D0042<br />
| <br />
| GetSdmcLog<br />
| 0x2<br />
|-<br />
| 0x081E0042<br />
| <br />
| GetNandLog<br />
| 0x2<br />
|-<br />
| 0x081F0000<br />
| <br />
| ClearSdmcLog<br />
| 0x2<br />
|-<br />
| 0x08200000<br />
| <br />
| ClearNandLog<br />
| 0x2<br />
|-<br />
| 0x08210000<br />
| <br />
| CardSlotIsInserted<br />
| 0x1017<br />
|-<br />
| 0x08220000<br />
| <br />
| CardSlotPowerOn<br />
| 0x2<br />
|-<br />
| 0x08230000<br />
| <br />
| CardSlotPowerOff<br />
| 0x2<br />
|-<br />
| 0x08240000<br />
| <br />
| CardSlotGetCardIFPowerStatus<br />
| 0x2<br />
|-<br />
| 0x08250040<br />
| <br />
| CardNorDirectCommand<br />
| 0x2<br />
|-<br />
| 0x08260080<br />
| <br />
| CardNorDirectCommandWithAddress<br />
| 0x2<br />
|-<br />
| 0x08270082<br />
| <br />
| CardNorDirectRead<br />
| 0x2<br />
|-<br />
| 0x082800C2<br />
| <br />
| CardNorDirectReadWithAddress<br />
| 0x2<br />
|-<br />
| 0x08290082<br />
| <br />
| CardNorDirectWrite<br />
| 0x2<br />
|-<br />
| 0x082A00C2<br />
| <br />
| CardNorDirectWriteWithAddress<br />
| 0x2<br />
|-<br />
| 0x082B00C2<br />
| <br />
| CardNorDirectRead_4xIO<br />
| 0x2<br />
|-<br />
| 0x082C0082<br />
| <br />
| CardNorDirectCpuWriteWithoutVerify<br />
| 0x2<br />
|-<br />
| 0x082D0040<br />
| <br />
| CardNorDirectSectorEraseWithoutVerify<br />
| 0x2<br />
|-<br />
| 0x082E0040<br />
| <br />
| [[FS:GetProductInfo|GetProductInfo]]<br />
| 0x1005<br />
|-<br />
| 0x082F0040<br />
| <br />
| [[FS:GetProgramLaunchInfo|GetProgramLaunchInfo]]<br />
| 0x1005<br />
|-<br />
| 0x08300182<br />
| <br />
| CreateExtSaveData<br />
| 0xC, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08310180<br />
| <br />
| CreateSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08320102<br />
| <br />
| [[FS:ReadExtSaveDataIcon|ReadExtSaveDataIcon]]<br />
| 0x100D, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08330082<br />
| <br />
| EnumerateExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08340082<br />
| <br />
| EnumerateSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08350080<br />
| <br />
| DeleteExtSaveData<br />
| 0x100D, for when the input extdataID doesn't match the exheader extdataID.<br />
|-<br />
| 0x08360080<br />
| <br />
| DeleteSharedExtSaveData<br />
| 0x1005<br />
|-<br />
| 0x08370040<br />
| <br />
| SetCardSpiBaudRate<br />
| 0x2<br />
|-<br />
| 0x08380040<br />
| <br />
| SetCardSpiBusMode<br />
| 0x2<br />
|-<br />
| 0x08390000<br />
| <br />
| SendInitializeInfoTo9<br />
| None<br />
|-<br />
| 0x083A0100<br />
| <br />
| GetSpecialContentIndex<br />
| 0x1005<br />
|-<br />
| 0x083B00C2<br />
| <br />
| GetLegacyRomHeader<br />
| 0x1015<br />
|-<br />
| 0x083C00C2<br />
| <br />
| GetLegacyBannerData<br />
| 0x1015<br />
|-<br />
| 0x083D0100<br />
| <br />
| CheckAuthorityToAccessExtSaveData<br />
| 0x44<br />
|-<br />
| 0x083E00C2<br />
| <br />
| QueryTotalQuotaSize<br />
| None<br />
|-<br />
| 0x083F00C0<br />
| <br />
| GetExtDataBlockSize<br />
| None<br />
|-<br />
| 0x08400040<br />
| <br />
| AbnegateAccessRight<br />
| <br />
|-<br />
| 0x08410000<br />
| <br />
| DeleteSdmcRoot<br />
| 0x1005<br />
|-<br />
| 0x08420040<br />
| <br />
| DeleteAllExtSaveDataOnNand<br />
| 0x1005<br />
|-<br />
| 0x08430000<br />
| <br />
| [[FS:InitializeCtrFileSystem|InitializeCtrFileSystem]]<br />
| None<br />
|-<br />
| 0x08440000<br />
| <br />
| CreateSeed<br />
| 0x2<br />
|-<br />
| 0x084500C2<br />
| <br />
| GetFormatInfo<br />
| ?<br />
|-<br />
| 0x08460102<br />
| <br />
| GetLegacyRomHeader2<br />
| 0x1015<br />
|-<br />
| 0x08470180<br />
| <br />
| FormatCtrCardUserSaveData<br />
| 0x6<br />
|-<br />
| 0x08480042<br />
| <br />
| GetSdmcCtrRootPath<br />
| 0x100D<br />
|-<br />
| 0x08490040<br />
| <br />
| GetArchiveResource<br />
| ?<br />
|-<br />
| 0x084A0002<br />
| <br />
| ExportIntegrityVerificationSeed<br />
| 0x4000<br />
|-<br />
| 0x084B0002<br />
| <br />
| ImportIntegrityVerificationSeed<br />
| 0x4000<br />
|-<br />
| 0x084C0242<br />
| <br />
| FormatSaveData<br />
| 0x6, in some cases this right isn't needed however.<br />
|-<br />
| 0x084D0102<br />
| <br />
| GetLegacySubBannerData<br />
| 0x1015<br />
|-<br />
| 0x084E0342<br />
| <br />
| [[FS:UpdateSha256Context|UpdateSha256Context]]<br />
| 0x5<br />
|-<br />
| 0x084F0102<br />
| <br />
| ReadSpecialFile<br />
| None<br />
|-<br />
| 0x08500040<br />
| <br />
| GetSpecialFileSize<br />
| None<br />
|-<br />
| 0x08510242<br />
| [[3.0.0-5]]<br />
| ?<br />
| Shared extdata: 0x101005. Regular extdata in certain cases: 0xC.<br />
|-<br />
| 0x08520100<br />
| [[3.0.0-5]]<br />
| Unknown (u32 flags, u64 extdataID)<br />
| Shared extdata: 0x101005. Regular extdata in certain cases: 0x10100D.<br />
|-<br />
| 0x08530142<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x10100D(this doesn't apply in certain cases however)<br />
|-<br />
| 0x085400C0<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x10100D(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08550102<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x101005<br />
|-<br />
| 0x08560200<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x4(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08570080<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x1004(this doesn't apply in certain cases however)<br />
|-<br />
| 0x08580000<br />
| [[3.0.0-5]]<br />
| [[FS:GetMovableSedHashedKeyYRandomData|GetMovableSedHashedKeyYRandomData]]<br />
| 0x2004<br />
|-<br />
| 0x08590200<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x2004<br />
|-<br />
| 0x085A00C0<br />
| [[3.0.0-5]]<br />
| ? (u64 ID?,u32 unk)<br />
| None<br />
|-<br />
| 0x085B0040?<br />
| [[3.0.0-5]]<br />
| ?(u64 ID?,u32 *ret)<br />
| None<br />
|-<br />
| 0x085C00C0<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x085D0180<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x100001<br />
|-<br />
| 0x085E0040<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0xE<br />
|-<br />
| 0x085F0040<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x12004<br />
|-<br />
| 0x08600042<br />
| [[3.0.0-5]]<br />
| ?<br />
| 0x2004<br />
|-<br />
| 0x08610042<br />
| [[3.0.0-5]]<br />
| InitializeWithSdkVersion<br />
| None<br />
|-<br />
| 0x08620040<br />
| [[3.0.0-5]]<br />
| SetPriority<br />
| None<br />
|-<br />
| 0x08630000<br />
| [[3.0.0-5]]<br />
| GetPriority<br />
| None<br />
|-<br />
| 0x08640000<br />
| [[3.0.0-5]]<br />
| Stubbed, this returns an error.<br />
| None<br />
|-<br />
| 0x08650140<br />
| [[4.0.0-7]]<br />
| Unknown, this is used with [[Anti Savegame Restore]].<br />
| 0x121004(in certain cases this doesn't apply however)<br />
|-<br />
| 0x086600C0<br />
| [[4.0.0-7]]<br />
| Unknown, this is used with [[Anti Savegame Restore]].<br />
| 0x121004(in certain cases this doesn't apply however)<br />
|-<br />
| 0x086700C4<br />
| [[4.0.0-7]]<br />
| ?<br />
| 0x121004<br />
|-<br />
| 0x08680000<br />
| [[4.0.0-7]]<br />
| This loads the u8 mediatype for the current application from already initialized state, this u8 was originally loaded from the same data used by [[FS:GetProgramLaunchInfo|GetProgramLaunchInfo]]. This then writes the u8 to response-word[2]. This is used with [[Anti Savegame Restore]].<br />
| None<br />
|-<br />
| 0x08690000<br />
| [[4.0.0-7]]<br />
| Stubbed, this returns an error.<br />
| None<br />
|-<br />
| 0x086A0082<br />
| [[4.0.0-7]]<br />
| This is a wrapper for [[Filesystem_services_PXI|FSPXI]] command 0x00550082.<br />
| None<br />
|-<br />
| 0x086B00C2<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x086C00C2<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x086D0040<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x086E00C0<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x086F0040<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x087000C2<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x08710100<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x087201C0<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x087300C0<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x08740000<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x08750140<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x087600C0<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x08770100<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| 0x087800C0<br />
| ?<br />
| ?<br />
| ?<br />
|}<br />
<br />
When access rights are required for a command, at least one of the bits in the process accessinfo specified in the above table for the command must be set. Error 0xD9004676 is returned when a process attempts to use a command which it doesn't have access rights for the command. The exheader accessinfo field is all-zero for most applications. Note that the permissions listed in the above table is for system-version v2.x, therefore permission bit(s) added with newer FIRM may be missing from this.<br />
<br />
Each session for fs:USER has separate permissions, initially these are set to all-zero for new fs:USER sessions. The permissions/etc for fs:USER sessions are initialized via [[FS:Initialize]](loaded from the user process exheader).<br />
<br />
=File service=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040100C4<br />
| Control<br />
|-<br />
| 0x08010100<br />
| OpenSubFile<br />
|-<br />
| 0x080200C2<br />
| [[FSFile:Read|Read]]<br />
|-<br />
| 0x08030102<br />
| [[FSFile:Write|Write]]<br />
|-<br />
| 0x08040000<br />
| [[FSFile:GetSize|GetSize]]<br />
|-<br />
| 0x08050080<br />
| [[FSFile:SetSize|SetSize]]<br />
|-<br />
| 0x08060000<br />
| GetAttributes<br />
|-<br />
| 0x08070040<br />
| SetAttributes<br />
|-<br />
| 0x08080000<br />
| [[FSFile:Close|Close]]<br />
|-<br />
| 0x08090000<br />
| Flush<br />
|}<br />
<br />
=Directory service=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040100C4<br />
| Control<br />
|-<br />
| 0x08010042<br />
| [[FSDir:Read|Read]]<br />
|-<br />
| 0x08020000<br />
| [[FSDir:Close|Close]]<br />
|}<br />
<br />
= Filesystem service "fs:LDR" =<br />
This service is identical to fs:USER, except [[FS:OpenArchive]] archive 0x2345678E can only be accessed with fs:LDR.<br />
<br />
= ProgramRegistry service "fs:REG" =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Command Header<br />
! Description<br />
|-<br />
| 0x000100C6<br />
| Dummy1<br />
|-<br />
| 0x040103C0<br />
| Register<br />
|-<br />
| 0x04020040<br />
| Unregister<br />
|-<br />
| 0x040300C0<br />
| GetProgramInfo<br />
|-<br />
| 0x04040100<br />
| LoadProgram<br />
|-<br />
| 0x04050080<br />
| UnloadProgram<br />
|-<br />
| 0x04060080<br />
| CheckHostLoadId<br />
|}<br />
<br />
=Errors=<br />
See [[Filesystem_services_PXI]].</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=HID_Shared_Memory&diff=9410
HID Shared Memory
2014-07-27T15:48:23Z
<p>Ichfly: </p>
<hr />
<div>This page describes the format of the [[HID_Services|HID]] shared memory.<br />
<br />
The data for each of the below entries(PAD state, circle-pad, touch-screen, etc) is originally read by the HID module at different times per frame.<br />
<br />
size: 0x2b0 (FIRM 4.4)<br />
<br />
=Offset 0x0=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Relative offset<br />
! Description<br />
|-<br />
| 0x1C<br />
| [[PAD]] state. Bit set = button pressed, bit clear = button not pressed.<br />
|-<br />
| 0x28<br />
| Second PAD state entry.<br />
|-<br />
| 0x34<br />
| This stores circle-pad info: the low s16 is the X coordinate, the high s16 is the Y coordinate. The circle-pad center is ~0 for these fields. The range for these fields is approximately: -0x9C(bottom/left) - 0x9C(top/right).<br />
|-<br />
| 0x38<br />
| Third PAD state entry.<br />
|-<br />
| 0x44<br />
| Second circle-pad info entry.<br />
|-<br />
| 0x48<br />
| Fourth PAD state entry.<br />
|-<br />
| 0x54<br />
| Third circle-pad info entry.<br />
|-<br />
| 0x58<br />
| Fifth PAD state entry.<br />
|-<br />
| 0x64<br />
| Fourth circle-pad info entry.<br />
|-<br />
| 0x68<br />
| Sixth PAD state entry.<br />
|-<br />
| 0x74<br />
| Fifth circle-pad info entry.<br />
|-<br />
| 0x78<br />
| Seventh PAD state entry.<br />
|-<br />
| 0x84<br />
| Sixth circle-pad info entry.<br />
|-<br />
| 0x88<br />
| Eighth PAD state entry.<br />
|-<br />
| 0x94<br />
| Seventh circle-pad info entry.<br />
|-<br />
| 0x98<br />
| Ninth PAD state entry.<br />
|-<br />
| 0xB8<br />
| first used entry number in the touch-screen position info buffer?<br />
|}<br />
<br />
=Offset 0xC0=<br />
This 0x48-byte region stores entries for touch-screen position info. Each entry is 0x8-bytes, there's a total of 9 entries. When the touch-screen is not being touched, this region is all-zero.<br />
<br />
The last 8 entries contain the pixel coordinates, while the first entry seems to contain the raw coordinate data prior to being converted to pixel coordinates.<br />
<br />
==Entry format==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Relative offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x2<br />
| X coordinate.<br />
|-<br />
|-<br />
| 0x2<br />
| 0x2<br />
| Y coordinate.<br />
|-<br />
|-<br />
| 0x4<br />
| 0x4<br />
| This is 0x0 when this entry doesn't contain any actual data, value 0x1 indicates that this entry contains actual data.<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=HID:GetIPCHandles&diff=9409
HID:GetIPCHandles
2014-07-27T15:29:36Z
<p>Ichfly: </p>
<hr />
<div>=Request=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| Header code [0x000A0000]<br />
|}<br />
<br />
=Response=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| Header code<br />
|-<br />
| 1<br />
| Result code<br />
|-<br />
| 2<br />
| Unused<br />
|-<br />
| 3<br />
| [[HID Shared Memory|Shared]] memory handle<br />
|-<br />
| 4<br />
| event signaled by hid<br />
|-<br />
| 5<br />
| event signaled by hid<br />
|-<br />
| 6<br />
| event signaled by hid<br />
|-<br />
| 7<br />
| Gyroscope event<br />
|-<br />
| 8<br />
| event signaled by hid<br />
|}</div>
Ichfly
https://www.3dbrew.org/w/index.php?title=HID:GetIPCHandles&diff=9408
HID:GetIPCHandles
2014-07-27T15:21:02Z
<p>Ichfly: /* Response */</p>
<hr />
<div>=Request=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| Header code [0x000A0000]<br />
|}<br />
<br />
=Response=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Index Word<br />
! Description<br />
|-<br />
| 0<br />
| Header code<br />
|-<br />
| 1<br />
| Result code<br />
|-<br />
| 2<br />
| Unused<br />
|-<br />
| 3<br />
| [[HID Shared Memory|Shared]] memory handle<br />
|-<br />
| 4<br />
| event signaled by hid<br />
|-<br />
| 5<br />
| event signaled by hid<br />
|-<br />
| 6<br />
| event signaled by hid<br />
|-<br />
| 7<br />
| event signaled by user<br />
|-<br />
| 8<br />
| event signaled by hid<br />
|}</div>
Ichfly