#include <3ds/os.h>
#include <3ds/services/apt.h>
#include <sys/time.h>
+#include "../libpcsxcore/new_dynarec/new_dynarec.h"
#endif
#include "../deps/libretro-common/rthreads/rthreads.c"
{
sthread_t *h = NULL;
#ifdef _3DS
+ size_t stack_size = 64*1024;
Thread ctr_thread;
int core_id = 0;
s32 prio = 0x30;
core_id = 1;
break;
case PCSXRT_DRC:
+ stack_size = new_dynarec_estimate_stack_size();
+ // fallthrough
case PCSXRT_GPU:
core_id = is_new_3ds ? 2 : 1;
break;
break;
}
- ctr_thread = threadCreate(thread_func, NULL, STACKSIZE, prio, core_id, false);
+ ctr_thread = threadCreate(thread_func, NULL, stack_size, prio, core_id, false);
if (!ctr_thread) {
if (core_id == 1) {
SysPrintf("threadCreate pcsxt %d core %d failed\n",
type, core_id);
core_id = is_new_3ds ? 2 : -1;
- ctr_thread = threadCreate(thread_func, NULL, STACKSIZE,
+ ctr_thread = threadCreate(thread_func, NULL, stack_size,
prio, core_id, false);
}
}
+ SysPrintf("threadCreate: pcsxt %d core %d stack %zd: %p\n",
+ type, core_id, stack_size, ctr_thread);
if (!ctr_thread) {
- SysPrintf("threadCreate pcsxt %d core %d failed\n", type, core_id);
free(h);
return NULL;
}
#endif
}
+int new_dynarec_estimate_stack_size(void)
+{
+ // see: pass6_clean_registers
+ return (sizeof(struct compile_state) + (4+4) * MAXBLOCK + 20 * 1024) & ~4095;
+}
+
static void force_intcall(int i)
{
memset(&dops[i], 0, sizeof(dops[i]));
int new_dynarec_save_blocks(void *save, int size);
void new_dynarec_load_blocks(const void *save, int size);
void new_dynarec_print_stats(void);
+int new_dynarec_estimate_stack_size(void);
int new_dynarec_quick_check_range(unsigned int start, unsigned int end);
void new_dynarec_invalidate_range(unsigned int start, unsigned int end);