mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-10-27 00:29:39 -04:00
drc related bugfixes
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@822 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
65c75cb07d
commit
7f5a3fc12a
3 changed files with 10 additions and 7 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#if defined(__linux__) && defined(ARM)
|
#ifdef __linux__
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -10,19 +10,17 @@ u8 __attribute__((aligned(4096))) tcache[DRC_TCACHE_SIZE];
|
||||||
|
|
||||||
void drc_cmn_init(void)
|
void drc_cmn_init(void)
|
||||||
{
|
{
|
||||||
#if defined(__linux__) && defined(ARM)
|
#ifdef __linux__
|
||||||
void *tmp;
|
void *tmp;
|
||||||
|
|
||||||
tmp = mmap(tcache, DRC_TCACHE_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
|
tmp = mmap(tcache, DRC_TCACHE_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
|
||||||
printf("mmap tcache: %p, asked %p\n", tmp, tcache);
|
printf("mmap tcache: %p, asked %p\n", tmp, tcache);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add calls in core, possibly to cart.c?
|
|
||||||
void drc_cmn_cleanup(void)
|
void drc_cmn_cleanup(void)
|
||||||
{
|
{
|
||||||
#if defined(__linux__) && defined(ARM)
|
#ifdef __linux__
|
||||||
int ret;
|
int ret;
|
||||||
ret = munmap(tcache, DRC_TCACHE_SIZE);
|
ret = munmap(tcache, DRC_TCACHE_SIZE);
|
||||||
printf("munmap tcache: %i\n", ret);
|
printf("munmap tcache: %i\n", ret);
|
||||||
|
|
|
||||||
|
|
@ -189,10 +189,10 @@ static void emith_op_imm(int cond, int op, int r, unsigned int imm)
|
||||||
EOP_C_DOP_IMM(cond, op, 0, r, r, (ror2 - 8/2) & 0x0f, v & 0xff);
|
EOP_C_DOP_IMM(cond, op, 0, r, r, (ror2 - 8/2) & 0x0f, v & 0xff);
|
||||||
v >>= 8;
|
v >>= 8;
|
||||||
if (v & 0xff)
|
if (v & 0xff)
|
||||||
EOP_C_DOP_IMM(cond, op, 0, r, r, (ror2 - 8/2) & 0x0f, v & 0xff);
|
EOP_C_DOP_IMM(cond, op, 0, r, r, (ror2 - 16/2) & 0x0f, v & 0xff);
|
||||||
v >>= 8;
|
v >>= 8;
|
||||||
if (v & 0xff)
|
if (v & 0xff)
|
||||||
EOP_C_DOP_IMM(cond, op, 0, r, r, (ror2 - 8/2) & 0x0f, v & 0xff);
|
EOP_C_DOP_IMM(cond, op, 0, r, r, (ror2 - 24/2) & 0x0f, v & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define is_offset_24(val) \
|
#define is_offset_24(val) \
|
||||||
|
|
|
||||||
|
|
@ -641,6 +641,9 @@ int sh2_drc_init(SH2 *sh2)
|
||||||
{
|
{
|
||||||
if (block_tables[0] == NULL) {
|
if (block_tables[0] == NULL) {
|
||||||
int i, cnt;
|
int i, cnt;
|
||||||
|
|
||||||
|
drc_cmn_init();
|
||||||
|
|
||||||
cnt = block_max_counts[0] + block_max_counts[1] + block_max_counts[2];
|
cnt = block_max_counts[0] + block_max_counts[1] + block_max_counts[2];
|
||||||
block_tables[0] = calloc(cnt, sizeof(*block_tables[0]));
|
block_tables[0] = calloc(cnt, sizeof(*block_tables[0]));
|
||||||
if (block_tables[0] == NULL)
|
if (block_tables[0] == NULL)
|
||||||
|
|
@ -680,6 +683,8 @@ void sh2_drc_finish(SH2 *sh2)
|
||||||
#endif
|
#endif
|
||||||
free(block_tables[0]);
|
free(block_tables[0]);
|
||||||
memset(block_tables, 0, sizeof(block_tables));
|
memset(block_tables, 0, sizeof(block_tables));
|
||||||
|
|
||||||
|
drc_cmn_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hash_table != NULL) {
|
if (hash_table != NULL) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue