Linux: GameMP inUse arrays had invalid address mappings
authorArnie Reynoso <arnier@ti.com>
Wed, 13 Aug 2014 18:14:22 +0000 (11:14 -0700)
committerRobert Tivy <rtivy@ti.com>
Thu, 14 Aug 2014 00:43:20 +0000 (17:43 -0700)
The GameMP address for the inUse arrays were being assigned incorrectly.
A page alignment was originally needed to properly map the arrays in
user space. After mapping, the alignment difference wasn't being taken
into consideration.

linux/src/daemon/GateMP_daemon.c

index 306a7553408cdcce229e9a5eabb1af614658ecab..afb1bbd52688c333964efb1caaede7380c58b5c6 100644 (file)
@@ -132,6 +132,7 @@ Int GateMP_setup(Void)
     UInt32            nsValue[NUM_INFO_FIELDS];
     UInt32            len;
     UInt32            size;
+    UInt32            alignDiff;
     Int32             fdMem;
 
     NameServer_Params_init(&params);
@@ -199,6 +200,12 @@ Int GateMP_setup(Void)
                  LOG1("Failed to map remoteSystemInUse=0x%p to host address" \
                       "  space!", GateMP_module->remoteSystemInUse);
             }
+            else {
+                alignDiff = (off_t)nsValue[0] -
+                    ((off_t)nsValue[0] & ~(sysconf(_SC_PAGE_SIZE) - 1));
+                GateMP_module->remoteSystemInUse =
+                    GateMP_module->remoteSystemInUse + alignDiff;
+            }
 
             size = GateMP_module->numRemoteCustom1 * sizeof (UInt8) +
                 (nsValue[0] & (sysconf(_SC_PAGE_SIZE) - 1));
@@ -213,6 +220,12 @@ Int GateMP_setup(Void)
                     LOG1("Failed to map remoteCustom1InUse=%p to host address" \
                         " space!", GateMP_module->remoteCustom1InUse);
                 }
+                else {
+                    alignDiff = (off_t)nsValue[1] -
+                        ((off_t)nsValue[1] & ~(sysconf(_SC_PAGE_SIZE) - 1));
+                    GateMP_module->remoteCustom1InUse =
+                        GateMP_module->remoteCustom1InUse + alignDiff;
+                }
             }
 
             size = GateMP_module->numRemoteCustom2 * sizeof (UInt8) +
@@ -228,6 +241,12 @@ Int GateMP_setup(Void)
                     LOG1("Failed to map remoteCustom2InUse=%p to host address" \
                         " space!", GateMP_module->remoteCustom2InUse);
                 }
+                else {
+                    alignDiff = (off_t)nsValue[2] -
+                        ((off_t)nsValue[2] & ~(sysconf(_SC_PAGE_SIZE) - 1));
+                    GateMP_module->remoteCustom2InUse =
+                        GateMP_module->remoteCustom2InUse + alignDiff;
+                }
             }
         }
     }