瀏覽代碼

correct placement and add size check

greggameplayer 8 年之前
父節點
當前提交
8c648b59cd
共有 1 個文件被更改,包括 25 次插入21 次删除
  1. 25 21
      src/core/hle/service/nvdrv/devices/nvmap.h

+ 25 - 21
src/core/hle/service/nvdrv/devices/nvmap.h

@@ -59,17 +59,25 @@ private:
         Create = 0xC0080101,
         Create = 0xC0080101,
         FromId = 0xC0080103,
         FromId = 0xC0080103,
         Alloc = 0xC0200104,
         Alloc = 0xC0200104,
+        Free = 0xC0180105,
         Param = 0xC00C0109,
         Param = 0xC00C0109,
         GetId = 0xC008010E,
         GetId = 0xC008010E,
-        Free = 0xC0180105,
     };
     };
-
     struct IocCreateParams {
     struct IocCreateParams {
         // Input
         // Input
         u32_le size;
         u32_le size;
         // Output
         // Output
         u32_le handle;
         u32_le handle;
     };
     };
+    static_assert(sizeof(IocCreateParams) == 8, "IocCreateParams has wrong size");
+
+    struct IocFromIdParams {
+        // Input
+        u32_le id;
+        // Output
+        u32_le handle;
+    };
+    static_assert(sizeof(IocFromIdParams) == 8, "IocFromIdParams has wrong size");
 
 
     struct IocAllocParams {
     struct IocAllocParams {
         // Input
         // Input
@@ -81,37 +89,33 @@ private:
         INSERT_PADDING_BYTES(7);
         INSERT_PADDING_BYTES(7);
         u64_le addr;
         u64_le addr;
     };
     };
+    static_assert(sizeof(IocAllocParams) == 32, "IocAllocParams has wrong size");
 
 
-    struct IocGetIdParams {
-        // Output
-        u32_le id;
-        // Input
-        u32_le handle;
-    };
-
-    struct IocFromIdParams {
-        // Input
-        u32_le id;
-        // Output
+    struct IocFreeParams {
         u32_le handle;
         u32_le handle;
+        INSERT_PADDING_BYTES(4);
+        u64_le refcount;
+        u32_le size;
+        u32_le flags;
     };
     };
+    static_assert(sizeof(IocFreeParams) == 24, "IocFreeParams has wrong size");
 
 
     struct IocParamParams {
     struct IocParamParams {
         // Input
         // Input
         u32_le handle;
         u32_le handle;
-        u32_le type;
+        u32_le param;
         // Output
         // Output
-        u32_le value;
+        u32_le result;
     };
     };
+    static_assert(sizeof(IocParamParams) == 12, "IocParamParams has wrong size");
 
 
-    struct IocFreeParams {
+    struct IocGetIdParams {
+        // Output
+        u32_le id;
+        // Input
         u32_le handle;
         u32_le handle;
-        INSERT_PADDING_BYTES(4);
-        u64_le refcount;
-        u32_le size;
-        u32_le flags;
     };
     };
-    static_assert(sizeof(IocFreeParams) == 24, "IocFreeParams has wrong size");
+    static_assert(sizeof(IocGetIdParams) == 8, "IocGetIdParams has wrong size");
 
 
     u32 IocCreate(const std::vector<u8>& input, std::vector<u8>& output);
     u32 IocCreate(const std::vector<u8>& input, std::vector<u8>& output);
     u32 IocAlloc(const std::vector<u8>& input, std::vector<u8>& output);
     u32 IocAlloc(const std::vector<u8>& input, std::vector<u8>& output);