Search
lxdream.org :: lxdream/src/sh4/xltcache.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/xltcache.h
changeset 359:c588dce7ebde
next366:6fb0d05152d7
author nkeynes
date Thu Aug 23 12:33:27 2007 +0000 (16 years ago)
permissions -rw-r--r--
last change Commit decoder generator
Translator work in progress
Fix mac.l, mac.w in emu core
view annotate diff log raw
     1 /**
     2  * $Id: xltcache.h,v 1.1 2007-08-23 12:33:27 nkeynes Exp $
     3  * 
     4  * Translation cache support (architecture independent)
     5  *
     6  * Copyright (c) 2005 Nathan Keynes.
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  */
    19 #include "dream.h"
    20 #include "mem.h"
    22 typedef struct xlat_cache_block {
    23     int active;  /* 0 = deleted, 1 = normal. 2 = accessed (temp-space only) */
    24     uint32_t size;
    25     void **lut_entry; /* For deletion */
    26     unsigned char code[0];
    27 } *xlat_cache_block_t;
    29 /**
    30  * Returns the next block in the new cache list that can be written to by the
    31  * translator.
    32  */
    33 xlat_cache_block_t xlat_start_block(sh4addr_t address);
    35 /**
    36  * Increases the current block size (only valid between calls to xlat_start_block()
    37  * and xlat_commit_block()). 
    38  * @return the new block, which may be different from the old block.
    39  */
    40 xlat_cache_block_t xlat_extend_block();
    42 /**
    43  * Commit the current translation block
    44  * @param addr target address (for the lookup table)
    45  * @param destsize final size of the translation in bytes.
    46  * @param srcsize size of the original data that was translated in bytes
    47  */
    48 void xlat_commit_block( uint32_t destsize, uint32_t srcsize );
    50 /**
    51  * Delete (deactivate) the specified block from the cache. Caller is responsible
    52  * for ensuring that there really is a block there.
    53  */
    54 void xlat_delete_block( xlat_cache_block_t block );
    56 /**
    57  * Retrieve the entry point for the translated code corresponding to the given
    58  * SH4 address, or NULL if there is no code for that address.
    59  */
    60 void *xlat_get_code( sh4addr_t address );
    62 /**
    63  * Flush the code cache for the page containing the given address
    64  */
    65 void xlat_flush_page( sh4addr_t address );
    67 /**
    68  * Flush the entire code cache. This isn't as cheap as one might like
    69  */
    70 void xlat_flush_cache();
    72 /**
    73  * Check the internal integrity of the cache
    74  */
    75 void xlat_check_integrity();
.