From 1a967c42d7b1e1b2ba673550ba5144c1cf638340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Sun, 2 Oct 2016 14:03:15 +0200 Subject: [PATCH] (VITA) Remove warnings --- bootstrap/vita/sbrk.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/bootstrap/vita/sbrk.c b/bootstrap/vita/sbrk.c index e960060b66..a36d56cfd7 100644 --- a/bootstrap/vita/sbrk.c +++ b/bootstrap/vita/sbrk.c @@ -1,6 +1,6 @@ #include #include - +#include "../../defines/psp_defines.h" static int _newlib_heap_memblock; static unsigned _newlib_heap_size; static char *_newlib_heap_base, *_newlib_heap_end, *_newlib_heap_cur; @@ -11,19 +11,19 @@ static int _newlib_vm_memblock; extern int _newlib_vm_size_user __attribute__((weak)); void * _sbrk_r(struct _reent *reent, ptrdiff_t incr) { - if (sceKernelLockLwMutex(_newlib_sbrk_mutex, 1, 0) < 0) + if (sceKernelLockLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex, 1, 0) < 0) goto fail; if (!_newlib_heap_base || _newlib_heap_cur + incr >= _newlib_heap_end) { - sceKernelUnlockLwMutex(_newlib_sbrk_mutex, 1); + sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex, 1); fail: reent->_errno = ENOMEM; - return -1; + return (void*)-1; } char *prev_heap_end = _newlib_heap_cur; _newlib_heap_cur += incr; - sceKernelUnlockLwMutex(_newlib_sbrk_mutex, 1); + sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex, 1); return (void*) prev_heap_end; } @@ -35,7 +35,7 @@ void _init_vita_heap(void) { _newlib_vm_memblock = sceKernelAllocMemBlockForVM("code", _newlib_vm_size_user); if (_newlib_vm_memblock < 0){ - sceClibPrintf("sceKernelAllocMemBlockForVM failed\n"); + //sceClibPrintf("sceKernelAllocMemBlockForVM failed\n"); goto failure; } }else{ @@ -44,15 +44,11 @@ void _init_vita_heap(void) { // Create a mutex to use inside _sbrk_r - if (sceKernelCreateLwMutex(_newlib_sbrk_mutex, "sbrk mutex", 0, 0, 0) < 0) { + if (sceKernelCreateLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex, "sbrk mutex", 0, 0, 0) < 0) { goto failure; } - if (&_newlib_heap_size_user != NULL) { - _newlib_heap_size = _newlib_heap_size_user; - } else { - // Create a memblock for the heap memory, 32MB - _newlib_heap_size = 32 * 1024 * 1024; - } + + _newlib_heap_size = _newlib_heap_size_user; _newlib_heap_size -= _newlib_vm_size; @@ -60,7 +56,7 @@ void _init_vita_heap(void) { if (_newlib_heap_memblock < 0) { goto failure; } - if (sceKernelGetMemBlockBase(_newlib_heap_memblock, &_newlib_heap_base) < 0) { + if (sceKernelGetMemBlockBase(_newlib_heap_memblock, (void**)&_newlib_heap_base) < 0) { goto failure; } _newlib_heap_end = _newlib_heap_base + _newlib_heap_size; @@ -81,7 +77,7 @@ int getVMBlock(){ void _free_vita_heap(void) { // Destroy the sbrk mutex - sceKernelDeleteLwMutex(_newlib_sbrk_mutex); + sceKernelDeleteLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex); // Free the heap memblock to avoid memory leakage. sceKernelFreeMemBlock(_newlib_heap_memblock);