Search
lxdream.org :: lxdream/src/sh4/xltcache.h :: diff
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
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/sh4/xltcache.h Thu Aug 23 12:33:27 2007 +0000
1.3 @@ -0,0 +1,75 @@
1.4 +/**
1.5 + * $Id: xltcache.h,v 1.1 2007-08-23 12:33:27 nkeynes Exp $
1.6 + *
1.7 + * Translation cache support (architecture independent)
1.8 + *
1.9 + * Copyright (c) 2005 Nathan Keynes.
1.10 + *
1.11 + * This program is free software; you can redistribute it and/or modify
1.12 + * it under the terms of the GNU General Public License as published by
1.13 + * the Free Software Foundation; either version 2 of the License, or
1.14 + * (at your option) any later version.
1.15 + *
1.16 + * This program is distributed in the hope that it will be useful,
1.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.19 + * GNU General Public License for more details.
1.20 + */
1.21 +
1.22 +#include "dream.h"
1.23 +#include "mem.h"
1.24 +
1.25 +typedef struct xlat_cache_block {
1.26 + int active; /* 0 = deleted, 1 = normal. 2 = accessed (temp-space only) */
1.27 + uint32_t size;
1.28 + void **lut_entry; /* For deletion */
1.29 + unsigned char code[0];
1.30 +} *xlat_cache_block_t;
1.31 +
1.32 +/**
1.33 + * Returns the next block in the new cache list that can be written to by the
1.34 + * translator.
1.35 + */
1.36 +xlat_cache_block_t xlat_start_block(sh4addr_t address);
1.37 +
1.38 +/**
1.39 + * Increases the current block size (only valid between calls to xlat_start_block()
1.40 + * and xlat_commit_block()).
1.41 + * @return the new block, which may be different from the old block.
1.42 + */
1.43 +xlat_cache_block_t xlat_extend_block();
1.44 +
1.45 +/**
1.46 + * Commit the current translation block
1.47 + * @param addr target address (for the lookup table)
1.48 + * @param destsize final size of the translation in bytes.
1.49 + * @param srcsize size of the original data that was translated in bytes
1.50 + */
1.51 +void xlat_commit_block( uint32_t destsize, uint32_t srcsize );
1.52 +
1.53 +/**
1.54 + * Delete (deactivate) the specified block from the cache. Caller is responsible
1.55 + * for ensuring that there really is a block there.
1.56 + */
1.57 +void xlat_delete_block( xlat_cache_block_t block );
1.58 +
1.59 +/**
1.60 + * Retrieve the entry point for the translated code corresponding to the given
1.61 + * SH4 address, or NULL if there is no code for that address.
1.62 + */
1.63 +void *xlat_get_code( sh4addr_t address );
1.64 +
1.65 +/**
1.66 + * Flush the code cache for the page containing the given address
1.67 + */
1.68 +void xlat_flush_page( sh4addr_t address );
1.69 +
1.70 +/**
1.71 + * Flush the entire code cache. This isn't as cheap as one might like
1.72 + */
1.73 +void xlat_flush_cache();
1.74 +
1.75 +/**
1.76 + * Check the internal integrity of the cache
1.77 + */
1.78 +void xlat_check_integrity();
.