]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/netapi.git/commitdiff
Fixes for the following IRS:
authorTinku Mannan <tmannan@ti.com>
Tue, 16 Apr 2013 16:55:42 +0000 (12:55 -0400)
committerTinku Mannan <tmannan@ti.com>
Tue, 16 Apr 2013 17:22:33 +0000 (13:22 -0400)
SDOCM00100482: HPLIB: hplib_VM_MemMap doesn't seem to be mapping memory properly
SDOCM00100481: Function hplib_vmMemAlloc: Critical section lock not being released
Added license file, COPYING.txt

COPYING.txt [new file with mode: 0755]
ti/runtime/hplib/src/hplib_vm.c

diff --git a/COPYING.txt b/COPYING.txt
new file mode 100755 (executable)
index 0000000..edec646
--- /dev/null
@@ -0,0 +1,32 @@
+/*  ===========================================================================\r
+ *  Copyright (c) Texas Instruments Incorporated 2010-2013\r
+ * \r
+ *  Redistribution and use in source and binary forms, with or without \r
+ *  modification, are permitted provided that the following conditions \r
+ *  are met:\r
+ *\r
+ *    Redistributions of source code must retain the above copyright \r
+ *    notice, this list of conditions and the following disclaimer.\r
+ *\r
+ *    Redistributions in binary form must reproduce the above copyright\r
+ *    notice, this list of conditions and the following disclaimer in the \r
+ *    documentation and/or other materials provided with the   \r
+ *    distribution.\r
+ *\r
+ *    Neither the name of Texas Instruments Incorporated nor the names of\r
+ *    its contributors may be used to endorse or promote products derived\r
+ *    from this software without specific prior written permission.\r
+ *\r
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \r
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT \r
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT \r
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, \r
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \r
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE \r
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+*/\r
index 69224c3bcb4c7fdaf98a1d62700c920d0df62cbd..39a98e46d56c6f8163ac12ab540fed468a340b53 100755 (executable)
@@ -106,7 +106,7 @@ void *hplib_VM_MemMap
     retval = sysconf(_SC_PAGE_SIZE);
     if (retval == -1)
     {
-        hplib_Log(">hplib_VM_MemMap: Failed to get page size err=%s\n",
+        hplib_Log("hplib_VM_MemMap: Failed to get page size err=%s\n",
                strerror(errno));
         return (void *)0;
     }
@@ -115,24 +115,24 @@ void *hplib_VM_MemMap
 
     if (size%page_sz)
     {
-        hplib_Log(">hplib_VM_MemMap: error: block size not aligned to page size\n");
+        hplib_Log("hplib_VM_MemMap: error: block size not aligned to page size\n");
         return (void *)0;
     }
 
     if ((uint32_t)addr%page_sz)
     {
-        hplib_Log(">hplib_VM_MemMap: error: addr not aligned to page size\n");
+        hplib_Log("hplib_VM_MemMap: error: addr not aligned to page size\n");
         return (void *)0;
     }
 
-    map_base = mmap(0, size, (PROT_READ|PROT_WRITE), MAP_SHARED, dev_mem_fd, (off_t)addr & ~mask);
+    map_base = mmap(0, size, (PROT_READ|PROT_WRITE), MAP_SHARED, dev_mem_fd, (off_t)addr);
     if(map_base == (void *) -1) 
     {
-        hplib_Log(">hplib_VM_MemMap: Failed to mmap \"dev/mem\" err=%s\n",
+        hplib_Log("hplib_VM_MemMap: Failed to mmap \"dev/mem\" err=%s\n",
                strerror(errno));
         return (void *)0;
     }
-    virt_addr = map_base + ((off_t)addr & mask);
+    virt_addr = map_base;
 
     return(virt_addr);
 }
@@ -255,9 +255,8 @@ void* hplib_vmMemAlloc
         memset (p_block, 0, size);
         return p_block;
     }
-    return p_block;
-
     Osal_hplibCsExit(key);
+    return p_block;
 }