3 * Copyright (C) 2009,2010 notaz
5 * This work is licensed under the terms of MAME license.
6 * See COPYING file in the top-level directory.
10 #include <pico/pico_int.h>
13 #if defined(__linux__) && (defined(__aarch64__) || defined(__VFP_FP__))
14 // might be running on a 64k-page kernel
15 #define PICO_PAGE_ALIGN 65536
17 #define PICO_PAGE_ALIGN 4096
19 u8 ALIGNED(PICO_PAGE_ALIGN) tcache_default[DRC_TCACHE_SIZE];
22 void drc_cmn_init(void)
26 tcache = plat_mem_get_for_drc(DRC_TCACHE_SIZE);
28 tcache = tcache_default;
30 ret = plat_mem_set_exec(tcache, DRC_TCACHE_SIZE);
31 elprintf(EL_STATUS, "drc_cmn_init: %p, %zd bytes: %d",
32 tcache, DRC_TCACHE_SIZE, ret);
35 if (PicoIn.opt & POPT_EN_DRC)
40 int *test_out = (void *)tcache;
41 int (*testfunc)(void) = (void *)tcache;
43 elprintf(EL_STATUS, "testing if we can run recompiled code..");
44 *test_out++ = 0xe3a000dd; // mov r0, 0xdd
45 *test_out++ = 0xe12fff1e; // bx lr
46 cache_flush_d_inval_i(tcache, test_out);
48 // we'll usually crash on broken platforms or bad ports,
49 // but do a value check too just in case
51 elprintf(EL_STATUS, "test %s.", ret == 0xdd ? "passed" : "failed");
58 void drc_cmn_cleanup(void)
62 // vim:shiftwidth=2:expandtab