| | 1 | #define NEW_DYNAREC 1 |
| | 2 | |
| | 3 | #define MAXBLOCK 2048 // in mips instructions |
| | 4 | |
| | 5 | #define NDHACK_NO_SMC_CHECK (1<<0) |
| | 6 | #define NDHACK_GTE_UNNEEDED (1<<1) |
| | 7 | #define NDHACK_GTE_NO_FLAGS (1<<2) |
| | 8 | #define NDHACK_OVERRIDE_CYCLE_M (1<<3) |
| | 9 | #define NDHACK_NO_STALLS (1<<4) |
| | 10 | #define NDHACK_NO_COMPAT_HACKS (1<<5) |
| | 11 | #define NDHACK_THREAD_FORCE (1<<6) |
| | 12 | #define NDHACK_THREAD_FORCE_ON (1<<7) |
| | 13 | |
| | 14 | struct ndrc_globals |
| | 15 | { |
| | 16 | int hacks; |
| | 17 | int hacks_pergame; |
| | 18 | int hacks_old; |
| | 19 | int did_compile; |
| | 20 | int cycle_multiplier_old; |
| | 21 | struct { |
| | 22 | void *handle; |
| | 23 | void *lock; |
| | 24 | void *cond; |
| | 25 | void *dirty_start; |
| | 26 | void *dirty_end; |
| | 27 | unsigned int busy_addr; // 0 is valid, ~0 == none |
| | 28 | int exit; |
| | 29 | } thread; |
| | 30 | }; |
| | 31 | extern struct ndrc_globals ndrc_g; |
| | 32 | |
| | 33 | void new_dynarec_init(void); |
| | 34 | void new_dynarec_cleanup(void); |
| | 35 | void new_dynarec_clear_full(void); |
| | 36 | int new_dynarec_save_blocks(void *save, int size); |
| | 37 | void new_dynarec_load_blocks(const void *save, int size); |
| | 38 | void new_dynarec_print_stats(void); |
| | 39 | |
| | 40 | int new_dynarec_quick_check_range(unsigned int start, unsigned int end); |
| | 41 | void new_dynarec_invalidate_range(unsigned int start, unsigned int end); |
| | 42 | void new_dynarec_invalidate_all_pages(void); |
| | 43 | void new_dyna_clear_cache(void *start, void *end); |
| | 44 | |
| | 45 | void new_dyna_start(void *context); |
| | 46 | void new_dyna_start_at(void *context, void *compiled_code); |
| | 47 | |
| | 48 | struct ht_entry; |
| | 49 | enum ndrc_compile_mode { |
| | 50 | ndrc_cm_no_compile = 0, |
| | 51 | ndrc_cm_compile_live, // from executing code, vaddr is the current pc |
| | 52 | ndrc_cm_compile_offline, |
| | 53 | ndrc_cm_compile_in_thread, |
| | 54 | }; |
| | 55 | void *ndrc_get_addr_ht_param(struct ht_entry *ht, unsigned int vaddr, |
| | 56 | enum ndrc_compile_mode compile_mode); |
| | 57 | |
| | 58 | extern unsigned int ndrc_smrv_regs[32]; |