Search
lxdream.org :: lxdream/src/sh4/sh4core.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4core.h
changeset 740:dd11269ee48b
prev736:a02d1475ccfd
next759:f16975739abc
author nkeynes
date Wed Jul 16 10:40:10 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Rationalize the two SH4 run slice impls into sh4.c, and tidy up the vm exits.
Fixes broken soft-reset with emulator core
Fixes broken build without translator
file annotate diff log raw
1.1 --- a/src/sh4/sh4core.h Mon Jul 14 07:44:42 2008 +0000
1.2 +++ b/src/sh4/sh4core.h Wed Jul 16 10:40:10 2008 +0000
1.3 @@ -72,6 +72,42 @@
1.4 */
1.5 #define GET_ICACHE_END() (sh4_icache.page_vma + (~sh4_icache.mask) + 1)
1.6
1.7 +
1.8 +/**
1.9 + * SH4 vm-exit flag - exit the current block but continue (eg exception handling)
1.10 + */
1.11 +#define CORE_EXIT_CONTINUE 1
1.12 +
1.13 +/**
1.14 + * SH4 vm-exit flag - exit the current block and halt immediately (eg fatal error)
1.15 + */
1.16 +#define CORE_EXIT_HALT 2
1.17 +
1.18 +/**
1.19 + * SH4 vm-exit flag - exit the current block and halt immediately for a system
1.20 + * breakpoint.
1.21 + */
1.22 +#define CORE_EXIT_BREAKPOINT 3
1.23 +
1.24 +/**
1.25 + * SH4 vm-exit flag - exit the current block and continue after performing a full
1.26 + * system reset (dreamcast_reset())
1.27 + */
1.28 +#define CORE_EXIT_SYSRESET 4
1.29 +
1.30 +/**
1.31 + * SH4 vm-exit flag - exit the current block and continue after the next IRQ.
1.32 + */
1.33 +#define CORE_EXIT_SLEEP 5
1.34 +
1.35 +/**
1.36 + * SH4 vm-exit flag - exit the current block and flush all instruction caches (ie
1.37 + * if address translation has changed)
1.38 + */
1.39 +#define CORE_EXIT_FLUSH_ICACHE 6
1.40 +
1.41 +typedef uint32_t (*sh4_run_slice_fn)(uint32_t);
1.42 +
1.43 /* SH4 module functions */
1.44 void sh4_init( void );
1.45 void sh4_reset( void );
1.46 @@ -81,6 +117,25 @@
1.47 uint32_t sh4_xlat_run_slice( uint32_t nanos ); // Run single timeslice using translator
1.48 uint32_t sh4_sleep_run_slice( uint32_t nanos ); // Run single timeslice while the CPU is asleep
1.49
1.50 +/**
1.51 + * Immediately exit from the currently executing instruction with the given
1.52 + * exit code. This method does not return.
1.53 + */
1.54 +void sh4_core_exit( int exit_code );
1.55 +
1.56 +/**
1.57 + * Exit the current block at the end of the current instruction, flush the
1.58 + * translation cache (completely) and return control to sh4_xlat_run_slice.
1.59 + *
1.60 + * As a special case, if the current instruction is actually the last
1.61 + * instruction in the block (ie it's in a delay slot), this function
1.62 + * returns to allow normal completion of the translation block. Otherwise
1.63 + * this function never returns.
1.64 + *
1.65 + * Must only be invoked (indirectly) from within translated code.
1.66 + */
1.67 +void sh4_flush_icache();
1.68 +
1.69 /* SH4 peripheral module functions */
1.70 void CPG_reset( void );
1.71 void DMAC_reset( void );
.