summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-06-23 12:40:32 -0700
committerGravatar Yuri Kunde Schlesner2015-06-23 12:40:32 -0700
commit76dfafc906ffd2094464703ae706dac778734d43 (patch)
tree8976d65e22f4ad7ca2319b20a5e9c6223c3b1eef /src/core/hle/kernel
parentDisplay line numbers in CI whitespace check (diff)
parentAdd helpers to create IPC command buffer headers and descriptors (diff)
downloadyuzu-76dfafc906ffd2094464703ae706dac778734d43.tar.gz
yuzu-76dfafc906ffd2094464703ae706dac778734d43.tar.xz
yuzu-76dfafc906ffd2094464703ae706dac778734d43.zip
Merge pull request #877 from yuriks/ipc-headers
Add helpers to create IPC command buffer headers and descriptors
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/session.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/core/hle/kernel/session.h b/src/core/hle/kernel/session.h
index 54a062971..257da9105 100644
--- a/src/core/hle/kernel/session.h
+++ b/src/core/hle/kernel/session.h
@@ -8,6 +8,40 @@
8#include "core/hle/kernel/thread.h" 8#include "core/hle/kernel/thread.h"
9#include "core/memory.h" 9#include "core/memory.h"
10 10
11namespace IPC {
12
13inline u32 MakeHeader(u16 command_id, unsigned int regular_params, unsigned int translate_params) {
14 return ((u32)command_id << 16) | (((u32)regular_params & 0x3F) << 6) | (((u32)translate_params & 0x3F) << 0);
15}
16
17inline u32 MoveHandleDesc(unsigned int num_handles = 1) {
18 return 0x0 | ((num_handles - 1) << 26);
19}
20
21inline u32 CopyHandleDesc(unsigned int num_handles = 1) {
22 return 0x10 | ((num_handles - 1) << 26);
23}
24
25inline u32 CallingPidDesc() {
26 return 0x20;
27}
28
29inline u32 StaticBufferDesc(u32 size, unsigned int buffer_id) {
30 return 0x2 | (size << 14) | ((buffer_id & 0xF) << 10);
31}
32
33enum MappedBufferPermissions {
34 R = 2,
35 W = 4,
36 RW = R | W,
37};
38
39inline u32 MappedBufferDesc(u32 size, MappedBufferPermissions perms) {
40 return 0x8 | (size << 4) | (u32)perms;
41}
42
43}
44
11namespace Kernel { 45namespace Kernel {
12 46
13static const int kCommandHeaderOffset = 0x80; ///< Offset into command buffer of header 47static const int kCommandHeaderOffset = 0x80; ///< Offset into command buffer of header