Browse code

Updated to latest DeSmuME SVN.

Naram Qashat authored on 2013/04/19 13:01:50
Showing 2 changed files
... ...
@@ -50,9 +50,28 @@ using namespace AsmJit;
50 50
 #if LOG_JIT_LEVEL > 0
51 51
 #define LOG_JIT 1
52 52
 #define JIT_COMMENT(...) c.comment(__VA_ARGS__)
53
+#define printJIT(buf, val) \
54
+{ \
55
+	JIT_COMMENT("printJIT(\""##buf"\", val);"); \
56
+	GpVar txt = c.newGpVar(kX86VarTypeGpz); \
57
+	GpVar data = c.newGpVar(kX86VarTypeGpz); \
58
+	GpVar io = c.newGpVar(kX86VarTypeGpd); \
59
+	c.lea(io, dword_ptr_abs(stdout)); \
60
+	c.lea(txt, dword_ptr_abs(&buf)); \
61
+	c.mov(data, *reinterpret_cast<GpVar *>(&val)); \
62
+	X86CompilerFuncCall* prn = c.call(reinterpret_cast<uintptr_t>(fprintf)); \
63
+	prn->setPrototype(ASMJIT_CALL_CONV, FuncBuilder3<void, void *, void *, uint32_t>()); \
64
+	prn->setArgument(0, io); \
65
+	prn->setArgument(1, txt); \
66
+	prn->setArgument(2, data); \
67
+	X86CompilerFuncCall *prn_flush = c.call(reinterpret_cast<uintptr_t>(fflush)); \
68
+	prn_flush->setPrototype(ASMJIT_CALL_CONV, FuncBuilder1<void, void *>()); \
69
+	prn_flush->setArgument(0, io); \
70
+}
53 71
 #else
54 72
 #define LOG_JIT 0
55 73
 #define JIT_COMMENT(...)
74
+#define printJIT(buf, val)
56 75
 #endif
57 76
 
58 77
 #ifdef MAPPED_JIT_FUNCS
... ...
@@ -1392,6 +1411,7 @@ static int OP_MRS_SPSR(uint32_t i)
1392 1411
 #define OP_MSR_(reg, args, sw) \
1393 1412
 	GpVar operand = c.newGpVar(kX86VarTypeGpd); \
1394 1413
 	args; \
1414
+	c.mov(operand, rhs); \
1395 1415
 	switch ((i >> 16) & 0xF) \
1396 1416
 	{ \
1397 1417
 		case 0x1: /* bit 16 */ \
... ...
@@ -1411,7 +1431,6 @@ static int OP_MRS_SPSR(uint32_t i)
1411 1431
 				ctx->setArgument(0, bb_cpu); \
1412 1432
 				ctx->setArgument(1, mode); \
1413 1433
 			} \
1414
-			c.mov(operand, rhs); \
1415 1434
 			Mem xPSR_memB = cpu_ptr_byte(reg, 0); \
1416 1435
 			c.mov(xPSR_memB, operand.r8Lo()); \
1417 1436
 			changeCPSR; \
... ...
@@ -1426,7 +1445,6 @@ static int OP_MRS_SPSR(uint32_t i)
1426 1445
 			c.and_(mode, 0x1F); \
1427 1446
 			c.cmp(mode, USR); \
1428 1447
 			c.je(__skip); \
1429
-			c.mov(operand, rhs); \
1430 1448
 			Mem xPSR_memB = cpu_ptr_byte(reg, 1); \
1431 1449
 			c.shr(operand, 8); \
1432 1450
 			c.mov(xPSR_memB, operand.r8Lo()); \
... ...
@@ -1442,7 +1460,6 @@ static int OP_MRS_SPSR(uint32_t i)
1442 1460
 			c.and_(mode, 0x1F); \
1443 1461
 			c.cmp(mode, USR); \
1444 1462
 			c.je(__skip); \
1445
-			c.mov(operand, rhs); \
1446 1463
 			Mem xPSR_memB = cpu_ptr_byte(reg, 2); \
1447 1464
 			c.shr(operand, 16); \
1448 1465
 			c.mov(xPSR_memB, operand.r8Lo()); \
... ...
@@ -1452,7 +1469,6 @@ static int OP_MRS_SPSR(uint32_t i)
1452 1469
 		} \
1453 1470
 		case 0x8: /* bit 19 */ \
1454 1471
 		{ \
1455
-			c.mov(operand, rhs); \
1456 1472
 			Mem xPSR_memB = cpu_ptr_byte(reg, 3); \
1457 1473
 			c.shr(operand, 24); \
1458 1474
 			c.mov(xPSR_memB, operand.r8Lo()); \
... ...
@@ -1485,7 +1501,6 @@ static int OP_MRS_SPSR(uint32_t i)
1485 1501
 		ctx->setArgument(1, mode); \
1486 1502
 	} \
1487 1503
 	/* cpu->CPSR.val = (cpu->CPSR.val & ~byte_mask) | (operand & byte_mask); */ \
1488
-	c.mov(operand, rhs); \
1489 1504
 	c.mov(xPSR, xPSR_mem); \
1490 1505
 	c.and_(operand, byte_mask); \
1491 1506
 	c.and_(xPSR, ~byte_mask); \
... ...
@@ -1494,7 +1509,6 @@ static int OP_MRS_SPSR(uint32_t i)
1494 1509
 	c.jmp(__done); \
1495 1510
 	/* mode == USR */ \
1496 1511
 	c.bind(__USR); \
1497
-	c.mov(operand, rhs); \
1498 1512
 	c.mov(xPSR, xPSR_mem); \
1499 1513
 	c.and_(operand, byte_mask_USR); \
1500 1514
 	c.and_(xPSR, ~byte_mask_USR); \
... ...
@@ -4199,10 +4213,10 @@ void arm_jit_reset(bool enable)
4199 4213
 	scratchptr = scratchpad;
4200 4214
 #endif
4201 4215
 	printf("CPU mode: %s\n", enable ? "JIT" : "Interpreter");
4202
-	printf("JIT max block size %d instruction(s)\n", CommonSettings.jit_max_block_size);
4203 4216
 
4204 4217
 	if (enable)
4205 4218
 	{
4219
+		printf("JIT max block size %d instruction(s)\n", CommonSettings.jit_max_block_size);
4206 4220
 #ifdef MAPPED_JIT_FUNCS
4207 4221
 		// these pointers are allocated by asmjit and need freeing
4208 4222
 		#define JITFREE(x)  for (size_t iii = 0; iii < ARRAY_SIZE((x)); ++iii) if ((x)[iii]) AsmJit::MemoryManager::getGlobal()->free(reinterpret_cast<void *>((x)[iii])); memset((x), 0, sizeof((x)));
... ...
@@ -58,7 +58,7 @@
58 58
 # define DESMUME_CPUEXT_STRING ""
59 59
 #endif
60 60
 
61
-#define DESMUME_SUBVERSION_STRING " svn 4605"
61
+#define DESMUME_SUBVERSION_STRING " svn 4608"
62 62
 
63 63
 #ifdef __INTEL_COMPILER
64 64
 # define DESMUME_COMPILER " (Intel)"