Search
lxdream.org :: lxdream/src/sh4/xltcache.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/xltcache.c
changeset 809:8bdbf4d95da4
prev788:eb238a77f3c0
next901:32c5cf5e206f
author nkeynes
date Sun Sep 28 01:09:51 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change Initial shadow volume implementation for opaque polygons (stencil isn't quite
right, but we get some kind of shadows now)
file annotate diff log raw
1.1 --- a/src/sh4/xltcache.c Tue Jul 29 23:25:03 2008 +0000
1.2 +++ b/src/sh4/xltcache.c Sun Sep 28 01:09:51 2008 +0000
1.3 @@ -208,7 +208,7 @@
1.4 return result;
1.5 }
1.6
1.7 -xlat_recovery_record_t xlat_get_recovery( void *code, void *native_pc, gboolean recover_after )
1.8 +xlat_recovery_record_t xlat_get_post_recovery( void *code, void *native_pc, gboolean with_terminal )
1.9 {
1.10 if( code != NULL ) {
1.11 uintptr_t pc_offset = ((uint8_t *)native_pc) - ((uint8_t *)code);
1.12 @@ -216,28 +216,39 @@
1.13 uint32_t count = block->recover_table_size;
1.14 xlat_recovery_record_t records = (xlat_recovery_record_t)(&block->code[block->recover_table_offset]);
1.15 uint32_t posn;
1.16 - if( recover_after ) {
1.17 - if( records[count-1].xlat_offset < pc_offset ) {
1.18 - return NULL;
1.19 - }
1.20 - for( posn=count-1; posn > 0; posn-- ) {
1.21 - if( records[posn-1].xlat_offset < pc_offset ) {
1.22 - return &records[posn];
1.23 - }
1.24 - }
1.25 - return &records[0]; // shouldn't happen
1.26 - } else {
1.27 - for( posn = 1; posn < count; posn++ ) {
1.28 - if( records[posn].xlat_offset >= pc_offset ) {
1.29 - return &records[posn-1];
1.30 - }
1.31 - }
1.32 - return &records[count-1];
1.33 + if( count > 0 && !with_terminal )
1.34 + count--;
1.35 + if( records[count-1].xlat_offset < pc_offset ) {
1.36 + return NULL;
1.37 }
1.38 + for( posn=count-1; posn > 0; posn-- ) {
1.39 + if( records[posn-1].xlat_offset < pc_offset ) {
1.40 + return &records[posn];
1.41 + }
1.42 + }
1.43 + return &records[0]; // shouldn't happen
1.44 }
1.45 return NULL;
1.46 }
1.47
1.48 +xlat_recovery_record_t xlat_get_pre_recovery( void *code, void *native_pc )
1.49 +{
1.50 + if( code != NULL ) {
1.51 + uintptr_t pc_offset = ((uint8_t *)native_pc) - ((uint8_t *)code);
1.52 + xlat_cache_block_t block = BLOCK_FOR_CODE(code);
1.53 + uint32_t count = block->recover_table_size;
1.54 + xlat_recovery_record_t records = (xlat_recovery_record_t)(&block->code[block->recover_table_offset]);
1.55 + uint32_t posn;
1.56 + for( posn = 1; posn < count; posn++ ) {
1.57 + if( records[posn].xlat_offset >= pc_offset ) {
1.58 + return &records[posn-1];
1.59 + }
1.60 + }
1.61 + return &records[count-1];
1.62 + }
1.63 + return NULL;
1.64 +}
1.65 +
1.66 void **xlat_get_lut_entry( sh4addr_t address )
1.67 {
1.68 void **page = xlat_lut[XLAT_LUT_PAGE(address)];
.