Search
lxdream.org :: lxdream/src/sh4/sh4trans.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4trans.h
changeset 571:9bc09948d0f2
prev561:533f6b478071
next577:a181aeacd6e8
author nkeynes
date Mon Jan 14 09:08:58 2008 +0000 (16 years ago)
branchlxdream-mmu
permissions -rw-r--r--
last change Fix TRAPA in emulator core
file annotate diff log raw
1.1 --- a/src/sh4/sh4trans.h Tue Jan 01 05:08:38 2008 +0000
1.2 +++ b/src/sh4/sh4trans.h Mon Jan 14 09:08:58 2008 +0000
1.3 @@ -16,6 +16,7 @@
1.4 * GNU General Public License for more details.
1.5 */
1.6
1.7 +#include "sh4/xltcache.h"
1.8 #include "dream.h"
1.9 #include "mem.h"
1.10
1.11 @@ -27,8 +28,13 @@
1.12 * allows a little room
1.13 */
1.14 #define EPILOGUE_SIZE 128
1.15 +
1.16 +/** Maximum number of recovery records for a translated block (2048 based on
1.17 + * 1 record per SH4 instruction in a 4K page).
1.18 + */
1.19 +#define MAX_RECOVERY_SIZE 2048
1.20 +
1.21 /**
1.22 -
1.23 */
1.24 uint32_t sh4_xlat_run_slice( uint32_t nanosecs );
1.25
1.26 @@ -38,7 +44,10 @@
1.27 */
1.28 void *sh4_translate_basic_block( sh4addr_t start );
1.29
1.30 +
1.31 extern uint8_t *xlat_output;
1.32 +extern struct xlat_recovery_record xlat_recovery[MAX_RECOVERY_SIZE];
1.33 +extern uint32_t xlat_recovery_posn;
1.34
1.35 /******************************************************************************
1.36 * Code generation - these methods must be provided by the
1.37 @@ -51,3 +60,22 @@
1.38 void sh4_translate_begin_block( sh4addr_t pc );
1.39 uint32_t sh4_translate_instruction( sh4addr_t pc );
1.40 void sh4_translate_end_block( sh4addr_t pc );
1.41 +
1.42 +typedef void (*unwind_thunk_t)(void);
1.43 +
1.44 +/**
1.45 + * From within the translator, (typically called from MMU exception handling routines)
1.46 + * immediately exit the current translation block (performing cleanup as necessary) and
1.47 + * return to sh4_xlat_run_slice(). Effectively a fast longjmp w/ xlat recovery.
1.48 + *
1.49 + * Note: The correct working of this method depends on the translator anticipating the
1.50 + * exception and generating the appropriate recovery block(s) - currently this means
1.51 + * that it should ONLY be called from within the context of a memory read or write.
1.52 + *
1.53 + * @param is_completion If TRUE, exit after completing the current instruction (effectively),
1.54 + * otherwise abort the current instruction with no effect.
1.55 + * @param thunk A function to execute after perform xlat recovery, but before returning
1.56 + * to run_slice. If NULL, control returns directly.
1.57 + * @return This method never returns.
1.58 + */
1.59 +void sh4_translate_unwind_stack( gboolean is_completion, unwind_thunk_t thunk );
.