Search
lxdream.org :: lxdream/src/sh4/ia32mac.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/ia32mac.h
changeset 906:268ea359f884
prev905:4c17ebd9ef5e
author nkeynes
date Thu Dec 11 23:26:03 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change Disable the generational translation cache - I've got no evidence that it
actually helps performance, and it simplifies things to get rid of it (in
particular, translated code doesn't have to worry about being moved now).
file annotate diff log raw
1.1 --- a/src/sh4/ia32mac.h Wed Oct 29 23:51:58 2008 +0000
1.2 +++ b/src/sh4/ia32mac.h Thu Dec 11 23:26:03 2008 +0000
1.3 @@ -343,39 +343,37 @@
1.4 #include <unwind.h>
1.5
1.6 struct UnwindInfo {
1.7 - int have_result;
1.8 + uintptr_t block_start;
1.9 + uintptr_t block_end;
1.10 void *pc;
1.11 };
1.12
1.13 _Unwind_Reason_Code xlat_check_frame( struct _Unwind_Context *context, void *arg )
1.14 {
1.15 - void *ebp = (void *)_Unwind_GetGR(context, 5);
1.16 - void *expect = (((uint8_t *)&sh4r) + 128 );
1.17 struct UnwindInfo *info = arg;
1.18 - if( ebp == expect ) {
1.19 - info->have_result = 1;
1.20 - info->pc = (void *)_Unwind_GetIP(context);
1.21 - } else if( info->have_result ) {
1.22 + void *pc = (void *)_Unwind_GetIP(context);
1.23 + if( ((uintptr_t)pc) >= info->block_start && ((uintptr_t)pc) < info->block_end ) {
1.24 + info->pc = pc;
1.25 return _URC_NORMAL_STOP;
1.26 }
1.27
1.28 return _URC_NO_REASON;
1.29 }
1.30
1.31 -void *xlat_get_native_pc()
1.32 +void *xlat_get_native_pc( void *code, uint32_t code_size )
1.33 {
1.34 struct _Unwind_Exception exc;
1.35 struct UnwindInfo info;
1.36
1.37 - info.have_result = 0;
1.38 + info.pc = NULL;
1.39 + info.block_start = (uintptr_t)code;
1.40 + info.block_end = info.block_start + code_size;
1.41 void *result = NULL;
1.42 _Unwind_Backtrace( xlat_check_frame, &info );
1.43 - if( info.have_result )
1.44 - return info.pc;
1.45 - return NULL;
1.46 + return info.pc;
1.47 }
1.48 #else
1.49 -void *xlat_get_native_pc()
1.50 +void *xlat_get_native_pc( void *code, uint32_t code_size )
1.51 {
1.52 void *result = NULL;
1.53 asm(
.