notaz.gp2x.de
/
pcsx_rearmed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
try to support more compilers
[pcsx_rearmed.git]
/
libpcsxcore
/
new_dynarec
/
new_dynarec.c
diff --git
a/libpcsxcore/new_dynarec/new_dynarec.c
b/libpcsxcore/new_dynarec/new_dynarec.c
index
716b1d4
..
0128758
100644
(file)
--- a/
libpcsxcore/new_dynarec/new_dynarec.c
+++ b/
libpcsxcore/new_dynarec/new_dynarec.c
@@
-21,10
+21,15
@@
#include <stdlib.h>
#include <stdint.h> //include for uint64_t
#include <assert.h>
#include <stdlib.h>
#include <stdint.h> //include for uint64_t
#include <assert.h>
+#include <sys/mman.h>
#include "emu_if.h" //emulator interface
#include "emu_if.h" //emulator interface
-#include <sys/mman.h>
+//#define DISASM
+//#define assem_debug printf
+//#define inv_debug printf
+#define assem_debug(...)
+#define inv_debug(...)
#ifdef __i386__
#include "assem_x86.h"
#ifdef __i386__
#include "assem_x86.h"
@@
-265,12
+270,6
@@
int tracedebug=0;
//#define DEBUG_CYCLE_COUNT 1
//#define DEBUG_CYCLE_COUNT 1
-void nullf() {}
-//#define assem_debug printf
-//#define inv_debug printf
-#define assem_debug nullf
-#define inv_debug nullf
-
static void tlb_hacks()
{
#ifndef DISABLE_TLB
static void tlb_hacks()
{
#ifndef DISABLE_TLB
@@
-848,7
+847,7
@@
void alloc_all(struct regstat *cur,int i)
}
}
}
}
-
+#ifndef FORCE32
void div64(int64_t dividend,int64_t divisor)
{
lo=dividend/divisor;
void div64(int64_t dividend,int64_t divisor)
{
lo=dividend/divisor;
@@
-959,6
+958,7
@@
uint64_t ldr_merge(uint64_t original,uint64_t loaded,u_int bits)
else original=loaded;
return original;
}
else original=loaded;
return original;
}
+#endif
#ifdef __i386__
#include "assem_x86.c"
#ifdef __i386__
#include "assem_x86.c"
@@
-3288,6
+3288,14
@@
void store_assemble(int i,struct regstat *i_regs)
}
type=STORED_STUB;
}
}
type=STORED_STUB;
}
+#ifdef PCSX
+ if(jaddr) {
+ // PCSX store handlers don't check invcode again
+ reglist|=1<<addr;
+ add_stub(type,jaddr,(int)out,i,addr,(int)i_regs,ccadj[i],reglist);
+ jaddr=0;
+ }
+#endif
if(!using_tlb) {
if(!c||memtarget) {
#ifdef DESTRUCTIVE_SHIFT
if(!using_tlb) {
if(!c||memtarget) {
#ifdef DESTRUCTIVE_SHIFT
@@
-7779,6
+7787,7
@@
void clean_registers(int istart,int iend,int wr)
}
}
}
}
+#ifdef DISASM
/* disassembly */
void disassemble_inst(int i)
{
/* disassembly */
void disassemble_inst(int i)
{
@@
-7867,6
+7876,9
@@
void disassemble_inst(int i)
printf (" %x: %s\n",start+i*4,insn[i]);
}
}
printf (" %x: %s\n",start+i*4,insn[i]);
}
}
+#else
+static void disassemble_inst(int i) {}
+#endif // DISASM
// clear the state completely, instead of just marking
// things invalid like invalidate_all_pages() does
// clear the state completely, instead of just marking
// things invalid like invalidate_all_pages() does
@@
-8601,7
+8613,7
@@
int new_recompile_block(int addr)
case 0x04: gte_rt[i]=1ll<<gr; break; // MTC2
case 0x02: gte_rs[i]=1ll<<(gr+32); // CFC2
if(gr==31&&!gte_reads_flags) {
case 0x04: gte_rt[i]=1ll<<gr; break; // MTC2
case 0x02: gte_rs[i]=1ll<<(gr+32); // CFC2
if(gr==31&&!gte_reads_flags) {
-
printf
("gte flag read encountered @%08x\n",addr + i*4);
+
assem_debug
("gte flag read encountered @%08x\n",addr + i*4);
gte_reads_flags=1;
}
break;
gte_reads_flags=1;
}
break;
@@
-10886,9
+10898,9
@@
int new_recompile_block(int addr)
if(itype[slen-1]==SPAN) {
bt[slen-1]=1; // Mark as a branch target so instruction can restart after exception
}
if(itype[slen-1]==SPAN) {
bt[slen-1]=1; // Mark as a branch target so instruction can restart after exception
}
-
+
+#ifdef DISASM
/* Debug/disassembly */
/* Debug/disassembly */
- if((void*)assem_debug==(void*)printf)
for(i=0;i<slen;i++)
{
printf("U:");
for(i=0;i<slen;i++)
{
printf("U:");
@@
-11104,6
+11116,7
@@
int new_recompile_block(int addr)
#endif
}
}
#endif
}
}
+#endif // DISASM
/* Pass 8 - Assembly */
linkcount=0;stubcount=0;
/* Pass 8 - Assembly */
linkcount=0;stubcount=0;
@@
-11136,7
+11149,7
@@
int new_recompile_block(int addr)
for(i=0;i<slen;i++)
{
//if(ds) printf("ds: ");
for(i=0;i<slen;i++)
{
//if(ds) printf("ds: ");
-
if((void*)assem_debug==(void*)printf)
disassemble_inst(i);
+ disassemble_inst(i);
if(ds) {
ds=0; // Skip delay slot
if(bt[i]) assem_debug("OOPS - branch into delay slot\n");
if(ds) {
ds=0; // Skip delay slot
if(bt[i]) assem_debug("OOPS - branch into delay slot\n");
@@
-11456,10
+11469,12
@@
int new_recompile_block(int addr)
}
inv_code_start=inv_code_end=~0;
#ifdef PCSX
}
inv_code_start=inv_code_end=~0;
#ifdef PCSX
- //
PCSX maps all RAM mirror invalid_code tests to 0x80000000..0x80000000+RAM_SIZE
+ //
for PCSX we need to mark all mirrors too
if(get_page(start)<(RAM_SIZE>>12))
for(i=start>>12;i<=(start+slen*4)>>12;i++)
if(get_page(start)<(RAM_SIZE>>12))
for(i=start>>12;i<=(start+slen*4)>>12;i++)
- invalid_code[((u_int)0x80000000>>12)|i]=0;
+ invalid_code[((u_int)0x00000000>>12)|(i&0x1ff)]=
+ invalid_code[((u_int)0x80000000>>12)|(i&0x1ff)]=
+ invalid_code[((u_int)0xa0000000>>12)|(i&0x1ff)]=0;
#endif
/* Pass 10 - Free memory by expiring oldest blocks */
#endif
/* Pass 10 - Free memory by expiring oldest blocks */