summaryrefslogtreecommitdiff
path: root/psp
diff options
context:
space:
mode:
authorDavid Guillen Fandos2021-03-23 19:47:51 +0100
committerDavid Guillen Fandos2021-03-23 20:02:44 +0100
commitff510e7f7a0c04c7862e598e8bfc75747f3bf7d1 (patch)
tree11399685ea3766006b09d33f983cfae5b98c4f20 /psp
parent11ec213c99d5d22905ff82cf3fb26ba6a8adf290 (diff)
downloadpicogpsp-ff510e7f7a0c04c7862e598e8bfc75747f3bf7d1.tar.gz
picogpsp-ff510e7f7a0c04c7862e598e8bfc75747f3bf7d1.tar.bz2
picogpsp-ff510e7f7a0c04c7862e598e8bfc75747f3bf7d1.zip
Move caches to stub files to get around gcc 10
Seems that using the __atribute__ magic for sections is not the best way of doing this, since it injects some default atributtes that collide with the user defined ones. Using assembly is far easier in this case. Reworked definitions a bit to make it easier to import from assembly. Also wrapped stuff around macros for easy and less verbose implementation of the symbol prefix issue.
Diffstat (limited to 'psp')
-rw-r--r--psp/mips_emit.h9
-rw-r--r--psp/mips_stub.S21
2 files changed, 23 insertions, 7 deletions
diff --git a/psp/mips_emit.h b/psp/mips_emit.h
index b75f7f5..b996f2b 100644
--- a/psp/mips_emit.h
+++ b/psp/mips_emit.h
@@ -2618,11 +2618,7 @@ static void emit_mem_access_loadop(
#define genccall(fn) mips_emit_jal(((u32)fn) >> 2);
#endif
-// Stub memory map:
-// 0 .. 63 First patch handler [#0]
-// 448 .. 511 Last patch handler [#7]
-// 512+ smc_write handler
-#define SMC_WRITE_OFF32 160
+#define SMC_WRITE_OFF32 (10*16) /* 10 handlers (16 insts) */
// Describes a "plain" memory are, that is, an area that is just accessed
// as normal memory (with some caveats tho).
@@ -2862,8 +2858,7 @@ static void emit_pmemst_stub(
}
// If the data is non zero, we just wrote over code
// Local-jump to the smc_write (which lives at offset:0)
- unsigned instoffset = (&stub_arena[SMC_WRITE_OFF32] - (((u32*)translation_ptr) + 1));
- mips_emit_b(bne, reg_zero, reg_temp, instoffset);
+ mips_emit_b(bne, reg_zero, reg_temp, branch_offset(&stub_arena[SMC_WRITE_OFF32]));
}
// Store the data (delay slot from the SMC branch)
diff --git a/psp/mips_stub.S b/psp/mips_stub.S
index 5e5a479..3d046d8 100644
--- a/psp/mips_stub.S
+++ b/psp/mips_stub.S
@@ -16,6 +16,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#include "../gpsp_config.h"
+
.set mips32r2
.align 4
@@ -645,3 +647,22 @@ fnptrs:
.long execute_spsr_restore_body # 6
.long execute_store_cpsr_body # 7
+#if !defined(HAVE_MMAP)
+
+# Make this section executable!
+.text
+.section .jit,"awx",%nobits
+.align 2
+.global stub_arena
+.global rom_translation_cache
+.global ram_translation_cache
+
+stub_arena:
+ .space STUB_ARENA_SIZE
+rom_translation_cache:
+ .space ROM_TRANSLATION_CACHE_SIZE
+ram_translation_cache:
+ .space RAM_TRANSLATION_CACHE_SIZE
+
+#endif
+