Path: blob/master/libmupen64plus/mupen64plus-core/src/r4300/recomp.h
2 views
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *1* Mupen64plus - recomp.h *2* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *3* Copyright (C) 2002 Hacktarux *4* *5* This program is free software; you can redistribute it and/or modify *6* it under the terms of the GNU General Public License as published by *7* the Free Software Foundation; either version 2 of the License, or *8* (at your option) any later version. *9* *10* This program is distributed in the hope that it will be useful, *11* but WITHOUT ANY WARRANTY; without even the implied warranty of *12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *13* GNU General Public License for more details. *14* *15* You should have received a copy of the GNU General Public License *16* along with this program; if not, write to the *17* Free Software Foundation, Inc., *18* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *19* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */2021#ifndef RECOMP_H22#define RECOMP_H2324#include <stddef.h>25#if defined(__x86_64__)26#include "x86_64/assemble_struct.h"27#else28#include "x86/assemble_struct.h"29#endif3031typedef struct _precomp_instr32{33void (*ops)(void);34union35{36struct37{38long long int *rs;39long long int *rt;40short immediate;41} i;42struct43{44unsigned int inst_index;45} j;46struct47{48long long int *rs;49long long int *rt;50long long int *rd;51unsigned char sa;52unsigned char nrd;53} r;54struct55{56unsigned char base;57unsigned char ft;58short offset;59} lf;60struct61{62unsigned char ft;63unsigned char fs;64unsigned char fd;65} cf;66} f;67unsigned int addr; /* word-aligned instruction address in r4300 address space */68unsigned int local_addr; /* byte offset to start of corresponding x86_64 instructions, from start of code block */69reg_cache_struct reg_cache_infos;70} precomp_instr;7172typedef struct _precomp_block73{74precomp_instr *block;75unsigned int start;76unsigned int end;77unsigned char *code;78unsigned int code_length;79unsigned int max_code_length;80void *jumps_table;81int jumps_number;82void *riprel_table;83int riprel_number;84//unsigned char md5[16];85unsigned int adler32;86} precomp_block;8788void recompile_block(int *source, precomp_block *block, unsigned int func);89void init_block(precomp_block *block);90void free_block(precomp_block *block);91void recompile_opcode(void);92void prefetch_opcode(unsigned int op, unsigned int nextop);93void dyna_jump(void);94void dyna_start(void *code);95void dyna_stop(void);96void *realloc_exec(void *ptr, size_t oldsize, size_t newsize);9798extern precomp_instr *dst; /* precomp_instr structure for instruction being recompiled */99100#if defined(__x86_64__)101#include "x86_64/assemble.h"102#include "x86_64/regcache.h"103#else104#include "x86/assemble.h"105#include "x86/regcache.h"106#endif107108#endif109110111112