diff options
author | Twinaphex | 2016-08-08 15:54:35 +0200 |
---|---|---|
committer | GitHub | 2016-08-08 15:54:35 +0200 |
commit | a1254324c72040dba3b26912b45da21fcf3ec107 (patch) | |
tree | d886a4fbd91cfafd5b8a4502742693912189f07e | |
parent | beeee745ab0961a246f3413f3fbd7d65ad75c4ba (diff) | |
parent | 177abe6a22c1ad95305587256b6c39baf9a25168 (diff) | |
download | picogpsp-a1254324c72040dba3b26912b45da21fcf3ec107.tar.gz picogpsp-a1254324c72040dba3b26912b45da21fcf3ec107.tar.bz2 picogpsp-a1254324c72040dba3b26912b45da21fcf3ec107.zip |
Merge pull request #27 from frangarcj/master
(VITA) Continue WIP - Fix Block for VM alignment
-rw-r--r-- | libretro.c | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -12,6 +12,13 @@ #if defined(VITA) #include <psp2/kernel/sysmem.h> static int translation_caches_inited = 0; +static inline int align(int x, int n) { + return (((x >> n) + 1) << n ); +} + +#define FOUR_KB_ALIGN(x) align(x, 12) +#define MB_ALIGN(x) align(x, 20) + #endif #if defined(_3DS) @@ -156,20 +163,26 @@ void retro_init(void) if(!translation_caches_inited){ void* currentHandle; - sceBlock = sceKernelAllocMemBlockForVM("code", ROM_TRANSLATION_CACHE_SIZE + + sceBlock = sceKernelAllocMemBlockForVM("code", MB_ALIGN(FOUR_KB_ALIGN(ROM_TRANSLATION_CACHE_SIZE + RAM_TRANSLATION_CACHE_SIZE + - BIOS_TRANSLATION_CACHE_SIZE); + BIOS_TRANSLATION_CACHE_SIZE))); + FILE * fd = fopen("ux0:/temp/test.txt","w+"); + fprintf(fd,"%x\n",sceBlock); if (sceBlock < 0) { - return sceBlock; + return; } // get base address int ret = sceKernelGetMemBlockBase(sceBlock, ¤tHandle); if (ret < 0) { - return ret; + return; } + fprintf(fd,"%x %x\n",currentHandle,ret); + + fclose(fd); + rom_translation_cache = (u8*)currentHandle; ram_translation_cache = rom_translation_cache + ROM_TRANSLATION_CACHE_SIZE; bios_translation_cache = ram_translation_cache + RAM_TRANSLATION_CACHE_SIZE; |