IPC: Difference between revisions

Neobrain (talk | contribs)
What a mess. Let's try to clean it up a bit.
Line 79: Line 79:
|-
|-
| 1-3
| 1-3
| type
| Translation type
|}
|}


Line 86: Line 86:
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.  
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.  


Type 0 is used to send handles across processes. The corresponding translation descriptor looks as follows:
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, and 2 are ignored. Types 5, 6, and 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.
 
== Handle Translation ==
 
Translation type 0 is used to send handles across processes. The corresponding translation descriptor has the following structure:
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 102: Line 106:
|}
|}


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, and 2 are ignored. Types 5, 6, and 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.
Usage examples:
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
!  Type
! scope="col" width="300" |  Usual form
! scope="col" width="300" |  Usual form
!  Description
!  Description
|-
|-
| 0
| 0x00000000 <nowiki>|</nowiki> ((num_handles-1)<<26)
| 0x00000000 <nowiki>|</nowiki> ((num_handles-1)<<26)


Line 119: Line 120:
| Copies the given KHandles to the receiving process, i.e. creating new handles in the target process while keeping around the ones of the source process. When a handle value is 0x0, value 0x0 is written to the destination cmdbuf without doing any actual handle-transfer.
| Copies the given KHandles to the receiving process, i.e. creating new handles in the target process while keeping around the ones of the source process. When a handle value is 0x0, value 0x0 is written to the destination cmdbuf without doing any actual handle-transfer.
|-
|-
| 0
| 0x00000010 <nowiki>|</nowiki> ((num_handles-1)<<26)
| 0x00000010 <nowiki>|</nowiki> ((num_handles-1)<<26)


Line 128: Line 128:
| Moves the given KHandles to the receiving process, i.e. creating new handles in the target process and closing the ones of the source process. When a handle value is 0x0, value 0x0 is written to the destination cmdbuf without doing any actual handle-transfer.
| Moves the given KHandles to the receiving process, i.e. creating new handles in the target process and closing the ones of the source process. When a handle value is 0x0, value 0x0 is written to the destination cmdbuf without doing any actual handle-transfer.
|-
|-
| 0
| 0x00000020
| 0x00000020
<placeholder>
<placeholder>
| Let kernel set value to calling process ProcessID.
| Let kernel set value to calling process ProcessID.
|}
== Usage Examples for other Translation Types ==
{| class="wikitable" border="1"
|-
!  Type
! scope="col" width="300" |  Usual form
!  Description
|-
|-
| 1
| 1